bing_ads_ruby_sdk 1.3.4 → 1.5.0
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 +4 -4
- data/.circleci/config.yml +21 -19
- data/.github/.keep +0 -0
- data/.github/renovate.json +225 -0
- data/Gemfile +2 -0
- data/Rakefile +4 -4
- data/bing_ads_ruby_sdk.gemspec +25 -27
- data/changelog.md +10 -0
- data/lib/bing_ads_ruby_sdk/api.rb +3 -6
- data/lib/bing_ads_ruby_sdk/augmented_parser.rb +0 -1
- data/lib/bing_ads_ruby_sdk/configuration.rb +1 -1
- data/lib/bing_ads_ruby_sdk/errors/error_handler.rb +1 -1
- data/lib/bing_ads_ruby_sdk/errors/errors.rb +9 -10
- data/lib/bing_ads_ruby_sdk/header.rb +3 -3
- data/lib/bing_ads_ruby_sdk/http_client.rb +6 -6
- data/lib/bing_ads_ruby_sdk/log_message.rb +2 -3
- data/lib/bing_ads_ruby_sdk/oauth2/authorization_handler.rb +24 -21
- data/lib/bing_ads_ruby_sdk/oauth2/fs_store.rb +2 -2
- data/lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb +2 -3
- data/lib/bing_ads_ruby_sdk/postprocessors/snakize.rb +2 -3
- data/lib/bing_ads_ruby_sdk/preprocessors/camelize.rb +3 -4
- data/lib/bing_ads_ruby_sdk/preprocessors/order.rb +2 -3
- data/lib/bing_ads_ruby_sdk/services/ad_insight.rb +1 -2
- data/lib/bing_ads_ruby_sdk/services/base.rb +13 -10
- data/lib/bing_ads_ruby_sdk/services/bulk.rb +1 -2
- data/lib/bing_ads_ruby_sdk/services/campaign_management.rb +2 -5
- data/lib/bing_ads_ruby_sdk/services/customer_billing.rb +1 -2
- data/lib/bing_ads_ruby_sdk/services/customer_management.rb +1 -2
- data/lib/bing_ads_ruby_sdk/services/reporting.rb +1 -2
- data/lib/bing_ads_ruby_sdk/soap_client.rb +11 -17
- data/lib/bing_ads_ruby_sdk/string_utils.rb +6 -7
- data/lib/bing_ads_ruby_sdk/version.rb +1 -1
- data/lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb +0 -1
- data/lib/bing_ads_ruby_sdk.rb +10 -9
- data/spec/bing_ads_ruby_sdk/api_spec.rb +3 -3
- data/spec/bing_ads_ruby_sdk/errors/error_handler_spec.rb +112 -114
- data/spec/bing_ads_ruby_sdk/errors/errors_spec.rb +4 -4
- data/spec/bing_ads_ruby_sdk/header_spec.rb +22 -22
- data/spec/bing_ads_ruby_sdk/http_client_spec.rb +3 -5
- data/spec/bing_ads_ruby_sdk/oauth2/fs_store_spec.rb +2 -3
- data/spec/bing_ads_ruby_sdk/postprocessors/cast_long_arrays_spec.rb +4 -5
- data/spec/bing_ads_ruby_sdk/postprocessors/snakize_spec.rb +1 -2
- data/spec/bing_ads_ruby_sdk/preprocessors/camelize_spec.rb +1 -2
- data/spec/bing_ads_ruby_sdk/preprocessors/order_spec.rb +87 -76
- data/spec/bing_ads_ruby_sdk/services/bulk_spec.rb +7 -12
- data/spec/bing_ads_ruby_sdk/services/campaign_management_spec.rb +74 -67
- data/spec/bing_ads_ruby_sdk/services/customer_management_spec.rb +22 -23
- data/spec/examples/1_customer_creation/customer_spec.rb +11 -11
- data/spec/examples/2_with_customer/budget_spec.rb +19 -21
- data/spec/examples/2_with_customer/campaigns_spec.rb +9 -10
- data/spec/examples/2_with_customer/customer_management_spec.rb +37 -39
- data/spec/examples/2_with_customer/uet_tags_spec.rb +14 -14
- data/spec/examples/3_with_uet_tag/conversion_goal_spec.rb +19 -19
- data/spec/examples/3_with_uet_tag/uet_tags_spec.rb +15 -15
- data/spec/examples/4_with_conversion_goal/conversion_goals_spec.rb +23 -22
- data/spec/examples/5_with_campaign/ad_extension_spec.rb +20 -23
- data/spec/examples/5_with_campaign/ad_group_spec.rb +14 -15
- data/spec/examples/5_with_campaign/campaign_criterions_spec.rb +21 -23
- data/spec/examples/5_with_campaign/campaign_spec.rb +17 -18
- data/spec/examples/6_with_ad_group/ad_group_spec.rb +19 -20
- data/spec/examples/6_with_ad_group/ads_spec.rb +38 -41
- data/spec/examples/6_with_ad_group/keywords_spec.rb +29 -32
- data/spec/examples/examples.rb +3 -4
- data/spec/spec_helper.rb +10 -10
- data/spec/support/spec_helpers.rb +10 -9
- data/tasks/bing_ads_ruby_sdk.rake +7 -8
- metadata +8 -84
- data/.github/delete-merged-branch-config.yml +0 -6
- data/.github/stale.yml +0 -19
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "Conversion goals methods" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
6
|
let(:a_conversion_goal) do
|
|
7
7
|
{
|
|
8
8
|
conversion_window_in_minutes: a_kind_of(String),
|
|
9
9
|
count_type: a_kind_of(String),
|
|
10
10
|
id: a_kind_of(String),
|
|
11
|
-
name: a_string_starting_with(
|
|
11
|
+
name: a_string_starting_with("Acceptance Test Conversion goal"),
|
|
12
12
|
revenue: a_kind_of(Hash),
|
|
13
13
|
scope: a_kind_of(String),
|
|
14
14
|
status: a_kind_of(String),
|
|
15
15
|
tag_id: Examples.uet_tag_id.to_s,
|
|
16
16
|
tracking_status: a_kind_of(String),
|
|
17
|
-
type:
|
|
17
|
+
type: "Event",
|
|
18
18
|
action_expression: a_kind_of(String),
|
|
19
19
|
action_operator: a_kind_of(String),
|
|
20
20
|
category_expression: a_kind_of(String),
|
|
@@ -27,19 +27,19 @@ RSpec.describe 'Conversion goals methods' do
|
|
|
27
27
|
}
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
describe
|
|
31
|
-
it
|
|
30
|
+
describe "#get_conversion_goals_by_ids" do
|
|
31
|
+
it "returns a list of conversion goals" do
|
|
32
32
|
expect(api.campaign_management.get_conversion_goals_by_ids(
|
|
33
|
-
conversion_goal_types:
|
|
34
|
-
conversion_goal_ids: [{
|
|
35
|
-
|
|
33
|
+
conversion_goal_types: "Event",
|
|
34
|
+
conversion_goal_ids: [{long: Examples.conversion_goal_id}]
|
|
35
|
+
)).to contain_exactly(a_conversion_goal)
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
describe
|
|
40
|
-
it
|
|
39
|
+
describe "#get_conversion_goals_by_tag_ids" do
|
|
40
|
+
it "returns a list of conversion_goals" do
|
|
41
41
|
expect(api.campaign_management.call(:get_conversion_goals_by_tag_ids, {
|
|
42
|
-
conversion_goal_types:
|
|
42
|
+
conversion_goal_types: "Event",
|
|
43
43
|
tag_ids: [long: Examples.uet_tag_id]
|
|
44
44
|
})).to include(
|
|
45
45
|
conversion_goals: {
|
|
@@ -50,25 +50,26 @@ RSpec.describe 'Conversion goals methods' do
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
describe
|
|
54
|
-
it
|
|
53
|
+
describe "#update_conversion_goals" do
|
|
54
|
+
it "updates the conversion goals" do
|
|
55
55
|
expect(
|
|
56
56
|
api.campaign_management.update_conversion_goals(
|
|
57
57
|
conversion_goals: {
|
|
58
58
|
event_goal: {
|
|
59
59
|
id: Examples.conversion_goal_id,
|
|
60
|
-
name: "Acceptance Test Conversion goal #{random}"
|
|
60
|
+
name: "Acceptance Test Conversion goal #{random}"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
63
|
-
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
).to eq(partial_errors: "")
|
|
64
65
|
|
|
65
66
|
updated_conversion = api.campaign_management.get_conversion_goals_by_ids(
|
|
66
|
-
conversion_goal_types:
|
|
67
|
-
conversion_goal_ids: [{
|
|
68
|
-
|
|
67
|
+
conversion_goal_types: "Event",
|
|
68
|
+
conversion_goal_ids: [{long: Examples.conversion_goal_id}]
|
|
69
|
+
).first
|
|
69
70
|
|
|
70
71
|
expect(updated_conversion).to include(
|
|
71
|
-
name:"Acceptance Test Conversion goal #{random}"
|
|
72
|
+
name: "Acceptance Test Conversion goal #{random}"
|
|
72
73
|
)
|
|
73
74
|
end
|
|
74
75
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../examples"
|
|
4
4
|
|
|
5
5
|
RSpec.describe "AdExtension methods" do
|
|
6
6
|
include_context "use api"
|
|
@@ -26,8 +26,8 @@ RSpec.describe "AdExtension methods" do
|
|
|
26
26
|
description_1: "Description 1 - #{Examples.random}"[0..34],
|
|
27
27
|
description_2: "Description 2 - #{Examples.random}"[0..34],
|
|
28
28
|
display_text: "Display Text #{Examples.random}"[0..24],
|
|
29
|
-
final_mobile_urls: [
|
|
30
|
-
final_urls: [
|
|
29
|
+
final_mobile_urls: [{string: "http://mobile.example.com"}],
|
|
30
|
+
final_urls: [{string: "http://www.example.com"}],
|
|
31
31
|
tracking_url_template: "{lpurl}"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -61,26 +61,25 @@ RSpec.describe "AdExtension methods" do
|
|
|
61
61
|
account_id: Examples.account_id,
|
|
62
62
|
ad_extension_type: "CallAdExtension SitelinkAdExtension CalloutAdExtension",
|
|
63
63
|
association_type: "Campaign",
|
|
64
|
-
entity_ids: [{
|
|
64
|
+
entity_ids: [{long: Examples.campaign_id}]
|
|
65
65
|
)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
context "with shared ad extensions" do
|
|
69
69
|
before(:all) do
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
set_ad_extensions_associations(ad_extension_ids($created_ad_extension_response))
|
|
70
|
+
@created_ad_extension_response = create_add_ad_extensions
|
|
71
|
+
set_ad_extensions_associations(ad_extension_ids(@created_ad_extension_response))
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
describe "#add_ad_extensions" do
|
|
76
75
|
it "returns AdExtension ids" do
|
|
77
|
-
expect(
|
|
76
|
+
expect(@created_ad_extension_response).to include(
|
|
78
77
|
ad_extension_identities: {
|
|
79
78
|
ad_extension_identity: [
|
|
80
|
-
{
|
|
81
|
-
{
|
|
82
|
-
{
|
|
83
|
-
]
|
|
79
|
+
{id: a_kind_of(String), version: "1"},
|
|
80
|
+
{id: a_kind_of(String), version: "1"},
|
|
81
|
+
{id: a_kind_of(String), version: "1"}
|
|
82
|
+
]
|
|
84
83
|
},
|
|
85
84
|
nested_partial_errors: ""
|
|
86
85
|
)
|
|
@@ -102,7 +101,7 @@ RSpec.describe "AdExtension methods" do
|
|
|
102
101
|
is_call_only: "false",
|
|
103
102
|
is_call_tracking_enabled: "false",
|
|
104
103
|
phone_number: match(/[0-9]*/),
|
|
105
|
-
require_toll_free_tracking_number: nil
|
|
104
|
+
require_toll_free_tracking_number: nil
|
|
106
105
|
},
|
|
107
106
|
association_type: "Campaign",
|
|
108
107
|
editorial_status: a_kind_of(String),
|
|
@@ -160,7 +159,7 @@ RSpec.describe "AdExtension methods" do
|
|
|
160
159
|
end
|
|
161
160
|
|
|
162
161
|
def get_association(associations, type)
|
|
163
|
-
associations.
|
|
162
|
+
associations.find { |record| record[:ad_extension][:type] == type }
|
|
164
163
|
end
|
|
165
164
|
|
|
166
165
|
it "returns a list of Associations" do
|
|
@@ -182,9 +181,9 @@ RSpec.describe "AdExtension methods" do
|
|
|
182
181
|
it "returns a list of IDs" do
|
|
183
182
|
fetched_ad_extension_ids = api.campaign_management.get_ad_extension_ids_by_account_id(
|
|
184
183
|
account_id: Examples.account_id,
|
|
185
|
-
ad_extension_type:
|
|
184
|
+
ad_extension_type: "SitelinkAdExtension CallAdExtension CalloutAdExtension"
|
|
186
185
|
)
|
|
187
|
-
ad_extension_ids(
|
|
186
|
+
ad_extension_ids(@created_ad_extension_response).each do |id|
|
|
188
187
|
expect(fetched_ad_extension_ids).to include id
|
|
189
188
|
end
|
|
190
189
|
end
|
|
@@ -194,8 +193,8 @@ RSpec.describe "AdExtension methods" do
|
|
|
194
193
|
it "returns AdExtensions" do
|
|
195
194
|
extensions = api.campaign_management.get_ad_extensions_by_ids(
|
|
196
195
|
account_id: Examples.account_id,
|
|
197
|
-
ad_extension_ids: ad_extension_ids(
|
|
198
|
-
ad_extension_type:
|
|
196
|
+
ad_extension_ids: ad_extension_ids(@created_ad_extension_response).map { |id| {long: id} },
|
|
197
|
+
ad_extension_type: "SitelinkAdExtension CallAdExtension CalloutAdExtension"
|
|
199
198
|
)
|
|
200
199
|
expect(extensions).to be_an(Array)
|
|
201
200
|
end
|
|
@@ -208,8 +207,7 @@ RSpec.describe "AdExtension methods" do
|
|
|
208
207
|
it "returns no errors" do
|
|
209
208
|
expect(api.campaign_management.call(:delete_ad_extensions,
|
|
210
209
|
account_id: Examples.account_id,
|
|
211
|
-
ad_extension_ids: [
|
|
212
|
-
)).to eq(partial_errors: "")
|
|
210
|
+
ad_extension_ids: [{long: ad_extension_ids(response).first}])).to eq(partial_errors: "")
|
|
213
211
|
end
|
|
214
212
|
end
|
|
215
213
|
|
|
@@ -228,11 +226,10 @@ RSpec.describe "AdExtension methods" do
|
|
|
228
226
|
ad_extension_id_to_entity_id_associations: [
|
|
229
227
|
ad_extension_id_to_entity_id_association: {
|
|
230
228
|
ad_extension_id: ad_extension_id,
|
|
231
|
-
entity_id: Examples.campaign_id
|
|
229
|
+
entity_id: Examples.campaign_id
|
|
232
230
|
}
|
|
233
231
|
],
|
|
234
|
-
association_type: "Campaign"
|
|
235
|
-
)).to eq(partial_errors: "")
|
|
232
|
+
association_type: "Campaign")).to eq(partial_errors: "")
|
|
236
233
|
end
|
|
237
234
|
end
|
|
238
235
|
end
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "AdGroup methods" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
|
-
describe
|
|
7
|
-
it
|
|
6
|
+
describe "#add_ad_groups" do
|
|
7
|
+
it "returns created AdGroup ids" do
|
|
8
8
|
ad_groups = api.campaign_management.call(:add_ad_groups,
|
|
9
9
|
campaign_id: Examples.campaign_id,
|
|
10
10
|
ad_groups: {
|
|
11
11
|
ad_group: {
|
|
12
12
|
name: "AcceptanceTestAdGroup - #{random}",
|
|
13
|
-
language:
|
|
13
|
+
language: "French",
|
|
14
14
|
start_date: {
|
|
15
|
-
day:
|
|
16
|
-
month:
|
|
17
|
-
year:
|
|
15
|
+
day: "1",
|
|
16
|
+
month: "1",
|
|
17
|
+
year: "2049"
|
|
18
18
|
},
|
|
19
19
|
end_date: {
|
|
20
|
-
day:
|
|
21
|
-
month:
|
|
22
|
-
year:
|
|
20
|
+
day: "1",
|
|
21
|
+
month: "2",
|
|
22
|
+
year: "2049"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
}
|
|
26
|
-
)
|
|
25
|
+
})
|
|
27
26
|
expect(ad_groups).to include(
|
|
28
27
|
ad_group_ids: [a_kind_of(Integer)],
|
|
29
|
-
partial_errors:
|
|
28
|
+
partial_errors: ""
|
|
30
29
|
)
|
|
31
30
|
|
|
32
31
|
puts "Please fill in examples.rb with ad_group_id: #{ad_groups[:ad_group_ids].first}"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "CampaignCriterion methods" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
6
|
def add_campaign_criterions(location_id)
|
|
7
7
|
api.campaign_management.call(:add_campaign_criterions,
|
|
@@ -15,59 +15,57 @@ RSpec.describe 'CampaignCriterion methods' do
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
criterion_type:
|
|
19
|
-
)
|
|
18
|
+
criterion_type: "Targets")
|
|
20
19
|
end
|
|
21
20
|
|
|
22
|
-
describe
|
|
23
|
-
it
|
|
21
|
+
describe "#add_campaign_criterions" do
|
|
22
|
+
it "returns CampaignCriterion ids" do
|
|
24
23
|
expect(add_campaign_criterions(190)).to include(
|
|
25
24
|
campaign_criterion_ids: [a_kind_of(Integer)],
|
|
26
|
-
nested_partial_errors:
|
|
25
|
+
nested_partial_errors: ""
|
|
27
26
|
)
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
29
|
|
|
31
|
-
describe
|
|
32
|
-
it
|
|
30
|
+
describe "#delete_campaign_criterions" do
|
|
31
|
+
it "returns no errors" do
|
|
33
32
|
response = add_campaign_criterions(191)
|
|
34
33
|
|
|
35
34
|
expect(api.campaign_management.call(:delete_campaign_criterions,
|
|
36
35
|
campaign_criterion_ids: [
|
|
37
|
-
{
|
|
36
|
+
{long: response[:campaign_criterion_ids].first}
|
|
38
37
|
],
|
|
39
38
|
campaign_id: Examples.campaign_id,
|
|
40
|
-
criterion_type:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
39
|
+
criterion_type: "Targets")).to eq(
|
|
40
|
+
partial_errors: ""
|
|
41
|
+
)
|
|
44
42
|
end
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
describe
|
|
48
|
-
it
|
|
45
|
+
describe "#get_campaign_criterions_by_ids" do
|
|
46
|
+
it "returns CampaignCriterions" do
|
|
49
47
|
response = add_campaign_criterions(193)
|
|
50
48
|
criterion_id = response[:campaign_criterion_ids].first.to_s
|
|
51
49
|
|
|
52
50
|
criterions = api.campaign_management.get_campaign_criterions_by_ids(
|
|
53
|
-
campaign_criterion_ids: [{
|
|
51
|
+
campaign_criterion_ids: [{long: criterion_id}],
|
|
54
52
|
campaign_id: Examples.campaign_id,
|
|
55
|
-
criterion_type:
|
|
53
|
+
criterion_type: "Age DayTime Device Gender Location LocationIntent Radius"
|
|
56
54
|
)
|
|
57
55
|
|
|
58
56
|
expect(criterions).to include(
|
|
59
57
|
campaign_id: Examples.campaign_id.to_s,
|
|
60
58
|
criterion: {
|
|
61
|
-
type:
|
|
59
|
+
type: "LocationCriterion",
|
|
62
60
|
display_name: a_kind_of(String),
|
|
63
61
|
enclosed_location_ids: nil,
|
|
64
|
-
location_id:
|
|
65
|
-
location_type: a_kind_of(String)
|
|
62
|
+
location_id: "193",
|
|
63
|
+
location_type: a_kind_of(String)
|
|
66
64
|
},
|
|
67
65
|
forward_compatibility_map: nil,
|
|
68
66
|
id: criterion_id,
|
|
69
67
|
status: a_kind_of(String),
|
|
70
|
-
type:
|
|
68
|
+
type: "NegativeCampaignCriterion"
|
|
71
69
|
)
|
|
72
70
|
end
|
|
73
71
|
end
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "CampaignManagement service" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
|
-
describe
|
|
6
|
+
describe "Campaign methods" do
|
|
7
7
|
let(:a_campaign_hash) do
|
|
8
8
|
a_hash_including(
|
|
9
9
|
audience_ads_bid_adjustment: a_kind_of(String),
|
|
10
10
|
bidding_scheme: a_kind_of(Hash),
|
|
11
11
|
budget_type: a_kind_of(String),
|
|
12
12
|
daily_budget: a_kind_of(String),
|
|
13
|
-
forward_compatibility_map:
|
|
13
|
+
forward_compatibility_map: "",
|
|
14
14
|
id: Examples.campaign_id.to_s,
|
|
15
|
-
name: a_string_starting_with(
|
|
15
|
+
name: a_string_starting_with("Acceptance Test Campaign"),
|
|
16
16
|
status: a_kind_of(String),
|
|
17
17
|
time_zone: a_kind_of(String),
|
|
18
18
|
tracking_url_template: nil,
|
|
@@ -23,28 +23,28 @@ RSpec.describe 'CampaignManagement service' do
|
|
|
23
23
|
languages: nil,
|
|
24
24
|
experiment_id: nil,
|
|
25
25
|
final_url_suffix: nil,
|
|
26
|
-
sub_type: nil
|
|
26
|
+
sub_type: nil
|
|
27
27
|
)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
describe
|
|
31
|
-
it
|
|
30
|
+
describe "#get_campaigns_by_account_id" do
|
|
31
|
+
it "returns a list of campaigns" do
|
|
32
32
|
expect(api.campaign_management.get_campaigns_by_account_id(
|
|
33
33
|
account_id: Examples.account_id
|
|
34
34
|
)).to include(a_campaign_hash)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
describe
|
|
39
|
-
it
|
|
38
|
+
describe "#get_campaigns_by_ids" do
|
|
39
|
+
it "returns a list of campaigns" do
|
|
40
40
|
expect(api.campaign_management.get_campaigns_by_ids(
|
|
41
41
|
account_id: Examples.account_id,
|
|
42
|
-
campaign_ids: [{
|
|
42
|
+
campaign_ids: [{long: Examples.campaign_id}]
|
|
43
43
|
)).to include(a_campaign_hash)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
describe
|
|
47
|
+
describe "#update_campaigns" do
|
|
48
48
|
subject do
|
|
49
49
|
api.campaign_management.call(:update_campaigns,
|
|
50
50
|
account_id: Examples.account_id,
|
|
@@ -53,15 +53,14 @@ RSpec.describe 'CampaignManagement service' do
|
|
|
53
53
|
id: Examples.campaign_id,
|
|
54
54
|
name: "Acceptance Test Campaign - #{random}"
|
|
55
55
|
]
|
|
56
|
-
}
|
|
57
|
-
)
|
|
56
|
+
})
|
|
58
57
|
end
|
|
59
58
|
|
|
60
|
-
it
|
|
61
|
-
is_expected.to eq(partial_errors:
|
|
59
|
+
it "returns no errors" do
|
|
60
|
+
is_expected.to eq(partial_errors: "")
|
|
62
61
|
updated_campaign = api.campaign_management.get_campaigns_by_ids(
|
|
63
62
|
account_id: Examples.account_id,
|
|
64
|
-
campaign_ids: [{
|
|
63
|
+
campaign_ids: [{long: Examples.campaign_id}]
|
|
65
64
|
).first
|
|
66
65
|
|
|
67
66
|
expect(updated_campaign).to include(name: "Acceptance Test Campaign - #{random}")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "AdGroup methods" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
6
|
let(:ad_group_record) do
|
|
7
7
|
a_hash_including(
|
|
@@ -14,40 +14,40 @@ RSpec.describe 'AdGroup methods' do
|
|
|
14
14
|
network: a_kind_of(String),
|
|
15
15
|
settings: nil,
|
|
16
16
|
start_date: {
|
|
17
|
-
day:
|
|
18
|
-
month:
|
|
19
|
-
year:
|
|
17
|
+
day: "1",
|
|
18
|
+
month: "1",
|
|
19
|
+
year: "2049"
|
|
20
20
|
},
|
|
21
21
|
end_date: {
|
|
22
|
-
day:
|
|
23
|
-
month:
|
|
24
|
-
year:
|
|
22
|
+
day: "1",
|
|
23
|
+
month: "2",
|
|
24
|
+
year: "2049"
|
|
25
25
|
},
|
|
26
26
|
status: a_kind_of(String),
|
|
27
27
|
tracking_url_template: nil,
|
|
28
|
-
url_custom_parameters: nil
|
|
28
|
+
url_custom_parameters: nil
|
|
29
29
|
)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
describe
|
|
33
|
-
it
|
|
32
|
+
describe "#get_ad_groups_by_ids" do
|
|
33
|
+
it "returns AdGroups" do
|
|
34
34
|
expect(api.campaign_management.get_ad_groups_by_ids(
|
|
35
35
|
campaign_id: Examples.campaign_id,
|
|
36
|
-
ad_group_ids: [
|
|
36
|
+
ad_group_ids: [{long: Examples.ad_group_id}]
|
|
37
37
|
)).to include(ad_group_record)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
describe
|
|
42
|
-
it
|
|
41
|
+
describe "#get_ad_groups_by_campaign_id" do
|
|
42
|
+
it "returns AdGroups" do
|
|
43
43
|
expect(api.campaign_management.get_ad_groups_by_campaign_id(
|
|
44
44
|
campaign_id: Examples.campaign_id
|
|
45
45
|
)).to include(ad_group_record)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
describe
|
|
50
|
-
it
|
|
49
|
+
describe "#update_ad_groups" do
|
|
50
|
+
it "updates the ad" do
|
|
51
51
|
expect(api.campaign_management.call(:update_ad_groups,
|
|
52
52
|
campaign_id: Examples.campaign_id,
|
|
53
53
|
ad_groups: {
|
|
@@ -55,12 +55,11 @@ RSpec.describe 'AdGroup methods' do
|
|
|
55
55
|
id: Examples.ad_group_id,
|
|
56
56
|
name: "AcceptanceTestAdGroup - #{random}"
|
|
57
57
|
}]
|
|
58
|
-
}
|
|
59
|
-
)).to eq(partial_errors: '', inherited_bid_strategy_types: nil)
|
|
58
|
+
})).to eq(partial_errors: "", inherited_bid_strategy_types: nil)
|
|
60
59
|
|
|
61
60
|
ad_group = api.campaign_management.get_ad_groups_by_ids(
|
|
62
61
|
campaign_id: Examples.campaign_id,
|
|
63
|
-
ad_group_ids: [
|
|
62
|
+
ad_group_ids: [{long: Examples.ad_group_id}]
|
|
64
63
|
).first
|
|
65
64
|
|
|
66
65
|
expect(ad_group).to include(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
require_relative
|
|
1
|
+
require_relative "../examples"
|
|
2
2
|
|
|
3
|
-
RSpec.describe
|
|
4
|
-
include_context
|
|
3
|
+
RSpec.describe "Ad methods" do
|
|
4
|
+
include_context "use api"
|
|
5
5
|
|
|
6
6
|
def add_ads
|
|
7
7
|
api.campaign_management.call(:add_ads,
|
|
@@ -9,49 +9,48 @@ RSpec.describe 'Ad methods' do
|
|
|
9
9
|
ads: [
|
|
10
10
|
{
|
|
11
11
|
expanded_text_ad: {
|
|
12
|
-
ad_format_preference:
|
|
13
|
-
domain:
|
|
14
|
-
final_urls: [string:
|
|
15
|
-
path_1:
|
|
16
|
-
path_2:
|
|
17
|
-
text:
|
|
18
|
-
title_part_1:
|
|
19
|
-
title_part_2:
|
|
20
|
-
status:
|
|
21
|
-
tracking_url_template:
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
)
|
|
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
|
+
])
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def get_ads
|
|
29
28
|
api.campaign_management.get_ads_by_ad_group_id(
|
|
30
29
|
ad_group_id: Examples.ad_group_id,
|
|
31
30
|
ad_types: [
|
|
32
|
-
{
|
|
33
|
-
{
|
|
34
|
-
{
|
|
35
|
-
{
|
|
36
|
-
{
|
|
37
|
-
{
|
|
31
|
+
{ad_type: "Text"},
|
|
32
|
+
{ad_type: "Image"},
|
|
33
|
+
{ad_type: "Product"},
|
|
34
|
+
{ad_type: "AppInstall"},
|
|
35
|
+
{ad_type: "ExpandedText"},
|
|
36
|
+
{ad_type: "DynamicSearch"}
|
|
38
37
|
]
|
|
39
38
|
)
|
|
40
39
|
end
|
|
41
40
|
|
|
42
|
-
describe
|
|
43
|
-
it
|
|
41
|
+
describe "#add_ads" do
|
|
42
|
+
it "returns created Ad ids" do
|
|
44
43
|
expect(add_ads).to include(
|
|
45
44
|
ad_ids: [a_kind_of(Integer)],
|
|
46
|
-
partial_errors:
|
|
45
|
+
partial_errors: ""
|
|
47
46
|
)
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
|
|
51
|
-
describe
|
|
50
|
+
describe "#get_ads_by_ad_group_id" do
|
|
52
51
|
before { add_ads }
|
|
53
52
|
|
|
54
|
-
it
|
|
53
|
+
it "returns a list of ads" do
|
|
55
54
|
expect(get_ads).to include(
|
|
56
55
|
{
|
|
57
56
|
ad_format_preference: a_kind_of(String),
|
|
@@ -71,43 +70,41 @@ RSpec.describe 'Ad methods' do
|
|
|
71
70
|
path1: a_kind_of(String),
|
|
72
71
|
path2: a_kind_of(String),
|
|
73
72
|
text: a_kind_of(String),
|
|
74
|
-
text_part2:
|
|
73
|
+
text_part2: "",
|
|
75
74
|
title_part1: a_kind_of(String),
|
|
76
75
|
title_part2: a_kind_of(String),
|
|
77
|
-
title_part3:
|
|
76
|
+
title_part3: ""
|
|
78
77
|
}
|
|
79
78
|
)
|
|
80
79
|
end
|
|
81
80
|
end
|
|
82
81
|
|
|
83
|
-
describe
|
|
82
|
+
describe "#update_ads" do
|
|
84
83
|
before { add_ads }
|
|
85
84
|
|
|
86
|
-
it
|
|
85
|
+
it "updates the Ad" do
|
|
87
86
|
expect(api.campaign_management.call(:update_ads,
|
|
88
87
|
ad_group_id: Examples.ad_group_id,
|
|
89
88
|
ads: {
|
|
90
89
|
expanded_text_ad: [{
|
|
91
90
|
id: get_ads.first[:id],
|
|
92
91
|
text: "Ad text goes here - #{random}"
|
|
93
|
-
}]
|
|
94
|
-
}
|
|
95
|
-
)).to eq(partial_errors: '')
|
|
92
|
+
}]
|
|
93
|
+
})).to eq(partial_errors: "")
|
|
96
94
|
|
|
97
|
-
expect(get_ads.first).to include(
|
|
95
|
+
expect(get_ads.first).to include(text: "Ad text goes here - #{random}")
|
|
98
96
|
end
|
|
99
97
|
end
|
|
100
98
|
|
|
101
|
-
describe
|
|
99
|
+
describe "test_delete_ads" do
|
|
102
100
|
let(:ad_id) { add_ads[:ad_ids].first }
|
|
103
101
|
|
|
104
|
-
it
|
|
102
|
+
it "returns no errors" do
|
|
105
103
|
expect(api.campaign_management.call(:delete_ads,
|
|
106
104
|
ad_group_id: Examples.ad_group_id,
|
|
107
|
-
ad_ids: [long: ad_id]
|
|
108
|
-
)).to eq(partial_errors: '')
|
|
105
|
+
ad_ids: [long: ad_id])).to eq(partial_errors: "")
|
|
109
106
|
|
|
110
|
-
expect(get_ads.map{|h| h[:id]}).not_to include ad_id.to_s
|
|
107
|
+
expect(get_ads.map { |h| h[:id] }).not_to include ad_id.to_s
|
|
111
108
|
end
|
|
112
109
|
end
|
|
113
110
|
end
|