class BingAdsRubySdk::Header
Contains the SOAP Request header informations
Attributes
client_id[R]
client_secret[R]
customer[R]
developer_token[R]
oauth_store[R]
Public Class Methods
new(developer_token:, client_id:, store:, client_secret: nil)
click to toggle source
@param developer_token
@param client_id
@param store instance of a store
# 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
Public Instance Methods
content()
click to toggle source
@return [Hash] Authorization and identification data that will be added to the SOAP header
# 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:)
click to toggle source
# 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
Private Instance Methods
auth_handler()
click to toggle source
# File lib/bing_ads_ruby_sdk/header.rb, line 39 def auth_handler @auth_handler ||= ::BingAdsRubySdk::OAuth2::AuthorizationHandler.new( developer_token: developer_token, client_id: client_id, store: oauth_store, client_secret: client_secret ) end