Class: BingAdsRubySdk::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/bing_ads_ruby_sdk/header.rb

Overview

Contains the SOAP Request header informations

Instance Method Summary collapse

Constructor Details

#initialize(developer_token:, client_id:, store:) ⇒ Header

Returns a new instance of Header.

Parameters:

  • developer_token
  • client_id
  • store

    instance of a store



9
10
11
12
13
14
# File 'lib/bing_ads_ruby_sdk/header.rb', line 9

def initialize(developer_token:, client_id:, store:)
  @developer_token = developer_token
  @client_id = client_id
  @oauth_store = store
  @customer = {}
end

Instance Method Details

#contentHash

Returns Authorization and identification data that will be added to the SOAP header.

Returns:

  • (Hash)

    Authorization and identification data that will be added to the SOAP header



17
18
19
20
21
22
23
24
# File 'lib/bing_ads_ruby_sdk/header.rb', line 17

def content
  {
    "AuthenticationToken" => auth_handler.fetch_or_refresh,
    "DeveloperToken" =>      developer_token,
    "CustomerId" =>          customer[:customer_id],
    "CustomerAccountId" =>   customer[:account_id]
  }
end

#set_customer(account_id:, customer_id:) ⇒ Object



26
27
28
29
30
# File 'lib/bing_ads_ruby_sdk/header.rb', line 26

def set_customer(account_id:, customer_id:)
  customer[:account_id] = 
  customer[:customer_id] = customer_id
  self
end