bing_ads_ruby_sdk 1.0.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +52 -0
- data/.github/delete-merged-branch-config.yml +6 -0
- data/.github/stale.yml +19 -0
- data/.gitignore +2 -0
- data/README.md +25 -5
- data/bing_ads_ruby_sdk.gemspec +6 -5
- data/changelog.md +27 -2
- data/lib/bing_ads_ruby_sdk/api.rb +3 -1
- data/lib/bing_ads_ruby_sdk/configuration.rb +2 -1
- data/lib/bing_ads_ruby_sdk/header.rb +8 -4
- data/lib/bing_ads_ruby_sdk/http_client.rb +19 -9
- data/lib/bing_ads_ruby_sdk/oauth2/authorization_handler.rb +17 -10
- data/lib/bing_ads_ruby_sdk/services/base.rb +6 -6
- data/lib/bing_ads_ruby_sdk/services/campaign_management.rb +3 -0
- data/lib/bing_ads_ruby_sdk/version.rb +2 -2
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/ad_insight.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/bulk.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/campaign_management.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/customer_billing.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/customer_management.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/production/reporting.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/ad_insight.xml +3037 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/bulk.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/campaign_management.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/customer_billing.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/customer_management.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/v13/sandbox/reporting.xml +1 -0
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/ad_insight.xml +1440 -1468
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/bulk.xml +83 -147
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/campaign_management.xml +711 -417
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/customer_billing.xml +62 -112
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/customer_management.xml +231 -176
- data/lib/bing_ads_ruby_sdk/wsdl/{v12 → v13}/test/reporting.xml +110 -158
- data/lib/bing_ads_ruby_sdk/wsdl/wsdl_source.txt +18 -18
- data/spec/bing_ads_ruby_sdk/api_spec.rb +17 -0
- data/spec/bing_ads_ruby_sdk/errors/error_handler_spec.rb +479 -0
- data/spec/bing_ads_ruby_sdk/errors/errors_spec.rb +13 -0
- data/spec/bing_ads_ruby_sdk/header_spec.rb +60 -0
- data/spec/bing_ads_ruby_sdk/http_client_spec.rb +44 -0
- data/spec/bing_ads_ruby_sdk/oauth2/fs_store_spec.rb +20 -0
- data/spec/bing_ads_ruby_sdk/postprocessors/cast_long_arrays_spec.rb +30 -0
- data/spec/bing_ads_ruby_sdk/postprocessors/snakize_spec.rb +40 -0
- data/spec/bing_ads_ruby_sdk/preprocessors/camelize_spec.rb +40 -0
- data/spec/bing_ads_ruby_sdk/preprocessors/order_spec.rb +119 -0
- data/spec/bing_ads_ruby_sdk/services/bulk_spec.rb +56 -0
- data/spec/bing_ads_ruby_sdk/services/campaign_management_spec.rb +307 -0
- data/spec/bing_ads_ruby_sdk/services/customer_management_spec.rb +97 -0
- data/spec/bing_ads_ruby_sdk_spec.rb +5 -0
- data/spec/examples/1_customer_creation/customer_spec.rb +35 -0
- data/spec/examples/2_with_customer/budget_spec.rb +54 -0
- data/spec/examples/2_with_customer/campaigns_spec.rb +27 -0
- data/spec/examples/2_with_customer/customer_management_spec.rb +190 -0
- data/spec/examples/2_with_customer/uet_tags_spec.rb +42 -0
- data/spec/examples/3_with_uet_tag/conversion_goal_spec.rb +40 -0
- data/spec/examples/3_with_uet_tag/uet_tags_spec.rb +56 -0
- data/spec/examples/4_with_conversion_goal/conversion_goals_spec.rb +75 -0
- data/spec/examples/5_with_campaign/ad_extension_spec.rb +238 -0
- data/spec/examples/5_with_campaign/ad_group_spec.rb +35 -0
- data/spec/examples/5_with_campaign/campaign_criterions_spec.rb +74 -0
- data/spec/examples/5_with_campaign/campaign_spec.rb +71 -0
- data/spec/examples/6_with_ad_group/ad_group_spec.rb +71 -0
- data/spec/examples/6_with_ad_group/ads_spec.rb +113 -0
- data/spec/examples/6_with_ad_group/keywords_spec.rb +108 -0
- data/spec/examples/examples.rb +76 -0
- data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard.xml +23 -0
- data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard_response.xml +11 -0
- data/spec/fixtures/bulk/get_bulk_download_status/standard.xml +14 -0
- data/spec/fixtures/bulk/get_bulk_download_status/standard_response.xml +15 -0
- data/spec/fixtures/campaign_management/add_ad_extensions/standard.xml +21 -0
- data/spec/fixtures/campaign_management/add_ad_extensions/standard_response.xml +17 -0
- data/spec/fixtures/campaign_management/add_conversion_goals/standard.xml +27 -0
- data/spec/fixtures/campaign_management/add_conversion_goals/standard_response.xml +14 -0
- data/spec/fixtures/campaign_management/add_shared_entity/standard.xml +16 -0
- data/spec/fixtures/campaign_management/add_shared_entity/standard_response.xml +13 -0
- data/spec/fixtures/campaign_management/add_uet_tags/standard.xml +19 -0
- data/spec/fixtures/campaign_management/add_uet_tags/standard_response.xml +21 -0
- data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard.xml +15 -0
- data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard_response.xml +13 -0
- data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard.xml +19 -0
- data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard_response.xml +47 -0
- data/spec/fixtures/campaign_management/get_budgets_by_ids/standard.xml +12 -0
- data/spec/fixtures/campaign_management/get_budgets_by_ids/standard_response.xml +20 -0
- data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard.xml +14 -0
- data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard_response.xml +84 -0
- data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard.xml +18 -0
- data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard_response.xml +61 -0
- data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard.xml +14 -0
- data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard_response.xml +20 -0
- data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard.xml +18 -0
- data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard_response.xml +19 -0
- data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard.xml +16 -0
- data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard_response.xml +21 -0
- data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard.xml +21 -0
- data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard_response.xml +11 -0
- data/spec/fixtures/campaign_management/set_shared_entity_associations/standard.xml +21 -0
- data/spec/fixtures/campaign_management/set_shared_entity_associations/standard_response.xml +11 -0
- data/spec/fixtures/campaign_management/update_conversion_goals/standard.xml +27 -0
- data/spec/fixtures/campaign_management/update_conversion_goals/standard_response.xml +11 -0
- data/spec/fixtures/campaign_management/update_uet_tags/standard.xml +20 -0
- data/spec/fixtures/campaign_management/update_uet_tags/standard_response.xml +11 -0
- data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard.xml +15 -0
- data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard_response.xml +21 -0
- data/spec/fixtures/customer_management/get_account/standard.xml +14 -0
- data/spec/fixtures/customer_management/get_account/standard_response.xml +43 -0
- data/spec/fixtures/customer_management/signup_customer/standard.xml +30 -0
- data/spec/fixtures/customer_management/signup_customer/standard_response.xml +15 -0
- data/spec/fixtures/customer_management/update_account/standard.xml +19 -0
- data/spec/fixtures/customer_management/update_account/standard_response.xml +11 -0
- data/spec/spec_helper.rb +33 -0
- data/spec/support/spec_helpers.rb +45 -0
- data/tasks/bing_ads_ruby_sdk.rake +5 -6
- metadata +202 -27
- data/.travis.yml +0 -5
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/ad_insight.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/bulk.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/campaign_management.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/customer_billing.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/customer_management.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/production/reporting.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/ad_insight.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/bulk.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/campaign_management.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/customer_billing.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/customer_management.xml +0 -1
- data/lib/bing_ads_ruby_sdk/wsdl/v12/sandbox/reporting.xml +0 -1
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
RSpec.describe BingAdsRubySdk::Services::CustomerManagement do
|
|
2
|
+
|
|
3
|
+
let(:service_name) { described_class.service }
|
|
4
|
+
let(:soap_client) { SpecHelpers.soap_client(service_name) }
|
|
5
|
+
let(:expected_xml) { SpecHelpers.request_xml_for(service_name, action, filename) }
|
|
6
|
+
let(:mocked_response) { SpecHelpers.response_xml_for(service_name, action, filename) }
|
|
7
|
+
|
|
8
|
+
let(:service) { described_class.new(soap_client) }
|
|
9
|
+
|
|
10
|
+
before do
|
|
11
|
+
expect(BingAdsRubySdk::HttpClient).to receive(:post) do |req|
|
|
12
|
+
expect(Nokogiri::XML(req.content).to_xml).to eq expected_xml.to_xml
|
|
13
|
+
mocked_response
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe "signup_customer" do
|
|
18
|
+
let(:action) { 'signup_customer' }
|
|
19
|
+
let(:filename) { 'standard' }
|
|
20
|
+
|
|
21
|
+
it "returns expected result" do
|
|
22
|
+
expect(
|
|
23
|
+
service.signup_customer(
|
|
24
|
+
parent_customer_id: 9876,
|
|
25
|
+
customer: {
|
|
26
|
+
industry: "NA",
|
|
27
|
+
market_country: 'FR',
|
|
28
|
+
market_language: 'French',
|
|
29
|
+
name: 'sdk customer',
|
|
30
|
+
customer_address: {
|
|
31
|
+
city: "Nice",
|
|
32
|
+
country_code: "FR",
|
|
33
|
+
line1: "127 bd risso",
|
|
34
|
+
postal_code: "06000"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
# Note that the structure of this type is slightly different to other types, in accord with the Bing WSDL
|
|
38
|
+
account: {
|
|
39
|
+
'@type' => 'AdvertiserAccount',
|
|
40
|
+
currency_code: "EUR",
|
|
41
|
+
name: 'SDK account'
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
).to include(
|
|
45
|
+
customer_id: "1234",
|
|
46
|
+
account_id: "5678"
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe "get_account" do
|
|
52
|
+
let(:action) { 'get_account' }
|
|
53
|
+
let(:filename) { 'standard' }
|
|
54
|
+
|
|
55
|
+
it "returns expected result" do
|
|
56
|
+
expect(
|
|
57
|
+
service.get_account(account_id: 5678)
|
|
58
|
+
).to include(
|
|
59
|
+
account: a_hash_including( id: "5678", name: "SDKTEST")
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe "update_account" do
|
|
65
|
+
let(:action) { 'update_account' }
|
|
66
|
+
let(:filename) { 'standard' }
|
|
67
|
+
|
|
68
|
+
it "returns expected result" do
|
|
69
|
+
expect(
|
|
70
|
+
service.update_account(
|
|
71
|
+
account: {
|
|
72
|
+
'@type' => 'AdvertiserAccount',
|
|
73
|
+
id: 5678,
|
|
74
|
+
time_stamp: "AAAAAE496a4=",
|
|
75
|
+
currency_code: "EUR",
|
|
76
|
+
name: "SDKTEST updated"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
).to eq(
|
|
80
|
+
last_modified_time: "2019-01-18T13:16:38.827"
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "find_accounts_or_customers_info" do
|
|
86
|
+
let(:action) { 'find_accounts_or_customers_info' }
|
|
87
|
+
let(:filename) { 'standard' }
|
|
88
|
+
|
|
89
|
+
it "returns expected result" do
|
|
90
|
+
expect(
|
|
91
|
+
service.find_accounts_or_customers_info(filter: 'SDKTEST', top_n: 1)
|
|
92
|
+
).to contain_exactly(
|
|
93
|
+
a_hash_including(customer_name: "SDKTEST updated", account_id: "5678")
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require_relative '../examples'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'CustomerManagement service' do
|
|
4
|
+
include_context 'use api'
|
|
5
|
+
|
|
6
|
+
it "creates customer" do
|
|
7
|
+
created_customer = api.customer_management.signup_customer(
|
|
8
|
+
customer: {
|
|
9
|
+
customer_address: {
|
|
10
|
+
city: 'Paris',
|
|
11
|
+
postal_code: 75_001,
|
|
12
|
+
line1: '1 rue de Rivoli',
|
|
13
|
+
country_code: 'FR',
|
|
14
|
+
},
|
|
15
|
+
industry: 'Entertainment',
|
|
16
|
+
name: "Test Customer #{random}",
|
|
17
|
+
},
|
|
18
|
+
account: {
|
|
19
|
+
'@type' => 'AdvertiserAccount',
|
|
20
|
+
name: "Test Account #{random}",
|
|
21
|
+
currency_code: 'USD',
|
|
22
|
+
},
|
|
23
|
+
parent_customer_id: Examples.parent_customer_id
|
|
24
|
+
)
|
|
25
|
+
expect(created_customer).to include(
|
|
26
|
+
customer_id: a_kind_of(String),
|
|
27
|
+
customer_number: a_kind_of(String),
|
|
28
|
+
account_id: a_kind_of(String),
|
|
29
|
+
account_number: a_kind_of(String),
|
|
30
|
+
create_time: a_kind_of(String)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
puts "You can now fill in examples.rb with customer_id: #{created_customer[:customer_id]} and account_id: #{created_customer[:account_id]}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require_relative '../examples'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'Budget methods' do
|
|
4
|
+
include_context 'use api'
|
|
5
|
+
|
|
6
|
+
let(:budget_id) { add_budget[:budget_ids].first }
|
|
7
|
+
|
|
8
|
+
let(:add_budget) do
|
|
9
|
+
api.campaign_management.call(:add_budgets,
|
|
10
|
+
budgets: [
|
|
11
|
+
budget: {
|
|
12
|
+
amount: '10',
|
|
13
|
+
budget_type: 'DailyBudgetStandard',
|
|
14
|
+
name: "test_budget #{random}",
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#add_budget' do
|
|
21
|
+
it 'returns budget ids for created Budgets' do
|
|
22
|
+
expect(add_budget).to include(
|
|
23
|
+
budget_ids: [a_kind_of(Integer)],
|
|
24
|
+
partial_errors: ''
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#get_budgets_by_ids' do
|
|
30
|
+
before { add_budget }
|
|
31
|
+
|
|
32
|
+
it 'returns a list of budgets' do
|
|
33
|
+
expect(api.campaign_management.get_budgets_by_ids(
|
|
34
|
+
budget_ids: [long: budget_id]
|
|
35
|
+
)).to include({
|
|
36
|
+
amount: '10.00',
|
|
37
|
+
association_count: '0',
|
|
38
|
+
budget_type: 'DailyBudgetStandard',
|
|
39
|
+
id: a_kind_of(String),
|
|
40
|
+
name: a_string_starting_with('test_budget'),
|
|
41
|
+
})
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe '#delete_budgets' do
|
|
46
|
+
before { add_budget }
|
|
47
|
+
|
|
48
|
+
it 'returns no errors' do
|
|
49
|
+
expect(api.campaign_management.call(:delete_budgets,
|
|
50
|
+
budget_ids: [ { long: budget_id } ]
|
|
51
|
+
)).to eq(partial_errors: '')
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require_relative '../examples'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'CampaignManagement service' do
|
|
4
|
+
include_context 'use api'
|
|
5
|
+
|
|
6
|
+
describe 'Campaign methods' do
|
|
7
|
+
it 'returns campaign ids' do
|
|
8
|
+
campaigns = api.campaign_management.call(:add_campaigns,
|
|
9
|
+
account_id: Examples.account_id,
|
|
10
|
+
campaigns: {
|
|
11
|
+
campaign:
|
|
12
|
+
{
|
|
13
|
+
name: "Acceptance Test Campaign #{random}",
|
|
14
|
+
daily_budget: 10,
|
|
15
|
+
budget_type: 'DailyBudgetStandard',
|
|
16
|
+
time_zone: 'BrusselsCopenhagenMadridParis'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
expect(campaigns).to include(
|
|
21
|
+
partial_errors: '',
|
|
22
|
+
campaign_ids: [a_kind_of(Integer)]
|
|
23
|
+
)
|
|
24
|
+
puts "You can now fill in examples.rb with campaign_id: #{campaigns[:campaign_ids].first}"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
require_relative '../examples'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'CustomerManagement service' do
|
|
4
|
+
include_context 'use api'
|
|
5
|
+
|
|
6
|
+
let(:get_customer) do
|
|
7
|
+
api.customer_management.call(:get_customer, customer_id: Examples.customer_id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
let(:get_account) do
|
|
11
|
+
api.customer_management.get_account(account_id: Examples.account_id)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe 'Account methods' do
|
|
15
|
+
describe '#find_accounts' do
|
|
16
|
+
subject do
|
|
17
|
+
api.customer_management.call(:find_accounts,
|
|
18
|
+
account_filter: '',
|
|
19
|
+
customer_id: Examples.customer_id,
|
|
20
|
+
top_n: 1
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'returns a list of basic account information' do
|
|
25
|
+
is_expected.to include(
|
|
26
|
+
accounts_info: {
|
|
27
|
+
account_info: [
|
|
28
|
+
{
|
|
29
|
+
id: a_kind_of(String),
|
|
30
|
+
name: a_kind_of(String),
|
|
31
|
+
number: a_kind_of(String),
|
|
32
|
+
account_life_cycle_status: a_kind_of(String),
|
|
33
|
+
pause_reason: nil,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe '#find_accounts_or_customers_info' do
|
|
42
|
+
subject do
|
|
43
|
+
api.customer_management.find_accounts_or_customers_info(
|
|
44
|
+
filter: '',
|
|
45
|
+
top_n: 1
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'returns a list of records containing account / customer pairs' do
|
|
50
|
+
is_expected.to contain_exactly(
|
|
51
|
+
{
|
|
52
|
+
customer_id: a_kind_of(String),
|
|
53
|
+
customer_name: a_kind_of(String),
|
|
54
|
+
account_id: a_kind_of(String),
|
|
55
|
+
account_name: a_kind_of(String),
|
|
56
|
+
account_number: a_kind_of(String),
|
|
57
|
+
account_life_cycle_status: a_kind_of(String), # e.g. 'Active'
|
|
58
|
+
pause_reason: nil,
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
describe '#get_account' do
|
|
65
|
+
it 'returns information about the current account' do
|
|
66
|
+
expect(get_account).to include(
|
|
67
|
+
account: {
|
|
68
|
+
bill_to_customer_id: a_kind_of(String),
|
|
69
|
+
currency_code: "USD",
|
|
70
|
+
account_financial_status: "ClearFinancialStatus",
|
|
71
|
+
id: a_kind_of(String),
|
|
72
|
+
language: "English",
|
|
73
|
+
last_modified_by_user_id: a_kind_of(String),
|
|
74
|
+
last_modified_time: a_kind_of(String),
|
|
75
|
+
name: a_string_starting_with("Test Account"),
|
|
76
|
+
number: a_kind_of(String),
|
|
77
|
+
parent_customer_id: a_kind_of(String),
|
|
78
|
+
payment_method_id: a_kind_of(String),
|
|
79
|
+
payment_method_type: nil,
|
|
80
|
+
primary_user_id: a_kind_of(String),
|
|
81
|
+
account_life_cycle_status: "Active",
|
|
82
|
+
time_stamp: a_kind_of(String),
|
|
83
|
+
time_zone: a_kind_of(String),
|
|
84
|
+
pause_reason: nil,
|
|
85
|
+
forward_compatibility_map: nil,
|
|
86
|
+
linked_agencies: {
|
|
87
|
+
customer_info: [
|
|
88
|
+
{
|
|
89
|
+
id: a_kind_of(String),
|
|
90
|
+
name: a_kind_of(String),
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
sales_house_customer_id: nil,
|
|
95
|
+
tax_information: "",
|
|
96
|
+
back_up_payment_instrument_id: nil,
|
|
97
|
+
billing_threshold_amount: nil,
|
|
98
|
+
business_address: nil,
|
|
99
|
+
auto_tag_type: "Inactive",
|
|
100
|
+
sold_to_payment_instrument_id: nil
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
describe '#update_account' do
|
|
107
|
+
let(:account) { get_account[:account] }
|
|
108
|
+
subject do
|
|
109
|
+
api.customer_management.update_account(
|
|
110
|
+
account: {
|
|
111
|
+
'@type' => 'AdvertiserAccount',
|
|
112
|
+
id: account[:id],
|
|
113
|
+
time_stamp: account[:time_stamp],
|
|
114
|
+
name: "Test Account #{Time.now} - updated",
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it 'returns the last modified time' do
|
|
120
|
+
is_expected.to include(last_modified_time: a_kind_of(String))
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
describe 'Customer methods' do
|
|
126
|
+
describe 'get_customer' do
|
|
127
|
+
it 'returns customer data' do
|
|
128
|
+
expect(get_customer).to include(
|
|
129
|
+
customer: {
|
|
130
|
+
customer_financial_status: "ClearFinancialStatus",
|
|
131
|
+
id: a_kind_of(String),
|
|
132
|
+
industry: "Entertainment",
|
|
133
|
+
last_modified_by_user_id: a_kind_of(String),
|
|
134
|
+
last_modified_time: a_kind_of(String),
|
|
135
|
+
market_country: "US",
|
|
136
|
+
forward_compatibility_map: a_kind_of(Hash),
|
|
137
|
+
market_language: "English",
|
|
138
|
+
name: a_string_starting_with("Test Customer"),
|
|
139
|
+
service_level: "SelfServe",
|
|
140
|
+
customer_life_cycle_status: "Active",
|
|
141
|
+
time_stamp: a_kind_of(String),
|
|
142
|
+
number: a_kind_of(String),
|
|
143
|
+
customer_address: a_kind_of(Hash),
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
describe '#get_customers_info' do
|
|
150
|
+
subject do
|
|
151
|
+
api.customer_management.call(:get_customers_info,
|
|
152
|
+
customer_name_filter: '',
|
|
153
|
+
top_n: 1
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
it 'returns a list of simple customer information' do
|
|
158
|
+
is_expected.to include(
|
|
159
|
+
customers_info: {
|
|
160
|
+
customer_info: a_collection_including(
|
|
161
|
+
{
|
|
162
|
+
id: a_kind_of(String),
|
|
163
|
+
name: a_kind_of(String),
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
describe '#update_customer' do
|
|
172
|
+
let(:original_customer) { get_customer }
|
|
173
|
+
|
|
174
|
+
subject do
|
|
175
|
+
api.customer_management.call(:update_customer, {
|
|
176
|
+
customer: {
|
|
177
|
+
name: "Test Customer - #{Time.now}",
|
|
178
|
+
id: Examples.customer_id,
|
|
179
|
+
time_stamp: original_customer[:customer][:time_stamp],
|
|
180
|
+
industry: original_customer[:customer][:industry]
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it 'returns the update timestamp' do
|
|
186
|
+
is_expected.to include(last_modified_time: a_kind_of(String))
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require_relative '../examples'
|
|
2
|
+
|
|
3
|
+
RSpec.describe 'CampaignManagement service' do
|
|
4
|
+
include_context 'use api'
|
|
5
|
+
|
|
6
|
+
describe 'UET methods' do
|
|
7
|
+
subject(:add_uet_tags) do
|
|
8
|
+
api.campaign_management.add_uet_tags(
|
|
9
|
+
uet_tags: [
|
|
10
|
+
uet_tag: {
|
|
11
|
+
description: 'UET Tag Description',
|
|
12
|
+
name: "Acceptance Test UET Tag #{random}",
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe '#add_uet_tags' do
|
|
19
|
+
it 'returns a list of newly created UET tags' do
|
|
20
|
+
uet_tags = add_uet_tags
|
|
21
|
+
expect(uet_tags).to include(
|
|
22
|
+
uet_tags: {
|
|
23
|
+
uet_tag: [
|
|
24
|
+
{
|
|
25
|
+
description: 'UET Tag Description',
|
|
26
|
+
id: a_kind_of(String),
|
|
27
|
+
name: a_string_starting_with('Acceptance Test UET Tag'),
|
|
28
|
+
tracking_no_script: a_string_starting_with("<img src=\"//bat.bing.com/action/"),
|
|
29
|
+
tracking_script: a_string_starting_with('<script>(function(w,d,t,r,u)'),
|
|
30
|
+
tracking_status: 'Unverified',
|
|
31
|
+
customer_share: nil
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
partial_errors: ''
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
puts "Please fill in examples.rb with uet_tag_id: #{uet_tags[:uet_tags][:uet_tag].first[:id]}"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|