Sha256: 86a4b913ce56a67292922e42a999159b7b5b8b41543fe57effca57b24d83bea8

Contents?: true

Size: 1.67 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
bing_ads_ruby_sdk-1.5.0 spec/examples/examples.rb