Class: BingAdsRubySdk::Api

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(developer_token:, client_id:, oauth_store:, version: DEFAULT_SDK_VERSION, environment: :production, client_secret: nil) ⇒ Api

Returns a new instance of Api.

Parameters:

  • version (Symbol) (defaults to: DEFAULT_SDK_VERSION)

    API version, used to choose WSDL configuration version

  • environment (Symbol) (defaults to: :production)
  • developer_token
  • client_id

Options Hash (environment:):

  • :production (Symbol)

    Use the production WSDL configuration

  • :sandbox (Symbol)

    Use the sandbox WSDL configuration



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bing_ads_ruby_sdk/api.rb', line 26

def initialize(developer_token:, client_id:, oauth_store:, version: DEFAULT_SDK_VERSION,
  environment: :production,
  client_secret: nil)
  @version = version
  @environment = environment
  @header = Header.new(
    developer_token: developer_token,
    client_id: client_id,
    client_secret: client_secret,
    store: oauth_store
  )
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



18
19
20
# File 'lib/bing_ads_ruby_sdk/api.rb', line 18

def header
  @header
end

Instance Method Details

#ad_insightObject



39
40
41
# File 'lib/bing_ads_ruby_sdk/api.rb', line 39

def ad_insight
  build_service(BingAdsRubySdk::Services::AdInsight)
end

#bulkObject



43
44
45
# File 'lib/bing_ads_ruby_sdk/api.rb', line 43

def bulk
  build_service(BingAdsRubySdk::Services::Bulk)
end

#campaign_managementObject



47
48
49
# File 'lib/bing_ads_ruby_sdk/api.rb', line 47

def campaign_management
  build_service(BingAdsRubySdk::Services::CampaignManagement)
end

#customer_billingObject



51
52
53
# File 'lib/bing_ads_ruby_sdk/api.rb', line 51

def customer_billing
  build_service(BingAdsRubySdk::Services::CustomerBilling)
end

#customer_managementObject



55
56
57
# File 'lib/bing_ads_ruby_sdk/api.rb', line 55

def customer_management
  build_service(BingAdsRubySdk::Services::CustomerManagement)
end

#reportingObject



59
60
61
# File 'lib/bing_ads_ruby_sdk/api.rb', line 59

def reporting
  build_service(BingAdsRubySdk::Services::Reporting)
end

#set_customer(account_id:, customer_id:) ⇒ Object



63
64
65
# File 'lib/bing_ads_ruby_sdk/api.rb', line 63

def set_customer(account_id:, customer_id:)
  header.set_customer(account_id: , customer_id: customer_id)
end