Sha256: 97c505afc0fbe13a66cff8e23c04154212f1fcb5205f9285650256908a67a24c

Contents?: true

Size: 1.67 KB

Versions: 7

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

require 'securerandom'

module Examples
  class << self

    def random
      SecureRandom.hex
    end

    def build_api
      BingAdsRubySdk::Api.new(
        developer_token: developer_token,
        client_id: client_id,
        oauth_store: store
      ).tap do |api|
        if account_id && customer_id
          api.set_customer(
            customer_id: customer_id,
            account_id: account_id
          )
        end
      end
    end

    def client_id
      # you have to fill this in with data from bing
    end

    def developer_token
      # you have to fill this in with data from bing
    end

    def parent_customer_id
      # you have to fill this in with data from bing
    end

    def customer_id
      # you have to fill this in with data you get after running 1_customer folder
    end

    def account_id
      # you have to fill this in with data you get after running 1_customer folder
    end

    def uet_tag_id
      # you have to fill this in with data you get after running 2_with_customer folder
    end

    def campaign_id
      # you have to fill this in with data you get after running 2_with_customer folder
    end

    def conversion_goal_id
      # you have to fill this in with data you get after running 3_with_uet_tag folder
    end

    def ad_group_id
      # you have to fill this in with data you get after running 5_with_campaign folder
    end

    def store
      ::BingAdsRubySdk::OAuth2::FsStore.new(store_filename)
    end

    def store_filename
      ENV.fetch('BING_STORE_FILENAME')
    end
  end
end

RSpec.shared_context 'use api' do
  let(:random) { Examples.random }
  let(:api) { Examples.build_api }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bing_ads_ruby_sdk-1.3.4 spec/examples/examples.rb
bing_ads_ruby_sdk-1.3.3 spec/examples/examples.rb
bing_ads_ruby_sdk-1.3.2 spec/examples/examples.rb
bing_ads_ruby_sdk-1.3.1 spec/examples/examples.rb
bing_ads_ruby_sdk-1.3.0 spec/examples/examples.rb
bing_ads_ruby_sdk-1.2.0 spec/examples/examples.rb
bing_ads_ruby_sdk-1.1.1 spec/examples/examples.rb