bing_ads_ruby_sdk 1.0.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,71 @@
|
|
1
|
+
require_relative '../examples'
|
2
|
+
|
3
|
+
RSpec.describe 'CampaignManagement service' do
|
4
|
+
include_context 'use api'
|
5
|
+
|
6
|
+
describe 'Campaign methods' do
|
7
|
+
let(:a_campaign_hash) do
|
8
|
+
a_hash_including(
|
9
|
+
audience_ads_bid_adjustment: a_kind_of(String),
|
10
|
+
bidding_scheme: a_kind_of(Hash),
|
11
|
+
budget_type: a_kind_of(String),
|
12
|
+
daily_budget: a_kind_of(String),
|
13
|
+
forward_compatibility_map: '',
|
14
|
+
id: Examples.campaign_id.to_s,
|
15
|
+
name: a_string_starting_with('Acceptance Test Campaign'),
|
16
|
+
status: a_kind_of(String),
|
17
|
+
time_zone: a_kind_of(String),
|
18
|
+
tracking_url_template: nil,
|
19
|
+
url_custom_parameters: nil,
|
20
|
+
campaign_type: a_kind_of(String),
|
21
|
+
settings: nil,
|
22
|
+
budget_id: nil,
|
23
|
+
languages: nil,
|
24
|
+
experiment_id: nil,
|
25
|
+
final_url_suffix: nil,
|
26
|
+
sub_type: nil,
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#get_campaigns_by_account_id' do
|
31
|
+
it 'returns a list of campaigns' do
|
32
|
+
expect(api.campaign_management.get_campaigns_by_account_id(
|
33
|
+
account_id: Examples.account_id
|
34
|
+
)).to include(a_campaign_hash)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#get_campaigns_by_ids' do
|
39
|
+
it 'returns a list of campaigns' do
|
40
|
+
expect(api.campaign_management.get_campaigns_by_ids(
|
41
|
+
account_id: Examples.account_id,
|
42
|
+
campaign_ids: [{ long: Examples.campaign_id }]
|
43
|
+
)).to include(a_campaign_hash)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#update_campaigns' do
|
48
|
+
subject do
|
49
|
+
api.campaign_management.call(:update_campaigns,
|
50
|
+
account_id: Examples.account_id,
|
51
|
+
campaigns: {
|
52
|
+
campaign: [
|
53
|
+
id: Examples.campaign_id,
|
54
|
+
name: "Acceptance Test Campaign - #{random}"
|
55
|
+
]
|
56
|
+
}
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns no errors' do
|
61
|
+
is_expected.to eq(partial_errors: '')
|
62
|
+
updated_campaign = api.campaign_management.get_campaigns_by_ids(
|
63
|
+
account_id: Examples.account_id,
|
64
|
+
campaign_ids: [{ long: Examples.campaign_id }]
|
65
|
+
).first
|
66
|
+
|
67
|
+
expect(updated_campaign).to include(name: "Acceptance Test Campaign - #{random}")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../examples'
|
2
|
+
|
3
|
+
RSpec.describe 'AdGroup methods' do
|
4
|
+
include_context 'use api'
|
5
|
+
|
6
|
+
let(:ad_group_record) do
|
7
|
+
a_hash_including(
|
8
|
+
ad_rotation: nil,
|
9
|
+
bidding_scheme: a_kind_of(Hash),
|
10
|
+
cpc_bid: a_kind_of(Hash),
|
11
|
+
id: a_kind_of(String),
|
12
|
+
language: a_kind_of(String),
|
13
|
+
name: a_kind_of(String),
|
14
|
+
network: a_kind_of(String),
|
15
|
+
settings: nil,
|
16
|
+
start_date: {
|
17
|
+
day: '1',
|
18
|
+
month: '1',
|
19
|
+
year: '2049',
|
20
|
+
},
|
21
|
+
end_date: {
|
22
|
+
day: '1',
|
23
|
+
month: '2',
|
24
|
+
year: '2049',
|
25
|
+
},
|
26
|
+
status: a_kind_of(String),
|
27
|
+
tracking_url_template: nil,
|
28
|
+
url_custom_parameters: nil,
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#get_ad_groups_by_ids' do
|
33
|
+
it 'returns AdGroups' do
|
34
|
+
expect(api.campaign_management.get_ad_groups_by_ids(
|
35
|
+
campaign_id: Examples.campaign_id,
|
36
|
+
ad_group_ids: [ { long: Examples.ad_group_id } ]
|
37
|
+
)).to include(ad_group_record)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#get_ad_groups_by_campaign_id' do
|
42
|
+
it 'returns AdGroups' do
|
43
|
+
expect(api.campaign_management.get_ad_groups_by_campaign_id(
|
44
|
+
campaign_id: Examples.campaign_id
|
45
|
+
)).to include(ad_group_record)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#update_ad_groups' do
|
50
|
+
it 'updates the ad' do
|
51
|
+
expect(api.campaign_management.call(:update_ad_groups,
|
52
|
+
campaign_id: Examples.campaign_id,
|
53
|
+
ad_groups: {
|
54
|
+
ad_group: [{
|
55
|
+
id: Examples.ad_group_id,
|
56
|
+
name: "AcceptanceTestAdGroup - #{random}"
|
57
|
+
}]
|
58
|
+
}
|
59
|
+
)).to eq(partial_errors: '', inherited_bid_strategy_types: nil)
|
60
|
+
|
61
|
+
ad_group = api.campaign_management.get_ad_groups_by_ids(
|
62
|
+
campaign_id: Examples.campaign_id,
|
63
|
+
ad_group_ids: [ { long: Examples.ad_group_id } ]
|
64
|
+
).first
|
65
|
+
|
66
|
+
expect(ad_group).to include(
|
67
|
+
name: "AcceptanceTestAdGroup - #{random}"
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require_relative '../examples'
|
2
|
+
|
3
|
+
RSpec.describe 'Ad methods' do
|
4
|
+
include_context 'use api'
|
5
|
+
|
6
|
+
def add_ads
|
7
|
+
api.campaign_management.call(:add_ads,
|
8
|
+
ad_group_id: Examples.ad_group_id,
|
9
|
+
ads: [
|
10
|
+
{
|
11
|
+
expanded_text_ad: {
|
12
|
+
ad_format_preference: 'All',
|
13
|
+
domain: 'https://www.example.com/',
|
14
|
+
final_urls: [string: 'http://www.contoso.com/'],
|
15
|
+
path_1: 'subdirectory1',
|
16
|
+
path_2: 'su§bdirectory2',
|
17
|
+
text: 'Ad text goes here',
|
18
|
+
title_part_1: 'Title goes here',
|
19
|
+
title_part_2: 'Title 2 goes here',
|
20
|
+
status: 'Paused',
|
21
|
+
tracking_url_template: '{lpurl}',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
]
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_ads
|
29
|
+
api.campaign_management.get_ads_by_ad_group_id(
|
30
|
+
ad_group_id: Examples.ad_group_id,
|
31
|
+
ad_types: [
|
32
|
+
{ ad_type: 'Text' },
|
33
|
+
{ ad_type: 'Image' },
|
34
|
+
{ ad_type: 'Product' },
|
35
|
+
{ ad_type: 'AppInstall' },
|
36
|
+
{ ad_type: 'ExpandedText' },
|
37
|
+
{ ad_type: 'DynamicSearch' },
|
38
|
+
]
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#add_ads' do
|
43
|
+
it 'returns created Ad ids' do
|
44
|
+
expect(add_ads).to include(
|
45
|
+
ad_ids: [a_kind_of(Integer)],
|
46
|
+
partial_errors: ''
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#get_ads_by_ad_group_id' do
|
52
|
+
before { add_ads }
|
53
|
+
|
54
|
+
it 'returns a list of ads' do
|
55
|
+
expect(get_ads).to include(
|
56
|
+
{
|
57
|
+
ad_format_preference: a_kind_of(String),
|
58
|
+
device_preference: a_kind_of(String),
|
59
|
+
editorial_status: a_kind_of(String),
|
60
|
+
final_app_urls: nil,
|
61
|
+
final_mobile_urls: nil,
|
62
|
+
final_urls: a_kind_of(Hash),
|
63
|
+
final_url_suffix: nil,
|
64
|
+
forward_compatibility_map: "",
|
65
|
+
id: a_kind_of(String),
|
66
|
+
status: a_kind_of(String),
|
67
|
+
tracking_url_template: a_kind_of(String),
|
68
|
+
type: "ExpandedText",
|
69
|
+
url_custom_parameters: nil,
|
70
|
+
domain: a_kind_of(String),
|
71
|
+
path1: a_kind_of(String),
|
72
|
+
path2: a_kind_of(String),
|
73
|
+
text: a_kind_of(String),
|
74
|
+
text_part2: '',
|
75
|
+
title_part1: a_kind_of(String),
|
76
|
+
title_part2: a_kind_of(String),
|
77
|
+
title_part3: ''
|
78
|
+
}
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#update_ads' do
|
84
|
+
before { add_ads }
|
85
|
+
|
86
|
+
it 'updates the Ad' do
|
87
|
+
expect(api.campaign_management.call(:update_ads,
|
88
|
+
ad_group_id: Examples.ad_group_id,
|
89
|
+
ads: {
|
90
|
+
expanded_text_ad: [{
|
91
|
+
id: get_ads.first[:id],
|
92
|
+
text: "Ad text goes here - #{random}"
|
93
|
+
}],
|
94
|
+
}
|
95
|
+
)).to eq(partial_errors: '')
|
96
|
+
|
97
|
+
expect(get_ads.first).to include( text: "Ad text goes here - #{random}")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe 'test_delete_ads' do
|
102
|
+
let(:ad_id) { add_ads[:ad_ids].first }
|
103
|
+
|
104
|
+
it 'returns no errors' do
|
105
|
+
expect(api.campaign_management.call(:delete_ads,
|
106
|
+
ad_group_id: Examples.ad_group_id,
|
107
|
+
ad_ids: [long: ad_id]
|
108
|
+
)).to eq(partial_errors: '')
|
109
|
+
|
110
|
+
expect(get_ads.map{|h| h[:id]}).not_to include ad_id.to_s
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require_relative '../examples'
|
2
|
+
|
3
|
+
RSpec.describe 'Keyword methods' do
|
4
|
+
include_context 'use api'
|
5
|
+
|
6
|
+
describe 'Keyword methods' do
|
7
|
+
let(:a_keyword) do
|
8
|
+
{
|
9
|
+
bid: a_kind_of(Hash),
|
10
|
+
bidding_scheme: a_kind_of(Hash),
|
11
|
+
destination_url: a_kind_of(String),
|
12
|
+
editorial_status: a_kind_of(String),
|
13
|
+
final_app_urls: nil,
|
14
|
+
final_mobile_urls: nil,
|
15
|
+
final_url_suffix: nil,
|
16
|
+
final_urls: nil,
|
17
|
+
forward_compatibility_map: a_kind_of(String),
|
18
|
+
id: a_kind_of(String),
|
19
|
+
match_type: a_kind_of(String),
|
20
|
+
param1: a_kind_of(String),
|
21
|
+
param2: a_kind_of(String),
|
22
|
+
param3: a_kind_of(String),
|
23
|
+
status: a_kind_of(String),
|
24
|
+
text: a_kind_of(String),
|
25
|
+
tracking_url_template: nil,
|
26
|
+
url_custom_parameters: nil,
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:keyword_id) { add_keywords[:keyword_ids].first }
|
31
|
+
let(:add_keywords) do
|
32
|
+
api.campaign_management.call(:add_keywords,
|
33
|
+
ad_group_id: Examples.ad_group_id,
|
34
|
+
keywords: { keyword: {
|
35
|
+
bid: { amount: 0.05 },
|
36
|
+
match_type: 'Exact',
|
37
|
+
text: "AcceptanceTestKeyword - #{random}",
|
38
|
+
} }
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#add_keywords' do
|
43
|
+
it 'returns created Keyword ids' do
|
44
|
+
expect(add_keywords).to include(
|
45
|
+
keyword_ids: [a_kind_of(Integer)],
|
46
|
+
partial_errors: ''
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#get_keywords_by_ad_group_id' do
|
52
|
+
before { add_keywords }
|
53
|
+
|
54
|
+
it 'returns a list of keywords' do
|
55
|
+
expect(api.campaign_management.get_keywords_by_ad_group_id(
|
56
|
+
ad_group_id: Examples.ad_group_id
|
57
|
+
)).to include(a_keyword)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#get_keywords_by_editorial_status' do
|
62
|
+
before { add_keywords }
|
63
|
+
|
64
|
+
it 'returns a list of Keywords' do
|
65
|
+
expect(api.campaign_management.get_keywords_by_editorial_status(
|
66
|
+
ad_group_id: Examples.ad_group_id,
|
67
|
+
editorial_status: 'Active'
|
68
|
+
)).to include(a_keyword)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#get_keywords_by_ids' do
|
73
|
+
before { add_keywords }
|
74
|
+
|
75
|
+
it 'returns a list of Keywords' do
|
76
|
+
expect(api.campaign_management.get_keywords_by_ids(
|
77
|
+
ad_group_id: Examples.ad_group_id,
|
78
|
+
keyword_ids: [{ long: keyword_id }]
|
79
|
+
)).to include(a_keyword)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#update_keywords' do
|
84
|
+
before { add_keywords }
|
85
|
+
|
86
|
+
it 'updates the keyword' do
|
87
|
+
expect(api.campaign_management.call(:update_keywords,
|
88
|
+
ad_group_id: Examples.ad_group_id,
|
89
|
+
keywords: { keyword: [
|
90
|
+
id: keyword_id,
|
91
|
+
bid: { amount: 0.50 },
|
92
|
+
] }
|
93
|
+
)).to include(partial_errors: '')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#delete_keywords' do
|
98
|
+
before { add_keywords }
|
99
|
+
|
100
|
+
it 'returns no errors' do
|
101
|
+
expect(api.campaign_management.call(:delete_keywords,
|
102
|
+
ad_group_id: Examples.ad_group_id,
|
103
|
+
keyword_ids: [{ long: keyword_id }]
|
104
|
+
)).to eq(partial_errors: '')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'securerandom'
|
4
|
+
|
5
|
+
module Examples
|
6
|
+
class << self
|
7
|
+
|
8
|
+
def random
|
9
|
+
SecureRandom.hex
|
10
|
+
end
|
11
|
+
|
12
|
+
def build_api
|
13
|
+
BingAdsRubySdk::Api.new(
|
14
|
+
developer_token: developer_token,
|
15
|
+
client_id: client_id,
|
16
|
+
oauth_store: store
|
17
|
+
).tap do |api|
|
18
|
+
if account_id && customer_id
|
19
|
+
api.set_customer(
|
20
|
+
customer_id: customer_id,
|
21
|
+
account_id: account_id
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def client_id
|
28
|
+
# you have to fill this in with data from bing
|
29
|
+
end
|
30
|
+
|
31
|
+
def developer_token
|
32
|
+
# you have to fill this in with data from bing
|
33
|
+
end
|
34
|
+
|
35
|
+
def parent_customer_id
|
36
|
+
# you have to fill this in with data from bing
|
37
|
+
end
|
38
|
+
|
39
|
+
def customer_id
|
40
|
+
# you have to fill this in with data you get after running 1_customer folder
|
41
|
+
end
|
42
|
+
|
43
|
+
def account_id
|
44
|
+
# you have to fill this in with data you get after running 1_customer folder
|
45
|
+
end
|
46
|
+
|
47
|
+
def uet_tag_id
|
48
|
+
# you have to fill this in with data you get after running 2_with_customer folder
|
49
|
+
end
|
50
|
+
|
51
|
+
def campaign_id
|
52
|
+
# you have to fill this in with data you get after running 2_with_customer folder
|
53
|
+
end
|
54
|
+
|
55
|
+
def conversion_goal_id
|
56
|
+
# you have to fill this in with data you get after running 3_with_uet_tag folder
|
57
|
+
end
|
58
|
+
|
59
|
+
def ad_group_id
|
60
|
+
# you have to fill this in with data you get after running 5_with_campaign folder
|
61
|
+
end
|
62
|
+
|
63
|
+
def store
|
64
|
+
::BingAdsRubySdk::OAuth2::FsStore.new(store_filename)
|
65
|
+
end
|
66
|
+
|
67
|
+
def store_filename
|
68
|
+
ENV.fetch('BING_STORE_FILENAME')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
RSpec.shared_context 'use api' do
|
74
|
+
let(:random) { Examples.random }
|
75
|
+
let(:api) { Examples.build_api }
|
76
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<soap:Envelope xmlns:ns0="https://bingads.microsoft.com/CampaignManagement/v13" xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns2="https://adapi.microsoft.com" xmlns:ns3="http://schemas.datacontract.org/2004/07/System.Collections.Generic" xmlns:ns4="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
3
|
+
<soap:Header>
|
4
|
+
<ns0:AuthenticationToken>***FILTERED***</ns0:AuthenticationToken>
|
5
|
+
<ns0:DeveloperToken>***FILTERED***</ns0:DeveloperToken>
|
6
|
+
<ns0:CustomerId>***FILTERED***</ns0:CustomerId>
|
7
|
+
<ns0:CustomerAccountId>***FILTERED***</ns0:CustomerAccountId>
|
8
|
+
</soap:Header>
|
9
|
+
<soap:Body>
|
10
|
+
<ns0:DownloadCampaignsByAccountIdsRequest>
|
11
|
+
<ns0:AccountIds>
|
12
|
+
<ns1:long>150168726</ns1:long>
|
13
|
+
</ns0:AccountIds>
|
14
|
+
<ns0:CompressionType>Zip</ns0:CompressionType>
|
15
|
+
<ns0:DataScope>EntityData</ns0:DataScope>
|
16
|
+
<ns0:DownloadEntities>
|
17
|
+
<ns0:DownloadEntity>Campaigns</ns0:DownloadEntity>
|
18
|
+
</ns0:DownloadEntities>
|
19
|
+
<ns0:DownloadFileType>Csv</ns0:DownloadFileType>
|
20
|
+
<ns0:FormatVersion>6.0</ns0:FormatVersion>
|
21
|
+
</ns0:DownloadCampaignsByAccountIdsRequest>
|
22
|
+
</soap:Body>
|
23
|
+
</soap:Envelope>
|