bing-ads 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9d2c1ad3927817aea14d5e9fbca74bc0fe8e215
4
- data.tar.gz: 4164a03a0cc8d5c7b66cf617f9bed9199746f7ff
3
+ metadata.gz: 2089287da01bbb3bae3202c1f09f59d1b0c278c4
4
+ data.tar.gz: 487814f5d5585592fef4743e279fa12ddbc406c9
5
5
  SHA512:
6
- metadata.gz: ee7c3c7677cb20105428728338d5cb5aab2e2fbc6362dca244566f9b02d05b50e178f4e7c7e9d190f2714e1d63baaf34bef4195c5bd7bdf487dcea992205b511
7
- data.tar.gz: 984bd0bcd26fbe5372c03cf49f10aae4199142aea929872a4ef01f3a4e59933b094771d113cd98170562cde3722cb4b9e4cea947bd8e21d0f8e911ae7109e1d1
6
+ metadata.gz: 710a7812ad2196d8c5e64494388c47fc3ae9387f3b6fdb23eba7019069f3039f3a0eb660e93ba9ec69506c4214f5d8cf1448fdb144d3900852ae6628a120fba8
7
+ data.tar.gz: 197888a9dfd693655cd154315108ca7418c7298e1f4a2f07d80813bf6631049aefe7449b7e2eaf644e3c6351b797c48395a1527783c8afd20de32fdfd1e9d14d
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://img.shields.io/gem/v/bing-ads.svg)](https://rubygems.org/gems/bing-ads)
2
+
1
3
  # Bing::Ads
2
4
 
3
5
  A Ruby client for Bing Ads API that includes a proxy to all Bing Ads API web services and abstracts low level details of authentication with OAuth.
@@ -38,7 +40,7 @@ options = {
38
40
  service = Bing::Ads::API::V11::Services::CampaignManagement.new(options)
39
41
  ```
40
42
 
41
- #### Getting campaigns in account
43
+ #### Getting campaigns
42
44
  ```ruby
43
45
  account_id = 5278183
44
46
  response = service.get_campaigns_by_account_id(account_id)
@@ -92,20 +94,20 @@ response = service.delete_campaigns(account_id, campaign_ids_to_delete)
92
94
 
93
95
  ---
94
96
 
95
- #### Getting ad groups in campaign
97
+ #### Getting ad groups in a campaign
96
98
  ```ruby
97
99
  campaign_id = 813721838
98
100
  response = service.get_ad_groups_by_campaign_id(campaign_id)
99
101
  ```
100
102
 
101
- #### Getting ad groups in campaign by ids
103
+ #### Getting ad groups in a campaign by ids
102
104
  ```ruby
103
105
  campaign_id = 813721838
104
106
  ad_group_ids = [9866221838, 9866221813, 9866221911]
105
107
  response = service.get_ad_groups_by_ids(campaign_id, ad_group_ids)
106
108
  ```
107
109
 
108
- #### Adding ad groups to campaign
110
+ #### Adding ad groups to a campaign
109
111
  ```ruby
110
112
  # You can add a maximum of 1,000 ad groups in a single call.
111
113
  # Each campaign can have up to 20,000 ad groups.
@@ -132,7 +134,7 @@ ad_groups = [
132
134
  response = service.add_ad_groups(campaign_id, ad_groups)
133
135
  ```
134
136
 
135
- #### Updating ad groups in campaign
137
+ #### Updating ad groups in a campaign
136
138
  ```ruby
137
139
  # You can add a maximum of 1,000 ad groups in a single call.
138
140
  # Each campaign can have up to 20,000 ad groups.
@@ -148,22 +150,29 @@ ad_groups = [
148
150
  response = service.update_ad_groups(campaign_id, ad_groups)
149
151
  ```
150
152
 
153
+ #### Deleting ad groups from a campaign
154
+ ```ruby
155
+ campaign_id = 813721838
156
+ ad_group_ids_to_delete = [9866221838, 9866221839, 9866221840]
157
+ response = service.delete_ad_groups(campaign_id, ad_group_ids_to_delete)
158
+ ```
159
+
151
160
  ---
152
161
 
153
- #### Getting ads in ad group
162
+ #### Getting ads in an ad group
154
163
  ```ruby
155
164
  ad_group_id = 9866221838
156
165
  response = service.get_ads_by_ad_group_id(ad_group_id)
157
166
  ```
158
167
 
159
- #### Getting ads in ad group by ids
168
+ #### Getting ads in an ad group by ids
160
169
  ```ruby
161
170
  ad_group_id = 9866221838
162
171
  ad_ids = [454873284248, 454873284249, 454873284250]
163
172
  response = service.get_ads_by_ids(ad_group_id, ad_ids)
164
173
  ```
165
174
 
166
- #### Adding ads to ad group
175
+ #### Adding ads to an ad group
167
176
  ```ruby
168
177
  # You can add a maximum of 50 ads in an ad group.
169
178
  ad_group_id = 9866221838
@@ -191,7 +200,7 @@ expanded_text_ads = [
191
200
  response = service.add_ads(ad_group_id, expanded_text_ads)
192
201
  ```
193
202
 
194
- #### Updating ads in ad group
203
+ #### Updating ads in an ad group
195
204
  ```ruby
196
205
  ad_group_id = 9866221838
197
206
  updated_expanded_text_ads = [
@@ -207,22 +216,29 @@ updated_expanded_text_ads = [
207
216
  response = service.update_ads(ad_group_id, updated_expanded_text_ads)
208
217
  ```
209
218
 
219
+ #### Deleting ads from an ad group
220
+ ```ruby
221
+ ad_group_id = 9866221838
222
+ ad_ids_to_delete = [454873284248, 454873284249, 454873284250]
223
+ response = service.delete_ads(ad_group_id, ad_ids_to_delete)
224
+ ```
225
+
210
226
  ---
211
227
 
212
- #### Getting keywords in ad group
228
+ #### Getting keywords in an ad group
213
229
  ```ruby
214
230
  ad_group_id = 9866221838
215
231
  response = service.get_keywords_by_ad_group_id(ad_group_id)
216
232
  ```
217
233
 
218
- #### Getting keywords in ad group by ids
234
+ #### Getting keywords in an ad group by ids
219
235
  ```ruby
220
236
  ad_group_id = 9866221838
221
237
  keyword_ids = [234873284248, 234873284249, 234873284250]
222
238
  response = service.get_keywords_by_ids(ad_group_id, keyword_ids)
223
239
  ```
224
240
 
225
- #### Adding keywords to ad group
241
+ #### Adding keywords to an ad group
226
242
  ```ruby
227
243
  ad_group_id = 9866221838
228
244
  keywords = [
@@ -247,7 +263,7 @@ keywords = [
247
263
  response = service.add_keywords(ad_group_id, keywords)
248
264
  ```
249
265
 
250
- #### Updating keywords in ad group
266
+ #### Updating keywords in an ad group
251
267
  ```ruby
252
268
  ad_group_id = 9866221838
253
269
  updated_keywords = [
@@ -261,6 +277,13 @@ updated_keywords = [
261
277
  response = service.update_keywords(ad_group_id, updated_keywords)
262
278
  ```
263
279
 
280
+ #### Deleting keywords from an ad group
281
+ ```ruby
282
+ ad_group_id = 9866221838
283
+ keyword_ids_to_delete = [234873284248, 234873284249, 234873284250]
284
+ response = service.delete_keywords(ad_group_id, keyword_ids_to_delete)
285
+ ```
286
+
264
287
  ### Bulk Service
265
288
  Not yet supported
266
289
 
@@ -271,10 +294,11 @@ Not yet supported
271
294
  Not yet supported. Use: https://github.com/FindHotel/bing-ads-reporting
272
295
 
273
296
  ## Development
274
-
275
297
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
276
298
  To install this gem onto your local machine, run `bundle exec rake install`.
277
299
 
278
- ## Contributing
300
+ ## Tests
301
+ Endpoints were manually tested but although RSpec is installed as a test framework, there are no tests written yet.
279
302
 
303
+ ## Contributing
280
304
  Bug reports and pull requests are welcome on GitHub at https://github.com/FindHotel/bing-ads.
@@ -39,6 +39,7 @@ module Bing
39
39
  end
40
40
 
41
41
  def delete_campaigns(account_id, campaign_ids)
42
+ validate_limits!(:campaign, :delete, campaign_ids)
42
43
  payload = {
43
44
  account_id: account_id,
44
45
  campaign_ids: { 'ins1:long' => campaign_ids }
@@ -86,6 +87,16 @@ module Bing
86
87
  response_body(response, __method__)
87
88
  end
88
89
 
90
+ def delete_ad_groups(campaign_id, ad_group_ids)
91
+ validate_limits!(:ad_group, :delete, ad_group_ids)
92
+ payload = {
93
+ campaign_id: campaign_id,
94
+ ad_group_ids: { 'ins1:long' => ad_group_ids }
95
+ }
96
+ response = call(:delete_ad_groups, payload)
97
+ response_body(response, __method__)
98
+ end
99
+
89
100
  def get_ads_by_ad_group_id(ad_group_id)
90
101
  payload = {
91
102
  ad_group_id: ad_group_id,
@@ -140,6 +151,16 @@ module Bing
140
151
  response_body(response, __method__)
141
152
  end
142
153
 
154
+ def delete_ads(ad_group_id, ad_ids)
155
+ validate_limits!(:ad, :delete, ad_ids)
156
+ payload = {
157
+ ad_group_id: ad_group_id,
158
+ ad_ids: { 'ins1:long' => ad_ids }
159
+ }
160
+ response = call(:delete_ads, payload)
161
+ response_body(response, __method__)
162
+ end
163
+
143
164
  def get_keywords_by_ad_group_id(ad_group_id)
144
165
  response = call(:get_keywords_by_ad_group_id, ad_group_id: ad_group_id)
145
166
  response_body = response_body(response, __method__)
@@ -178,6 +199,16 @@ module Bing
178
199
  response_body(response, __method__)
179
200
  end
180
201
 
202
+ def delete_keywords(ad_group_id, keyword_ids)
203
+ validate_limits!(:keyword, :delete, keyword_ids)
204
+ payload = {
205
+ ad_group_id: ad_group_id,
206
+ keyword_ids: { 'ins1:long' => keyword_ids }
207
+ }
208
+ response = call(:delete_keywords, payload)
209
+ response_body(response, __method__)
210
+ end
211
+
181
212
  # TODO add_ad_extensions
182
213
  # TODO add_ad_group_criterions
183
214
  # TODO add_audiences
@@ -195,8 +226,6 @@ module Bing
195
226
  # TODO apply_product_partition_actions
196
227
  # TODO delete_ad_extensions
197
228
  # TODO delete_ad_group_criterions
198
- # TODO delete_ad_groups
199
- # TODO delete_ads
200
229
  # TODO delete_audiences
201
230
  # TODO delete_budgets
202
231
  # TODO delete_campaign_criterions
@@ -314,7 +343,9 @@ module Bing
314
343
 
315
344
  def prepare_keyword(keyword)
316
345
  keyword = Bing::Ads::Utils.sort_keys(keyword)
317
- keyword[:bid] = { amount: keyword[:bid] } if keyword[:bid]
346
+ # To use the AdGroup default match type bid,
347
+ # set the Amount element of the Bid object to null.
348
+ keyword[:bid] = { amount: keyword[:bid] }
318
349
  if keyword[:bidding_scheme]
319
350
  # TODO support MaxClicksBiddingScheme, MaxConversionsBiddingScheme and TargetCpaBiddingScheme
320
351
  keyword[:bidding_scheme] = {
@@ -1,5 +1,5 @@
1
1
  module Bing
2
2
  module Ads
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bing-ads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - oss92
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-07 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon