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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -19
  3. data/.github/.keep +0 -0
  4. data/.github/renovate.json +225 -0
  5. data/Gemfile +2 -0
  6. data/Rakefile +4 -4
  7. data/bing_ads_ruby_sdk.gemspec +25 -27
  8. data/changelog.md +10 -0
  9. data/lib/bing_ads_ruby_sdk/api.rb +3 -6
  10. data/lib/bing_ads_ruby_sdk/augmented_parser.rb +0 -1
  11. data/lib/bing_ads_ruby_sdk/configuration.rb +1 -1
  12. data/lib/bing_ads_ruby_sdk/errors/error_handler.rb +1 -1
  13. data/lib/bing_ads_ruby_sdk/errors/errors.rb +9 -10
  14. data/lib/bing_ads_ruby_sdk/header.rb +3 -3
  15. data/lib/bing_ads_ruby_sdk/http_client.rb +6 -6
  16. data/lib/bing_ads_ruby_sdk/log_message.rb +2 -3
  17. data/lib/bing_ads_ruby_sdk/oauth2/authorization_handler.rb +24 -21
  18. data/lib/bing_ads_ruby_sdk/oauth2/fs_store.rb +2 -2
  19. data/lib/bing_ads_ruby_sdk/postprocessors/cast_long_arrays.rb +2 -3
  20. data/lib/bing_ads_ruby_sdk/postprocessors/snakize.rb +2 -3
  21. data/lib/bing_ads_ruby_sdk/preprocessors/camelize.rb +3 -4
  22. data/lib/bing_ads_ruby_sdk/preprocessors/order.rb +2 -3
  23. data/lib/bing_ads_ruby_sdk/services/ad_insight.rb +1 -2
  24. data/lib/bing_ads_ruby_sdk/services/base.rb +13 -10
  25. data/lib/bing_ads_ruby_sdk/services/bulk.rb +1 -2
  26. data/lib/bing_ads_ruby_sdk/services/campaign_management.rb +2 -5
  27. data/lib/bing_ads_ruby_sdk/services/customer_billing.rb +1 -2
  28. data/lib/bing_ads_ruby_sdk/services/customer_management.rb +1 -2
  29. data/lib/bing_ads_ruby_sdk/services/reporting.rb +1 -2
  30. data/lib/bing_ads_ruby_sdk/soap_client.rb +11 -17
  31. data/lib/bing_ads_ruby_sdk/string_utils.rb +6 -7
  32. data/lib/bing_ads_ruby_sdk/version.rb +1 -1
  33. data/lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb +0 -1
  34. data/lib/bing_ads_ruby_sdk.rb +10 -9
  35. data/spec/bing_ads_ruby_sdk/api_spec.rb +3 -3
  36. data/spec/bing_ads_ruby_sdk/errors/error_handler_spec.rb +112 -114
  37. data/spec/bing_ads_ruby_sdk/errors/errors_spec.rb +4 -4
  38. data/spec/bing_ads_ruby_sdk/header_spec.rb +22 -22
  39. data/spec/bing_ads_ruby_sdk/http_client_spec.rb +3 -5
  40. data/spec/bing_ads_ruby_sdk/oauth2/fs_store_spec.rb +2 -3
  41. data/spec/bing_ads_ruby_sdk/postprocessors/cast_long_arrays_spec.rb +4 -5
  42. data/spec/bing_ads_ruby_sdk/postprocessors/snakize_spec.rb +1 -2
  43. data/spec/bing_ads_ruby_sdk/preprocessors/camelize_spec.rb +1 -2
  44. data/spec/bing_ads_ruby_sdk/preprocessors/order_spec.rb +87 -76
  45. data/spec/bing_ads_ruby_sdk/services/bulk_spec.rb +7 -12
  46. data/spec/bing_ads_ruby_sdk/services/campaign_management_spec.rb +74 -67
  47. data/spec/bing_ads_ruby_sdk/services/customer_management_spec.rb +22 -23
  48. data/spec/examples/1_customer_creation/customer_spec.rb +11 -11
  49. data/spec/examples/2_with_customer/budget_spec.rb +19 -21
  50. data/spec/examples/2_with_customer/campaigns_spec.rb +9 -10
  51. data/spec/examples/2_with_customer/customer_management_spec.rb +37 -39
  52. data/spec/examples/2_with_customer/uet_tags_spec.rb +14 -14
  53. data/spec/examples/3_with_uet_tag/conversion_goal_spec.rb +19 -19
  54. data/spec/examples/3_with_uet_tag/uet_tags_spec.rb +15 -15
  55. data/spec/examples/4_with_conversion_goal/conversion_goals_spec.rb +23 -22
  56. data/spec/examples/5_with_campaign/ad_extension_spec.rb +20 -23
  57. data/spec/examples/5_with_campaign/ad_group_spec.rb +14 -15
  58. data/spec/examples/5_with_campaign/campaign_criterions_spec.rb +21 -23
  59. data/spec/examples/5_with_campaign/campaign_spec.rb +17 -18
  60. data/spec/examples/6_with_ad_group/ad_group_spec.rb +19 -20
  61. data/spec/examples/6_with_ad_group/ads_spec.rb +38 -41
  62. data/spec/examples/6_with_ad_group/keywords_spec.rb +29 -32
  63. data/spec/examples/examples.rb +3 -4
  64. data/spec/spec_helper.rb +10 -10
  65. data/spec/support/spec_helpers.rb +10 -9
  66. data/tasks/bing_ads_ruby_sdk.rake +7 -8
  67. metadata +8 -84
  68. data/.github/delete-merged-branch-config.yml +0 -6
  69. data/.github/stale.yml +0 -19
@@ -1,20 +1,20 @@
1
- require_relative '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'Conversion goals methods' do
4
- include_context 'use api'
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('Acceptance Test Conversion goal'),
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: 'Event',
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 '#get_conversion_goals_by_ids' do
31
- it 'returns a list of conversion goals' do
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: 'Event',
34
- conversion_goal_ids: [{ long: Examples.conversion_goal_id }]
35
- )).to contain_exactly(a_conversion_goal)
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 '#get_conversion_goals_by_tag_ids' do
40
- it 'returns a list of conversion_goals' do
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: 'Event',
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 '#update_conversion_goals' do
54
- it 'updates the conversion goals' do
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
- ).to eq(partial_errors: '')
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: 'Event',
67
- conversion_goal_ids: [{ long: Examples.conversion_goal_id }]
68
- ).first
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 '../examples'
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: [ { string: "http://mobile.example.com" } ],
30
- final_urls: [ { string: "http://www.example.com" } ],
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: [{ long: Examples.campaign_id }]
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
- # we use a global var to create ad extensions once, its enough
71
- $created_ad_extension_response = create_add_ad_extensions
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($created_ad_extension_response).to include(
76
+ expect(@created_ad_extension_response).to include(
78
77
  ad_extension_identities: {
79
78
  ad_extension_identity: [
80
- { id: a_kind_of(String), version: "1" },
81
- { id: a_kind_of(String), version: "1" },
82
- { id: a_kind_of(String), version: "1" },
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.select { |record| record[:ad_extension][:type] == type }.first
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: 'SitelinkAdExtension CallAdExtension CalloutAdExtension'
184
+ ad_extension_type: "SitelinkAdExtension CallAdExtension CalloutAdExtension"
186
185
  )
187
- ad_extension_ids($created_ad_extension_response).each do |id|
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($created_ad_extension_response).map { |id| { long: id } },
198
- ad_extension_type: 'SitelinkAdExtension CallAdExtension CalloutAdExtension'
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: [ { long: ad_extension_ids(response).first }]
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 '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'AdGroup methods' do
4
- include_context 'use api'
3
+ RSpec.describe "AdGroup methods" do
4
+ include_context "use api"
5
5
 
6
- describe '#add_ad_groups' do
7
- it 'returns created AdGroup ids' do
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: 'French',
13
+ language: "French",
14
14
  start_date: {
15
- day: '1',
16
- month: '1',
17
- year: '2049',
15
+ day: "1",
16
+ month: "1",
17
+ year: "2049"
18
18
  },
19
19
  end_date: {
20
- day: '1',
21
- month: '2',
22
- year: '2049',
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 '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'CampaignCriterion methods' do
4
- include_context 'use api'
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: 'Targets'
19
- )
18
+ criterion_type: "Targets")
20
19
  end
21
20
 
22
- describe '#add_campaign_criterions' do
23
- it 'returns CampaignCriterion ids' do
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 '#delete_campaign_criterions' do
32
- it 'returns no errors' do
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
- { long: response[:campaign_criterion_ids].first }
36
+ {long: response[:campaign_criterion_ids].first}
38
37
  ],
39
38
  campaign_id: Examples.campaign_id,
40
- criterion_type: 'Targets'
41
- )).to eq(
42
- partial_errors: ''
43
- )
39
+ criterion_type: "Targets")).to eq(
40
+ partial_errors: ""
41
+ )
44
42
  end
45
43
  end
46
44
 
47
- describe '#get_campaign_criterions_by_ids' do
48
- it 'returns CampaignCriterions' do
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: [{ long: criterion_id }],
51
+ campaign_criterion_ids: [{long: criterion_id}],
54
52
  campaign_id: Examples.campaign_id,
55
- criterion_type: 'Age DayTime Device Gender Location LocationIntent Radius'
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: 'LocationCriterion',
59
+ type: "LocationCriterion",
62
60
  display_name: a_kind_of(String),
63
61
  enclosed_location_ids: nil,
64
- location_id: '193',
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: 'NegativeCampaignCriterion'
68
+ type: "NegativeCampaignCriterion"
71
69
  )
72
70
  end
73
71
  end
@@ -1,18 +1,18 @@
1
- require_relative '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'CampaignManagement service' do
4
- include_context 'use api'
3
+ RSpec.describe "CampaignManagement service" do
4
+ include_context "use api"
5
5
 
6
- describe 'Campaign methods' do
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('Acceptance Test Campaign'),
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 '#get_campaigns_by_account_id' do
31
- it 'returns a list of campaigns' do
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 '#get_campaigns_by_ids' do
39
- it 'returns a list of campaigns' do
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: [{ long: Examples.campaign_id }]
42
+ campaign_ids: [{long: Examples.campaign_id}]
43
43
  )).to include(a_campaign_hash)
44
44
  end
45
45
  end
46
46
 
47
- describe '#update_campaigns' do
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 'returns no errors' do
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: [{ long: Examples.campaign_id }]
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 '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'AdGroup methods' do
4
- include_context 'use api'
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: '1',
18
- month: '1',
19
- year: '2049',
17
+ day: "1",
18
+ month: "1",
19
+ year: "2049"
20
20
  },
21
21
  end_date: {
22
- day: '1',
23
- month: '2',
24
- year: '2049',
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 '#get_ad_groups_by_ids' do
33
- it 'returns AdGroups' do
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: [ { long: Examples.ad_group_id } ]
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 '#get_ad_groups_by_campaign_id' do
42
- it 'returns AdGroups' do
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 '#update_ad_groups' do
50
- it 'updates the ad' do
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: [ { long: Examples.ad_group_id } ]
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 '../examples'
1
+ require_relative "../examples"
2
2
 
3
- RSpec.describe 'Ad methods' do
4
- include_context 'use api'
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: '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
- )
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
- { ad_type: 'Text' },
33
- { ad_type: 'Image' },
34
- { ad_type: 'Product' },
35
- { ad_type: 'AppInstall' },
36
- { ad_type: 'ExpandedText' },
37
- { ad_type: 'DynamicSearch' },
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 '#add_ads' do
43
- it 'returns created Ad ids' do
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 '#get_ads_by_ad_group_id' do
50
+ describe "#get_ads_by_ad_group_id" do
52
51
  before { add_ads }
53
52
 
54
- it 'returns a list of ads' do
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 '#update_ads' do
82
+ describe "#update_ads" do
84
83
  before { add_ads }
85
84
 
86
- it 'updates the Ad' do
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( text: "Ad text goes here - #{random}")
95
+ expect(get_ads.first).to include(text: "Ad text goes here - #{random}")
98
96
  end
99
97
  end
100
98
 
101
- describe 'test_delete_ads' do
99
+ describe "test_delete_ads" do
102
100
  let(:ad_id) { add_ads[:ad_ids].first }
103
101
 
104
- it 'returns no errors' do
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