Class: Fog::Account::Softlayer::Real

Inherits:
Object
  • Object
show all
Includes:
Softlayer::Compute::Shared, Softlayer::Slapi
Defined in:
lib/fog/softlayer/account.rb,
lib/fog/softlayer/requests/account/get_brand.rb,
lib/fog/softlayer/requests/account/create_brand.rb,
lib/fog/softlayer/requests/account/get_account_owned_brands.rb,
lib/fog/softlayer/requests/account/get_brand_owned_accounts.rb

Overview

Makes real connections to Softlayer.

Instance Method Summary collapse

Methods included from Softlayer::Compute::Shared

valid_request?

Methods included from Softlayer::Slapi

slapi_request

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



54
55
56
57
# File 'lib/fog/softlayer/account.rb', line 54

def initialize(options={})
  @softlayer_api_key = options[:softlayer_api_key]
  @softlayer_username = options[:softlayer_username]
end

Instance Method Details

#create_brand(attributes) ⇒ Object



35
36
37
# File 'lib/fog/softlayer/requests/account/create_brand.rb', line 35

def create_brand(attributes)
  request(:brand, :create_object, :body => attributes, :http_method => :POST)
end

#get_account_owned_brands(identifier) ⇒ Object



31
32
33
34
# File 'lib/fog/softlayer/requests/account/get_account_owned_brands.rb', line 31

def (identifier)
  return request(:account, :getOwnedBrands) if identifier.nil?
  request(:account, "#{identifier}/getOwnedBrands")
end

#get_brand(identifier) ⇒ Object



30
31
32
# File 'lib/fog/softlayer/requests/account/get_brand.rb', line 30

def get_brand(identifier)
  request(:brand, identifier, :expected => [200, 404], :query => 'objectMask=mask[account]')
end

#get_brand_owned_accounts(identifier) ⇒ Object



32
33
34
# File 'lib/fog/softlayer/requests/account/get_brand_owned_accounts.rb', line 32

def get_brand_owned_accounts(identifier)
  request(:brand, "#{identifier}/getOwnedAccounts")
end

#request(service, path, options = {}) ⇒ Object



59
60
61
62
# File 'lib/fog/softlayer/account.rb', line 59

def request(service, path, options = {})
  options = {:username => @softlayer_username, :api_key => @softlayer_api_key}.merge(options)
  Fog::Softlayer::Slapi.slapi_request(service, path, options)
end