Class: SoapyBing::Accounts

Inherits:
Object
  • Object
show all
Defined in:
lib/soapy_bing/accounts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oauth: {}, customer: {}) ⇒ Accounts

Returns a new instance of Accounts.



6
7
8
9
# File 'lib/soapy_bing/accounts.rb', line 6

def initialize(oauth: {}, customer: {})
  @oauth_credentials = OauthCredentials.new(oauth)
  @customer = Customer.new(customer)
end

Instance Attribute Details

#customerObject (readonly)

Returns the value of attribute customer.



4
5
6
# File 'lib/soapy_bing/accounts.rb', line 4

def customer
  @customer
end

#oauth_credentialsObject (readonly)

Returns the value of attribute oauth_credentials.



4
5
6
# File 'lib/soapy_bing/accounts.rb', line 4

def oauth_credentials
  @oauth_credentials
end

Instance Method Details

#listObject



11
12
13
14
15
16
17
18
19
# File 'lib/soapy_bing/accounts.rb', line 11

def list
  do_request(Soap::Request::GetAccountsInfoRequest).map do ||
    Account.new(
      developer_token: customer.developer_token,
      customer_id: customer.customer_id,
      account_id: ['Id']
    )
  end
end