Class: BingAdsApi::CustomerManagement
- Defined in:
- lib/bing-ads-api/service/customer_management.rb
Overview
Public : This class represents the Customer Management Services defined in the Bing Ads API, to manage customer accounts
- Author
Examples
= {
:environment => :sandbox,
:username => "username",
:password => "pass",
:developer_token => "SOME_TOKEN",
:customer_id => "1234567",
:account_id => "9876543" }
service = BingAdsApi::CustomerManagement.new()
Constant Summary
Constants inherited from Service
Instance Attribute Summary
Attributes inherited from Service
Instance Method Summary collapse
-
#get_accounts_info(customer_id = nil, only_parent_accounts = false) ⇒ Object
Public : Gets a list of objects that contains account identification information, for example the name and identifier of the account, for the specified customer.
-
#initialize(options = {}) ⇒ CustomerManagement
constructor
Public : Constructor .
Methods inherited from Service
Constructor Details
#initialize(options = {}) ⇒ CustomerManagement
Public : Constructor
- Author
options - Hash with the parameters for the client proxy and the environment
Examples
= {
:environment => :sandbox,
:username => "username",
:password => "password",
:developer_token => "DEV_TOKEN",
:customer_id => "123456",
:account_id => "654321"
}
service = BingAdsApi::CustomerManagement.new()
38 39 40 |
# File 'lib/bing-ads-api/service/customer_management.rb', line 38 def initialize(={}) super() end |
Instance Method Details
#get_accounts_info(customer_id = nil, only_parent_accounts = false) ⇒ Object
Public : Gets a list of objects that contains account identification information, for example the name and identifier of the account, for the specified customer.
- Author
Parameters
customer_id - identifier for the customer who owns the accounts. If nil, then the authentication customer id is used only_parent_accounts - boolean to determine whether to return only the accounts that belong to the customer or to also return the accounts that the customer manages for other customers. Default false
Examples
customer_management_service.get_accounts_info
# => Array[BingAdsApi::AccountsInfo]
- Returns
-
Array of BingAdsApi::AccountsInfo
- Raises
-
exception
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/bing-ads-api/service/customer_management.rb', line 64 def get_accounts_info(customer_id=nil, only_parent_accounts=false) response = call(:get_accounts_info, {customer_id: customer_id || self.client_proxy.customer_id, only_parent_accounts: only_parent_accounts.to_s}) response_hash = get_response_hash(response, __method__) accounts = response_hash[:accounts_info][:account_info].map do |account_hash| BingAdsApi::AccountInfo.new(account_hash) end return accounts end |