Class: BingAdsRubySdk::Header
- Inherits:
-
Object
- Object
- BingAdsRubySdk::Header
- Defined in:
- lib/bing_ads_ruby_sdk/header.rb
Overview
Contains the SOAP Request header informations
Instance Method Summary collapse
-
#content ⇒ Hash
Authorization and identification data that will be added to the SOAP header.
-
#initialize(developer_token:, client_id:, store:, client_secret: nil) ⇒ Header
constructor
A new instance of Header.
- #set_customer(account_id:, customer_id:) ⇒ Object
Constructor Details
#initialize(developer_token:, client_id:, store:, client_secret: nil) ⇒ Header
Returns a new instance of Header.
9 10 11 12 13 14 15 |
# File 'lib/bing_ads_ruby_sdk/header.rb', line 9 def initialize(developer_token:, client_id:, store:, client_secret: nil) @developer_token = developer_token @client_id = client_id @client_secret = client_secret @oauth_store = store @customer = {} end |
Instance Method Details
#content ⇒ Hash
Returns Authorization and identification data that will be added to the SOAP header.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bing_ads_ruby_sdk/header.rb', line 18 def content { "AuthenticationToken" => auth_handler.fetch_or_refresh, "DeveloperToken" => developer_token, "CustomerId" => customer[:customer_id], "CustomerAccountId" => customer[:account_id] }.tap do |hash| hash["ClientSecret"] = client_secret if client_secret end end |
#set_customer(account_id:, customer_id:) ⇒ Object
29 30 31 32 33 |
# File 'lib/bing_ads_ruby_sdk/header.rb', line 29 def set_customer(account_id:, customer_id:) customer[:account_id] = account_id customer[:customer_id] = customer_id self end |