1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[Brightbox] Updates request docs to use Yard

This commit is contained in:
Paul Thornthwaite 2012-11-15 13:48:32 +00:00
parent 6c1d734a57
commit d94df4eca3
10 changed files with 84 additions and 123 deletions

View file

@ -189,14 +189,11 @@ module Fog
# Returns the scoped account being used for requests
#
# API Clients:: This is the owning account
# User Apps:: This is the account specified by either +account_id+
# option on a connection or the +brightbox_account+
# setting in your configuration
# * For API clients this is the owning account
# * For User applications this is the account specified by either +account_id+
# option on a connection or the +brightbox_account+ setting in your configuration
#
# === Returns:
#
# <tt>Fog::Compute::Brightbox::Account</tt>
# @return [Fog::Compute::Brightbox::Account]
#
def account
Fog::Compute::Brightbox::Account.new(get_scoped_account)

View file

@ -2,20 +2,18 @@ module Fog
module Compute
class Brightbox
class Real
# Add a number of servers to a server group
# Add a number of servers to the server group.
#
# >> Compute[:brightbox].add_servers_server_group "grp-12345", :servers => [{:server => "srv-abcde"}]
# @param [String] identifier Unique reference to identify the resource
# @param [Hash] options
# @option options [Array<Hash>] :servers Array of Hashes containing `{"server" => server_id}` for each server to add
#
# == Parameters:
# * identifier (String) - The identifier of the server group to add to
# * options
# * servers (Array) - An Array of Hashes containing {"server" => server_id} for each server to add
# [\[{"server" => "srv-abcde"}, {"server" => "srv-fghij"}\]]
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# == Returns:
# @see https://api.gb1.brightbox.com/1.0/#server_group_add_servers_server_group
#
# A Ruby hash of the server response
# @example
# Compute[:brightbox].add_servers_server_group "grp-12345", :servers => [{"server" => "srv-abcde"}, {"server" => "srv-fghij"}]
#
def add_servers_server_group(identifier, options)
return nil if identifier.nil? || identifier == ""

View file

@ -2,25 +2,17 @@ module Fog
module Compute
class Brightbox
class Real
# Requests details about an account from the API
# Get full details of the account.
#
# === Parameters:
# @overload get_account(identifier)
# @param [String] identifier Unique reference to identify the resource
#
# <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
# @overload get_account()
# @deprecated Use {Fog::Compute::Brightbox::Real#get_scoped_account} instead
#
# === Returns:
# @return [Hash] The JSON response parsed to a Hash
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
#
# === Notes:
#
# This also supports a deprecated form where if an identifier is not
# passed then the scoping account is returned instead. This should not
# be used in new code. Use #get_scoped_account instead.
#
# === Reference:
#
# https://api.gb1.brightbox.com/1.0/#account_get_account
# @see https://api.gb1.brightbox.com/1.0/#account_get_account
#
def get_account(identifier = nil)
if identifier.nil? || identifier.empty?

View file

@ -4,9 +4,7 @@ module Fog
class Real
# Requests details about authenticated user from the API
#
# === Returns:
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
# @return [Hash] The JSON response parsed to a Hash
#
def get_authenticated_user
request("get", "/1.0/user", [200])

View file

@ -2,13 +2,9 @@ module Fog
module Compute
class Brightbox
class Real
# Requests details about currently scoped account
#
# === Returns:
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
#
# @return [Hash] The JSON response parsed to a Hash
def get_scoped_account
request("get", "/1.0/account", [200])
end

View file

@ -2,25 +2,17 @@ module Fog
module Compute
class Brightbox
class Real
# Requests details about a user from the API
# Get full details of the user.
#
# === Parameters:
# @overload get_user(identifier)
# @param [String] identifier Unique reference to identify the resource
#
# <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
# @overload get_user()
# @deprecated Use {Fog::Compute::Brightbox::Real#get_authenticated_user} instead
#
# === Returns:
# @return [Hash] The JSON response parsed to a Hash
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
#
# === Notes:
#
# This also supports a deprecated form where if an identifier is not
# passed then the requesting user is returned instead. This should not
# be used in new code. Use #get_authenticated_user instead.
#
# === Reference:
#
# https://api.gb1.brightbox.com/1.0/#user_get_user
# @see https://api.gb1.brightbox.com/1.0/#user_get_user
#
def get_user(identifier = nil)
if identifier.nil? || identifier == ""

View file

@ -2,21 +2,19 @@ module Fog
module Compute
class Brightbox
class Real
# Moves a number of servers between two server groups
# Removes a number of server from the server group and adds them to another server group given in parameters.
#
# >> Compute[:brightbox].remove_servers_server_group "grp-12345", :destination => "grp-67890", :servers => [{:server => "srv-abcde"}]
# @param [String] identifier Unique reference to identify the resource
# @param [Hash] options
# @option options [Array<Hash>] :servers Array of Hashes containing `{"server" => server_id}` for each server to remove
# @option options [String] :destination ServerGroup to move servers to
#
# == Parameters:
# * identifier - The identifier (String) of the server group to remove from
# * options (Hash)
# * destination (String)- The identifier of the server group to move to
# * servers (Array) - Array of Hashes containing {"server" => server_id} for each server to remove
# [\[{"server" => "srv-abcde"}, {"server" => "srv-fghij"}\]]
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# == Returns:
# @see https://api.gb1.brightbox.com/1.0/#server_group_move_servers_server_group
#
# A Ruby hash of the server response
# @example
# Compute[:brightbox].remove_servers_server_group "grp-12345", :destination => "grp-67890", :servers => [{"server" => "srv-abcde"}, {"server" => "srv-fghij"}]
#
def move_servers_server_group(identifier, options)
return nil if identifier.nil? || identifier == ""

View file

@ -2,19 +2,18 @@ module Fog
module Compute
class Brightbox
class Real
# Remove a number of servers from a server group
# Remove a number of servers from the server group.
#
# >> Compute[:brightbox].remove_servers_server_group "grp-12345", :servers => [{:server => "srv-abcde"}]
# @param [String] identifier Unique reference to identify the resource
# @param [Hash] options
# @option options [Array<Hash>] :servers Array of Hashes containing {"server" => server_id} for each server
#
# == Parameters:
# * identifier (String) - The identifier of the server group to remove from
# * options (Array) - An Array of Hashes containing {"server" => server_id} for each server to remove
# [\[{"server" => "srv-abcde"}, {"server" => "srv-fghij"}\]]
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# == Returns:
# @see https://api.gb1.brightbox.com/1.0/#server_group_remove_servers_server_group
#
# A Ruby hash of the server response
# @example
# Compute[:brightbox].remove_servers_server_group "grp-12345", :servers => [{"server" => "srv-abcde"}, {"server" => "srv-fghij"}]
#
def remove_servers_server_group(identifier, options)
return nil if identifier.nil? || identifier == ""

View file

@ -2,40 +2,38 @@ module Fog
module Compute
class Brightbox
class Real
# Requests an update to the currently scoped account
# Update some details of the account.
#
# === Parameters:
# @overload update_account(identifier, options)
# @param [String] identifier Unique reference to identify the resource
# @param [Hash] options
# @option options [String] :name Account name
# @option options [String] :address_1 First line of address
# @option options [String] :address_2 Second line of address
# @option options [String] :city City part of address
# @option options [String] :county County part of address
# @option options [String] :postcode Postcode or Zipcode
# @option options [String] :country_code ISO 3166-1 two letter code (example: `GB`)
# @option options [String] :vat_registration_number Must be a valid EU VAT number or `nil`
# @option options [String] :telephone_number Valid International telephone number in E.164 format prefixed with `+`
#
# <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
# <tt>options <Hash></tt>:: Hash of options for update
# @overload update_account(options)
# @deprecated Use {Fog::Compute::Brightbox::Real#update_scoped_account} instead
#
# === Options:
# @param [Hash] options
# @option options [String] :name Account name
# @option options [String] :address_1 First line of address
# @option options [String] :address_2 Second line of address
# @option options [String] :city City part of address
# @option options [String] :county County part of address
# @option options [String] :postcode Postcode or Zipcode
# @option options [String] :country_code ISO 3166-1 two letter code (example: `GB`)
# @option options [String] :vat_registration_number Must be a valid EU VAT number or `nil`
# @option options [String] :telephone_number Valid International telephone number in E.164 format prefixed with `+`
#
# <tt>name</tt>:: Account name
# <tt>address_1</tt>:: First line of address
# <tt>address_2</tt>:: Second line of address
# <tt>city</tt>:: City part of address
# <tt>county</tt>:: County part of address
# <tt>postcode</tt>:: Postal code
# <tt>country_code</tt>:: ISO 3166-1 two letter code (example: +GB+)
# <tt>vat_registration_number</tt>:: Valid EU VAT Number or +nil+
# <tt>telephone_number</tt>:: Valid International telephone number in E.164 format prefixed with +
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# === Returns:
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
# <tt>nil</tt>:: If no options were passed to update
#
# === Notes:
#
# This also supports a deprecated form where if an identifier is not
# passed then the scoping account is updated instead. This should not
# be used in new code. Use #update_scoped_account instead.
#
# === Reference:
#
# https://api.gb1.brightbox.com/1.0/#account_update_account
# @see https://api.gb1.brightbox.com/1.0/#account_update_account
#
def update_account(*args)
if args.size == 2

View file

@ -2,29 +2,22 @@ module Fog
module Compute
class Brightbox
class Real
# Requests an update to the currently scoped account
#
# === Parameters:
# @param [Hash] options
# @option options [String] :name Account name
# @option options [String] :address_1 First line of address
# @option options [String] :address_2 Second line of address
# @option options [String] :city City part of address
# @option options [String] :county County part of address
# @option options [String] :postcode Postcode or Zipcode
# @option options [String] :country_code ISO 3166-1 two letter code (example: `GB`)
# @option options [String] :vat_registration_number Must be a valid EU VAT number or `nil`
# @option options [String] :telephone_number Valid International telephone number in E.164 format prefixed with `+`
#
# <tt>options</tt>:: Hash of options for update
# @return [Hash, nil] The JSON response parsed to a Hash or nil if no options passed
#
# === Options:
#
# <tt>name</tt>:: Account name
# <tt>address_1</tt>:: First line of address
# <tt>address_2</tt>:: Second line of address
# <tt>city</tt>:: City part of address
# <tt>county</tt>:: County part of address
# <tt>postcode</tt>:: Postal code
# <tt>country_code</tt>:: ISO 3166-1 two letter code (example: +GB+)
# <tt>vat_registration_number</tt>:: Valid EU VAT Number or +nil+
# <tt>telephone_number</tt>:: Valid International telephone number in E.164 format prefixed with +
#
# === Returns:
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
# <tt>nil</tt>:: If no options were passed to update
# @see https://api.gb1.brightbox.com/1.0/#account_update_account
#
def update_scoped_account(options)
return nil if options.empty? || options.nil?