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(version: DEFAULT_SDK_VERSION, environment: :production, developer_token:, client_id:, oauth_store:, 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
38
39
40
# File 'lib/bing_ads_ruby_sdk/api.rb', line 26

def initialize(version: DEFAULT_SDK_VERSION,
               environment: :production,
               developer_token:,
               client_id:,
               oauth_store:,
               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



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

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

#bulkObject



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

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

#campaign_managementObject



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

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

#customer_billingObject



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

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

#customer_managementObject



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

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

#reportingObject



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

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

#set_customer(account_id:, customer_id:) ⇒ Object



66
67
68
# File 'lib/bing_ads_ruby_sdk/api.rb', line 66

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