bing_ads_ruby_sdk 1.5.0 → 1.5.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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +21 -5
  4. data/Rakefile +1 -1
  5. data/bing_ads_ruby_sdk.gemspec +9 -1
  6. data/changelog.md +3 -0
  7. data/lib/Rakefile +4 -0
  8. data/lib/bing_ads_ruby_sdk/errors/errors.rb +1 -1
  9. data/lib/bing_ads_ruby_sdk/railtie.rb +13 -0
  10. data/{tasks → lib/bing_ads_ruby_sdk/tasks}/bing_ads_ruby_sdk.rake +1 -1
  11. data/lib/bing_ads_ruby_sdk/version.rb +1 -1
  12. data/lib/bing_ads_ruby_sdk.rb +1 -0
  13. metadata +6 -85
  14. data/.circleci/config.yml +0 -54
  15. data/.github/.keep +0 -0
  16. data/.github/renovate.json +0 -225
  17. data/.gitignore +0 -19
  18. data/.rspec +0 -4
  19. data/spec/bing_ads_ruby_sdk/api_spec.rb +0 -17
  20. data/spec/bing_ads_ruby_sdk/errors/error_handler_spec.rb +0 -477
  21. data/spec/bing_ads_ruby_sdk/errors/errors_spec.rb +0 -13
  22. data/spec/bing_ads_ruby_sdk/header_spec.rb +0 -60
  23. data/spec/bing_ads_ruby_sdk/http_client_spec.rb +0 -42
  24. data/spec/bing_ads_ruby_sdk/oauth2/fs_store_spec.rb +0 -19
  25. data/spec/bing_ads_ruby_sdk/postprocessors/cast_long_arrays_spec.rb +0 -29
  26. data/spec/bing_ads_ruby_sdk/postprocessors/snakize_spec.rb +0 -39
  27. data/spec/bing_ads_ruby_sdk/preprocessors/camelize_spec.rb +0 -39
  28. data/spec/bing_ads_ruby_sdk/preprocessors/order_spec.rb +0 -130
  29. data/spec/bing_ads_ruby_sdk/services/bulk_spec.rb +0 -51
  30. data/spec/bing_ads_ruby_sdk/services/campaign_management_spec.rb +0 -314
  31. data/spec/bing_ads_ruby_sdk/services/customer_management_spec.rb +0 -96
  32. data/spec/bing_ads_ruby_sdk_spec.rb +0 -5
  33. data/spec/examples/1_customer_creation/customer_spec.rb +0 -35
  34. data/spec/examples/2_with_customer/budget_spec.rb +0 -52
  35. data/spec/examples/2_with_customer/campaigns_spec.rb +0 -26
  36. data/spec/examples/2_with_customer/customer_management_spec.rb +0 -188
  37. data/spec/examples/2_with_customer/uet_tags_spec.rb +0 -42
  38. data/spec/examples/3_with_uet_tag/conversion_goal_spec.rb +0 -40
  39. data/spec/examples/3_with_uet_tag/uet_tags_spec.rb +0 -56
  40. data/spec/examples/4_with_conversion_goal/conversion_goals_spec.rb +0 -76
  41. data/spec/examples/5_with_campaign/ad_extension_spec.rb +0 -235
  42. data/spec/examples/5_with_campaign/ad_group_spec.rb +0 -34
  43. data/spec/examples/5_with_campaign/campaign_criterions_spec.rb +0 -72
  44. data/spec/examples/5_with_campaign/campaign_spec.rb +0 -70
  45. data/spec/examples/6_with_ad_group/ad_group_spec.rb +0 -70
  46. data/spec/examples/6_with_ad_group/ads_spec.rb +0 -110
  47. data/spec/examples/6_with_ad_group/keywords_spec.rb +0 -105
  48. data/spec/examples/examples.rb +0 -75
  49. data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard.xml +0 -23
  50. data/spec/fixtures/bulk/download_campaigns_by_account_ids/standard_response.xml +0 -11
  51. data/spec/fixtures/bulk/get_bulk_download_status/standard.xml +0 -14
  52. data/spec/fixtures/bulk/get_bulk_download_status/standard_response.xml +0 -15
  53. data/spec/fixtures/campaign_management/add_ad_extensions/standard.xml +0 -21
  54. data/spec/fixtures/campaign_management/add_ad_extensions/standard_response.xml +0 -17
  55. data/spec/fixtures/campaign_management/add_conversion_goals/standard.xml +0 -27
  56. data/spec/fixtures/campaign_management/add_conversion_goals/standard_response.xml +0 -14
  57. data/spec/fixtures/campaign_management/add_shared_entity/standard.xml +0 -16
  58. data/spec/fixtures/campaign_management/add_shared_entity/standard_response.xml +0 -13
  59. data/spec/fixtures/campaign_management/add_uet_tags/standard.xml +0 -19
  60. data/spec/fixtures/campaign_management/add_uet_tags/standard_response.xml +0 -21
  61. data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard.xml +0 -15
  62. data/spec/fixtures/campaign_management/get_ad_extension_ids_by_account_id/standard_response.xml +0 -13
  63. data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard.xml +0 -19
  64. data/spec/fixtures/campaign_management/get_ad_extensions_associations/standard_response.xml +0 -47
  65. data/spec/fixtures/campaign_management/get_budgets_by_ids/standard.xml +0 -12
  66. data/spec/fixtures/campaign_management/get_budgets_by_ids/standard_response.xml +0 -20
  67. data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard.xml +0 -14
  68. data/spec/fixtures/campaign_management/get_campaigns_by_account_id/standard_response.xml +0 -84
  69. data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard.xml +0 -18
  70. data/spec/fixtures/campaign_management/get_conversion_goals_by_ids/standard_response.xml +0 -61
  71. data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard.xml +0 -14
  72. data/spec/fixtures/campaign_management/get_shared_entities_by_account_id/standard_response.xml +0 -20
  73. data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard.xml +0 -18
  74. data/spec/fixtures/campaign_management/get_shared_entity_associations_by_entity_ids/standard_response.xml +0 -19
  75. data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard.xml +0 -16
  76. data/spec/fixtures/campaign_management/get_uet_tags_by_ids/standard_response.xml +0 -21
  77. data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard.xml +0 -21
  78. data/spec/fixtures/campaign_management/set_ad_extensions_associations/standard_response.xml +0 -11
  79. data/spec/fixtures/campaign_management/set_shared_entity_associations/standard.xml +0 -21
  80. data/spec/fixtures/campaign_management/set_shared_entity_associations/standard_response.xml +0 -11
  81. data/spec/fixtures/campaign_management/update_conversion_goals/standard.xml +0 -27
  82. data/spec/fixtures/campaign_management/update_conversion_goals/standard_response.xml +0 -11
  83. data/spec/fixtures/campaign_management/update_uet_tags/standard.xml +0 -20
  84. data/spec/fixtures/campaign_management/update_uet_tags/standard_response.xml +0 -11
  85. data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard.xml +0 -15
  86. data/spec/fixtures/customer_management/find_accounts_or_customers_info/standard_response.xml +0 -21
  87. data/spec/fixtures/customer_management/get_account/standard.xml +0 -14
  88. data/spec/fixtures/customer_management/get_account/standard_response.xml +0 -43
  89. data/spec/fixtures/customer_management/signup_customer/standard.xml +0 -30
  90. data/spec/fixtures/customer_management/signup_customer/standard_response.xml +0 -15
  91. data/spec/fixtures/customer_management/update_account/standard.xml +0 -19
  92. data/spec/fixtures/customer_management/update_account/standard_response.xml +0 -11
  93. data/spec/spec_helper.rb +0 -33
  94. data/spec/support/spec_helpers.rb +0 -46
@@ -1,235 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../examples"
4
-
5
- RSpec.describe "AdExtension methods" do
6
- include_context "use api"
7
-
8
- def create_add_ad_extensions
9
- Examples.build_api.campaign_management.add_ad_extensions(
10
- account_id: Examples.account_id,
11
- ad_extensions: [
12
- {
13
- call_ad_extension: {
14
- country_code: "NZ",
15
- is_call_only: false,
16
- phone_number: SecureRandom.random_number(999_999_999)
17
- }
18
- },
19
- {
20
- callout_ad_extension: {
21
- text: Examples.random[0..11]
22
- }
23
- },
24
- {
25
- sitelink_ad_extension: {
26
- description_1: "Description 1 - #{Examples.random}"[0..34],
27
- description_2: "Description 2 - #{Examples.random}"[0..34],
28
- display_text: "Display Text #{Examples.random}"[0..24],
29
- final_mobile_urls: [{string: "http://mobile.example.com"}],
30
- final_urls: [{string: "http://www.example.com"}],
31
- tracking_url_template: "{lpurl}"
32
- }
33
- }
34
- ]
35
- )
36
- end
37
-
38
- def set_ad_extensions_associations(ad_extension_ids)
39
- Examples.build_api.campaign_management.set_ad_extensions_associations(
40
- account_id: Examples.account_id,
41
- ad_extension_id_to_entity_id_associations: ad_extension_ids.map do |id|
42
- {
43
- ad_extension_id_to_entity_id_association: {
44
- ad_extension_id: id,
45
- entity_id: Examples.campaign_id
46
- }
47
- }
48
- end,
49
- association_type: "Campaign"
50
- )
51
- end
52
-
53
- def ad_extension_ids(creation_response)
54
- creation_response[:ad_extension_identities][:ad_extension_identity].map do |ext|
55
- ext[:id].to_i
56
- end
57
- end
58
-
59
- def get_ad_extensions_associations
60
- api.campaign_management.get_ad_extensions_associations(
61
- account_id: Examples.account_id,
62
- ad_extension_type: "CallAdExtension SitelinkAdExtension CalloutAdExtension",
63
- association_type: "Campaign",
64
- entity_ids: [{long: Examples.campaign_id}]
65
- )
66
- end
67
-
68
- context "with shared ad extensions" do
69
- before(:all) do
70
- @created_ad_extension_response = create_add_ad_extensions
71
- set_ad_extensions_associations(ad_extension_ids(@created_ad_extension_response))
72
- end
73
-
74
- describe "#add_ad_extensions" do
75
- it "returns AdExtension ids" do
76
- expect(@created_ad_extension_response).to include(
77
- ad_extension_identities: {
78
- ad_extension_identity: [
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
- ]
83
- },
84
- nested_partial_errors: ""
85
- )
86
- end
87
- end
88
-
89
- describe "#get_ad_extensions_associations" do
90
- let(:call_ad_extension) do
91
- {
92
- ad_extension: {
93
- device_preference: nil,
94
- forward_compatibility_map: "",
95
- id: match(/[0-9]*/),
96
- scheduling: nil,
97
- status: a_kind_of(String),
98
- type: "CallAdExtension",
99
- version: match(/[0-9]*/),
100
- country_code: a_kind_of(String),
101
- is_call_only: "false",
102
- is_call_tracking_enabled: "false",
103
- phone_number: match(/[0-9]*/),
104
- require_toll_free_tracking_number: nil
105
- },
106
- association_type: "Campaign",
107
- editorial_status: a_kind_of(String),
108
- entity_id: Examples.campaign_id.to_s
109
- }
110
- end
111
-
112
- let(:callout_ad_extension) do
113
- {
114
- ad_extension: {
115
- device_preference: nil,
116
- forward_compatibility_map: "",
117
- id: match(/[0-9]*/),
118
- scheduling: nil,
119
- status: a_kind_of(String),
120
- type: "CalloutAdExtension",
121
- version: match(/[0-9]*/),
122
- text: a_kind_of(String)
123
- },
124
- association_type: "Campaign",
125
- editorial_status: a_kind_of(String),
126
- entity_id: Examples.campaign_id.to_s
127
- }
128
- end
129
-
130
- let(:sitelink_ad_extension) do
131
- {
132
- ad_extension: {
133
- device_preference: nil,
134
- forward_compatibility_map: "",
135
- id: match(/[0-9]*/),
136
- status: a_kind_of(String),
137
- type: "SitelinkAdExtension",
138
- version: match(/[0-9]*/),
139
- description1: a_kind_of(String),
140
- description2: a_kind_of(String),
141
- destination_url: nil,
142
- display_text: a_kind_of(String),
143
- final_app_urls: nil,
144
- final_url_suffix: nil,
145
- final_mobile_urls: {
146
- string: a_kind_of(String)
147
- },
148
- final_urls: {
149
- string: a_kind_of(String)
150
- },
151
- scheduling: nil,
152
- tracking_url_template: a_kind_of(String),
153
- url_custom_parameters: nil
154
- },
155
- association_type: "Campaign",
156
- editorial_status: "Active",
157
- entity_id: Examples.campaign_id.to_s
158
- }
159
- end
160
-
161
- def get_association(associations, type)
162
- associations.find { |record| record[:ad_extension][:type] == type }
163
- end
164
-
165
- it "returns a list of Associations" do
166
- fetched_associations = get_ad_extensions_associations
167
-
168
- # These are split apart to make it easier to figure out which one is missing
169
- expect(get_association(fetched_associations, "CallAdExtension"))
170
- .to include(call_ad_extension)
171
-
172
- expect(get_association(fetched_associations, "CalloutAdExtension"))
173
- .to include(callout_ad_extension)
174
-
175
- expect(get_association(fetched_associations, "SitelinkAdExtension"))
176
- .to include(sitelink_ad_extension)
177
- end
178
- end
179
-
180
- describe "#get_ad_extension_ids_by_account_id" do
181
- it "returns a list of IDs" do
182
- fetched_ad_extension_ids = api.campaign_management.get_ad_extension_ids_by_account_id(
183
- account_id: Examples.account_id,
184
- ad_extension_type: "SitelinkAdExtension CallAdExtension CalloutAdExtension"
185
- )
186
- ad_extension_ids(@created_ad_extension_response).each do |id|
187
- expect(fetched_ad_extension_ids).to include id
188
- end
189
- end
190
- end
191
-
192
- describe "#get_ad_extensions_by_ids" do
193
- it "returns AdExtensions" do
194
- extensions = api.campaign_management.get_ad_extensions_by_ids(
195
- account_id: Examples.account_id,
196
- ad_extension_ids: ad_extension_ids(@created_ad_extension_response).map { |id| {long: id} },
197
- ad_extension_type: "SitelinkAdExtension CallAdExtension CalloutAdExtension"
198
- )
199
- expect(extensions).to be_an(Array)
200
- end
201
- end
202
- end
203
-
204
- describe "#delete_ad_extensions" do
205
- let(:response) { create_add_ad_extensions }
206
-
207
- it "returns no errors" do
208
- expect(api.campaign_management.call(:delete_ad_extensions,
209
- account_id: Examples.account_id,
210
- ad_extension_ids: [{long: ad_extension_ids(response).first}])).to eq(partial_errors: "")
211
- end
212
- end
213
-
214
- describe "#delete_ad_extensions_associations" do
215
- before do
216
- response = create_add_ad_extensions
217
- set_ad_extensions_associations(ad_extension_ids(response))
218
- end
219
- let(:ad_extension_id) do
220
- get_ad_extensions_associations.first[:ad_extension][:id]
221
- end
222
-
223
- it "currently raises an error" do
224
- expect(api.campaign_management.call(:delete_ad_extensions_associations,
225
- account_id: Examples.account_id,
226
- ad_extension_id_to_entity_id_associations: [
227
- ad_extension_id_to_entity_id_association: {
228
- ad_extension_id: ad_extension_id,
229
- entity_id: Examples.campaign_id
230
- }
231
- ],
232
- association_type: "Campaign")).to eq(partial_errors: "")
233
- end
234
- end
235
- end
@@ -1,34 +0,0 @@
1
- require_relative "../examples"
2
-
3
- RSpec.describe "AdGroup methods" do
4
- include_context "use api"
5
-
6
- describe "#add_ad_groups" do
7
- it "returns created AdGroup ids" do
8
- ad_groups = api.campaign_management.call(:add_ad_groups,
9
- campaign_id: Examples.campaign_id,
10
- ad_groups: {
11
- ad_group: {
12
- name: "AcceptanceTestAdGroup - #{random}",
13
- language: "French",
14
- start_date: {
15
- day: "1",
16
- month: "1",
17
- year: "2049"
18
- },
19
- end_date: {
20
- day: "1",
21
- month: "2",
22
- year: "2049"
23
- }
24
- }
25
- })
26
- expect(ad_groups).to include(
27
- ad_group_ids: [a_kind_of(Integer)],
28
- partial_errors: ""
29
- )
30
-
31
- puts "Please fill in examples.rb with ad_group_id: #{ad_groups[:ad_group_ids].first}"
32
- end
33
- end
34
- end
@@ -1,72 +0,0 @@
1
- require_relative "../examples"
2
-
3
- RSpec.describe "CampaignCriterion methods" do
4
- include_context "use api"
5
-
6
- def add_campaign_criterions(location_id)
7
- api.campaign_management.call(:add_campaign_criterions,
8
- campaign_criterions: [
9
- {
10
- negative_campaign_criterion: {
11
- campaign_id: Examples.campaign_id,
12
- location_criterion: {
13
- location_id: location_id
14
- }
15
- }
16
- }
17
- ],
18
- criterion_type: "Targets")
19
- end
20
-
21
- describe "#add_campaign_criterions" do
22
- it "returns CampaignCriterion ids" do
23
- expect(add_campaign_criterions(190)).to include(
24
- campaign_criterion_ids: [a_kind_of(Integer)],
25
- nested_partial_errors: ""
26
- )
27
- end
28
- end
29
-
30
- describe "#delete_campaign_criterions" do
31
- it "returns no errors" do
32
- response = add_campaign_criterions(191)
33
-
34
- expect(api.campaign_management.call(:delete_campaign_criterions,
35
- campaign_criterion_ids: [
36
- {long: response[:campaign_criterion_ids].first}
37
- ],
38
- campaign_id: Examples.campaign_id,
39
- criterion_type: "Targets")).to eq(
40
- partial_errors: ""
41
- )
42
- end
43
- end
44
-
45
- describe "#get_campaign_criterions_by_ids" do
46
- it "returns CampaignCriterions" do
47
- response = add_campaign_criterions(193)
48
- criterion_id = response[:campaign_criterion_ids].first.to_s
49
-
50
- criterions = api.campaign_management.get_campaign_criterions_by_ids(
51
- campaign_criterion_ids: [{long: criterion_id}],
52
- campaign_id: Examples.campaign_id,
53
- criterion_type: "Age DayTime Device Gender Location LocationIntent Radius"
54
- )
55
-
56
- expect(criterions).to include(
57
- campaign_id: Examples.campaign_id.to_s,
58
- criterion: {
59
- type: "LocationCriterion",
60
- display_name: a_kind_of(String),
61
- enclosed_location_ids: nil,
62
- location_id: "193",
63
- location_type: a_kind_of(String)
64
- },
65
- forward_compatibility_map: nil,
66
- id: criterion_id,
67
- status: a_kind_of(String),
68
- type: "NegativeCampaignCriterion"
69
- )
70
- end
71
- end
72
- end
@@ -1,70 +0,0 @@
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
- end
58
-
59
- it "returns no errors" do
60
- is_expected.to eq(partial_errors: "")
61
- updated_campaign = api.campaign_management.get_campaigns_by_ids(
62
- account_id: Examples.account_id,
63
- campaign_ids: [{long: Examples.campaign_id}]
64
- ).first
65
-
66
- expect(updated_campaign).to include(name: "Acceptance Test Campaign - #{random}")
67
- end
68
- end
69
- end
70
- end
@@ -1,70 +0,0 @@
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
- })).to eq(partial_errors: "", inherited_bid_strategy_types: nil)
59
-
60
- ad_group = api.campaign_management.get_ad_groups_by_ids(
61
- campaign_id: Examples.campaign_id,
62
- ad_group_ids: [{long: Examples.ad_group_id}]
63
- ).first
64
-
65
- expect(ad_group).to include(
66
- name: "AcceptanceTestAdGroup - #{random}"
67
- )
68
- end
69
- end
70
- end
@@ -1,110 +0,0 @@
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
- end
26
-
27
- def get_ads
28
- api.campaign_management.get_ads_by_ad_group_id(
29
- ad_group_id: Examples.ad_group_id,
30
- ad_types: [
31
- {ad_type: "Text"},
32
- {ad_type: "Image"},
33
- {ad_type: "Product"},
34
- {ad_type: "AppInstall"},
35
- {ad_type: "ExpandedText"},
36
- {ad_type: "DynamicSearch"}
37
- ]
38
- )
39
- end
40
-
41
- describe "#add_ads" do
42
- it "returns created Ad ids" do
43
- expect(add_ads).to include(
44
- ad_ids: [a_kind_of(Integer)],
45
- partial_errors: ""
46
- )
47
- end
48
- end
49
-
50
- describe "#get_ads_by_ad_group_id" do
51
- before { add_ads }
52
-
53
- it "returns a list of ads" do
54
- expect(get_ads).to include(
55
- {
56
- ad_format_preference: a_kind_of(String),
57
- device_preference: a_kind_of(String),
58
- editorial_status: a_kind_of(String),
59
- final_app_urls: nil,
60
- final_mobile_urls: nil,
61
- final_urls: a_kind_of(Hash),
62
- final_url_suffix: nil,
63
- forward_compatibility_map: "",
64
- id: a_kind_of(String),
65
- status: a_kind_of(String),
66
- tracking_url_template: a_kind_of(String),
67
- type: "ExpandedText",
68
- url_custom_parameters: nil,
69
- domain: a_kind_of(String),
70
- path1: a_kind_of(String),
71
- path2: a_kind_of(String),
72
- text: a_kind_of(String),
73
- text_part2: "",
74
- title_part1: a_kind_of(String),
75
- title_part2: a_kind_of(String),
76
- title_part3: ""
77
- }
78
- )
79
- end
80
- end
81
-
82
- describe "#update_ads" do
83
- before { add_ads }
84
-
85
- it "updates the Ad" do
86
- expect(api.campaign_management.call(:update_ads,
87
- ad_group_id: Examples.ad_group_id,
88
- ads: {
89
- expanded_text_ad: [{
90
- id: get_ads.first[:id],
91
- text: "Ad text goes here - #{random}"
92
- }]
93
- })).to eq(partial_errors: "")
94
-
95
- expect(get_ads.first).to include(text: "Ad text goes here - #{random}")
96
- end
97
- end
98
-
99
- describe "test_delete_ads" do
100
- let(:ad_id) { add_ads[:ad_ids].first }
101
-
102
- it "returns no errors" do
103
- expect(api.campaign_management.call(:delete_ads,
104
- ad_group_id: Examples.ad_group_id,
105
- ad_ids: [long: ad_id])).to eq(partial_errors: "")
106
-
107
- expect(get_ads.map { |h| h[:id] }).not_to include ad_id.to_s
108
- end
109
- end
110
- end
@@ -1,105 +0,0 @@
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
- end
40
-
41
- describe "#add_keywords" do
42
- it "returns created Keyword ids" do
43
- expect(add_keywords).to include(
44
- keyword_ids: [a_kind_of(Integer)],
45
- partial_errors: ""
46
- )
47
- end
48
- end
49
-
50
- describe "#get_keywords_by_ad_group_id" do
51
- before { add_keywords }
52
-
53
- it "returns a list of keywords" do
54
- expect(api.campaign_management.get_keywords_by_ad_group_id(
55
- ad_group_id: Examples.ad_group_id
56
- )).to include(a_keyword)
57
- end
58
- end
59
-
60
- describe "#get_keywords_by_editorial_status" do
61
- before { add_keywords }
62
-
63
- it "returns a list of Keywords" do
64
- expect(api.campaign_management.get_keywords_by_editorial_status(
65
- ad_group_id: Examples.ad_group_id,
66
- editorial_status: "Active"
67
- )).to include(a_keyword)
68
- end
69
- end
70
-
71
- describe "#get_keywords_by_ids" do
72
- before { add_keywords }
73
-
74
- it "returns a list of Keywords" do
75
- expect(api.campaign_management.get_keywords_by_ids(
76
- ad_group_id: Examples.ad_group_id,
77
- keyword_ids: [{long: keyword_id}]
78
- )).to include(a_keyword)
79
- end
80
- end
81
-
82
- describe "#update_keywords" do
83
- before { add_keywords }
84
-
85
- it "updates the keyword" do
86
- expect(api.campaign_management.call(:update_keywords,
87
- ad_group_id: Examples.ad_group_id,
88
- keywords: {keyword: [
89
- id: keyword_id,
90
- bid: {amount: 0.50}
91
- ]})).to include(partial_errors: "")
92
- end
93
- end
94
-
95
- describe "#delete_keywords" do
96
- before { add_keywords }
97
-
98
- it "returns no errors" do
99
- expect(api.campaign_management.call(:delete_keywords,
100
- ad_group_id: Examples.ad_group_id,
101
- keyword_ids: [{long: keyword_id}])).to eq(partial_errors: "")
102
- end
103
- end
104
- end
105
- end