blurb 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/blurb/base_resource.rb +19 -0
- data/lib/blurb/campaign.rb +3 -4
- data/lib/blurb/report.rb +65 -1
- data/lib/blurb/snapshot.rb +11 -3
- data/lib/blurb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 040ae071f23800ce24f8c7fe8602d690b6c97983
|
4
|
+
data.tar.gz: f2b702bd101e5a4f9343ceba783e801cefe07599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e46b85afb82c8351b7cd30880e4bd923dd56e18cad37772a352fb85712493591f3192b07fd1428de7d86b945745fe000680edbe57b647f2587b497416980dd
|
7
|
+
data.tar.gz: b6d4fa9ec4ef124eca1e6ed9038f028e5c0cf9dd223a93188dcba1f90852c2649ae5193d5742e30714327b12e24fb2440d42826bbecc43666c0e87486cf28128
|
data/README.md
CHANGED
@@ -202,6 +202,7 @@ Blurb::Report::CAMPAIGNS
|
|
202
202
|
Blurb::Report::AD_GROUPS
|
203
203
|
Blurb::Report::PRODUCT_ADS
|
204
204
|
Blurb::Report::ASINS
|
205
|
+
Blurb::Report::TARGETS
|
205
206
|
```
|
206
207
|
|
207
208
|
Campaign types are
|
@@ -229,6 +230,7 @@ Request a snapshot
|
|
229
230
|
```ruby
|
230
231
|
payload_response = Blurb::Snapshot.create({
|
231
232
|
"recordType" => Blurb::Snapshot::KEYWORDS,
|
233
|
+
"campaignType" => Blurb::Snapshot::SPONSORED_PRODUCTS,
|
232
234
|
"stateFilter" => "enabled,paused,archived"
|
233
235
|
})
|
234
236
|
```
|
@@ -242,6 +244,14 @@ Blurb::Snapshot::AD_GROUPS
|
|
242
244
|
Blurb::Snapshot::PRODUCT_ADS
|
243
245
|
Blurb::Snapshot::NEGATIVE_KEYWORDS
|
244
246
|
Blurb::Snapshot::CAMPAIGN_NEGATIVE_KEYWORDS
|
247
|
+
Blurb::Snapshot::TARGETS
|
248
|
+
```
|
249
|
+
|
250
|
+
Campaign types are
|
251
|
+
|
252
|
+
```ruby
|
253
|
+
Blurb::Report::SPONSORED_PRODUCTS
|
254
|
+
Blurb::Report::SPONSORED_BRANDS
|
245
255
|
```
|
246
256
|
|
247
257
|
Check snapshot status
|
data/lib/blurb/base_resource.rb
CHANGED
@@ -61,6 +61,25 @@ module Blurb
|
|
61
61
|
return make_request(request_config)
|
62
62
|
end
|
63
63
|
|
64
|
+
def self.delete_request(api_path)
|
65
|
+
access_token = Blurb::Token.retrieve()
|
66
|
+
|
67
|
+
headers_hash = {
|
68
|
+
"Authorization" => "Bearer #{access_token['access_token']}",
|
69
|
+
"Content-Type" => "application/json",
|
70
|
+
"Amazon-Advertising-API-Scope" => Blurb.profile_id,
|
71
|
+
"Amazon-Advertising-API-ClientId" => Blurb.client_id
|
72
|
+
}
|
73
|
+
|
74
|
+
request_config = {
|
75
|
+
method: :delete,
|
76
|
+
url: "#{Blurb.active_api_url}#{api_path}",
|
77
|
+
headers: headers_hash,
|
78
|
+
}
|
79
|
+
|
80
|
+
return make_request(request_config)
|
81
|
+
end
|
82
|
+
|
64
83
|
private
|
65
84
|
|
66
85
|
def self.make_request(request_config)
|
data/lib/blurb/campaign.rb
CHANGED
@@ -31,10 +31,9 @@ module Blurb
|
|
31
31
|
post_request("/v2/#{campaign_type}/campaigns", [params])
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
# end
|
34
|
+
def self.delete(campaign_id)
|
35
|
+
delete_request("/v2/campaigns/#{campaign_id}")
|
36
|
+
end
|
38
37
|
|
39
38
|
private
|
40
39
|
|
data/lib/blurb/report.rb
CHANGED
@@ -5,6 +5,7 @@ module Blurb
|
|
5
5
|
KEYWORDS = "keywords"
|
6
6
|
PRODUCT_ADS = "productAds"
|
7
7
|
ASINS = "asins"
|
8
|
+
TARGETS = "targets"
|
8
9
|
SPONSORED_PRODUCTS = "sp"
|
9
10
|
SPONSORED_BRANDS = "hsa"
|
10
11
|
|
@@ -29,7 +30,7 @@ module Blurb
|
|
29
30
|
else
|
30
31
|
request_url = "/v2/#{params["campaignType"]}/#{params["recordType"]}/report"
|
31
32
|
end
|
32
|
-
|
33
|
+
|
33
34
|
post_request(request_url, api_params)
|
34
35
|
end
|
35
36
|
|
@@ -237,6 +238,69 @@ module Blurb
|
|
237
238
|
"attributedSales14dSameSKU",
|
238
239
|
"attributedSales30dSameSKU"
|
239
240
|
].join(",") if record_type == PRODUCT_ADS
|
241
|
+
return [
|
242
|
+
"campaignName",
|
243
|
+
"campaignId",
|
244
|
+
"targetId",
|
245
|
+
"targetingExpression",
|
246
|
+
"targetingText",
|
247
|
+
"targetingType",
|
248
|
+
"impressions",
|
249
|
+
"clicks",
|
250
|
+
"cost",
|
251
|
+
"attributedConversions1d",
|
252
|
+
"attributedConversions7d",
|
253
|
+
"attributedConversions14d",
|
254
|
+
"attributedConversions30d",
|
255
|
+
"attributedConversions1dSameSKU",
|
256
|
+
"attributedConversions7dSameSKU",
|
257
|
+
"attributedConversions14dSameSKU",
|
258
|
+
"attributedConversions30dSameSKU",
|
259
|
+
"attributedUnitsOrdered1d",
|
260
|
+
"attributedUnitsOrdered7d",
|
261
|
+
"attributedUnitsOrdered14d",
|
262
|
+
"attributedUnitsOrdered30d",
|
263
|
+
"attributedSales1d",
|
264
|
+
"attributedSales7d",
|
265
|
+
"attributedSales14d",
|
266
|
+
"attributedSales30d",
|
267
|
+
"attributedSales1dSameSKU",
|
268
|
+
"attributedSales7dSameSKU",
|
269
|
+
"attributedSales14dSameSKU",
|
270
|
+
"attributedSales30dSameSKU"
|
271
|
+
].join(",") if record_type == TARGETS
|
272
|
+
return [
|
273
|
+
"campaignName",
|
274
|
+
"campaignId",
|
275
|
+
"adGroupName",
|
276
|
+
"adGroupId",
|
277
|
+
"impressions",
|
278
|
+
"clicks",
|
279
|
+
"cost",
|
280
|
+
"currency",
|
281
|
+
"asin",
|
282
|
+
"sku",
|
283
|
+
"attributedConversions1d",
|
284
|
+
"attributedConversions7d",
|
285
|
+
"attributedConversions14d",
|
286
|
+
"attributedConversions30d",
|
287
|
+
"attributedConversions1dSameSKU",
|
288
|
+
"attributedConversions7dSameSKU",
|
289
|
+
"attributedConversions14dSameSKU",
|
290
|
+
"attributedConversions30dSameSKU",
|
291
|
+
"attributedUnitsOrdered1d",
|
292
|
+
"attributedUnitsOrdered7d",
|
293
|
+
"attributedUnitsOrdered14d",
|
294
|
+
"attributedUnitsOrdered30d",
|
295
|
+
"attributedSales1d",
|
296
|
+
"attributedSales7d",
|
297
|
+
"attributedSales14d",
|
298
|
+
"attributedSales30d",
|
299
|
+
"attributedSales1dSameSKU",
|
300
|
+
"attributedSales7dSameSKU",
|
301
|
+
"attributedSales14dSameSKU",
|
302
|
+
"attributedSales30dSameSKU"
|
303
|
+
].join(",") if record_type == PORTFOLIOS
|
240
304
|
end
|
241
305
|
end
|
242
306
|
end
|
data/lib/blurb/snapshot.rb
CHANGED
@@ -6,14 +6,22 @@ module Blurb
|
|
6
6
|
NEGATIVE_KEYWORDS = "negativeKeywords"
|
7
7
|
CAMPAIGN_NEGATIVE_KEYWORDS = "campaignNegativeKeywords"
|
8
8
|
PRODUCT_ADS = "productAds"
|
9
|
+
TARGETS = "targets"
|
10
|
+
SPONSORED_PRODUCTS = "sp"
|
11
|
+
SPONSORED_BRANDS = "hsa"
|
9
12
|
|
10
13
|
def self.create(params = {}, opts = {})
|
11
14
|
# required argument checks
|
12
15
|
raise ArgumentError.new("params hash must contain a recordType") unless params["recordType"]
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
# Default State Filter if no params passed in
|
18
|
+
state_filter = params["stateFilter"] || "enabled,paused"
|
19
|
+
|
20
|
+
# Default campaign type so version 2.3 is backward compatible with version 2.2
|
21
|
+
campaign_type = params["campaignType"] || SPONSORED_PRODUCTS
|
22
|
+
|
23
|
+
post_request("/v2/#{campaign_type}/#{params["recordType"]}/snapshot", {
|
24
|
+
"stateFilter" => state_filter
|
17
25
|
})
|
18
26
|
end
|
19
27
|
|
data/lib/blurb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dlbunker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|