blurb 0.4.11 → 0.4.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59cbfa18a906ad112e395e90863307cba7a8a9f17a026dbfa570d05b465d5455
4
- data.tar.gz: 470cf50b215a94e0e7931536ffb0bd39bd4f781b855c173cea34b5693cee00ad
3
+ metadata.gz: f51804779721ce8f8d372f54e8d81b4a04595803cefe311407d2ee8dbb445789
4
+ data.tar.gz: 7962d3726afd7d7fbdcd8d7cf8721bf8b8db483ea5c8abb9540fa0cc7e65c62e
5
5
  SHA512:
6
- metadata.gz: 0f3e692778788cba4ea980aecefcf00845a4bdfdda3c3f53ff7f753ec01a2075a3ea64efe82e8a71b1a30aeecaeacda72b316166a56f2ce1602ea51463d096da
7
- data.tar.gz: d69904e7775f70493fabcf9d329d9a2f57389016097703e7634ed46d28719cc28baf6fc9f7f337f06fa2515af3f7c11d3c56211c01b0708f05caee20e7894938
6
+ metadata.gz: 2ed1f87374153e5064b0112cdec7ecf74b1e7078ab2197315fdb6429afbaeb0ce57ee824232cfefa19357d3e1698544794b77dad44d355370a2dd6dbc0bba8b0
7
+ data.tar.gz: af34fd65630827543685bf9f7367bae7bf44b3b904f3958892e42b0bc0c1d50dc6cf45b121540021e69648b80a0eb7b753aab3a30a4ef6e34a392215998fcc4e
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "blurb"
7
- spec.version = "0.4.11"
7
+ spec.version = "0.4.12"
8
8
  spec.authors = ["dlbunker", "eamigo13", "smithworx"]
9
9
  spec.email = ["evan@pattern.com"]
10
10
 
@@ -0,0 +1,23 @@
1
+ require 'blurb/request_collection_with_campaign_type'
2
+
3
+ class Blurb
4
+ class CampaignRequests < RequestCollectionWithCampaignType
5
+ def create_bulk(create_array)
6
+ create_array = map_campaign_payload(create_array)
7
+ super(create_array)
8
+ end
9
+
10
+ def update_bulk(update_array)
11
+ update_array = map_campaign_payload(update_array)
12
+ super(update_array)
13
+ end
14
+
15
+ private
16
+
17
+ def map_campaign_payload(payload)
18
+ campaign_type_string = "sponsoredProducts" if @campaign_type == CAMPAIGN_TYPE_CODES[:sp]
19
+ campaign_type_string = "sponsoredBrands" if @campaign_type == CAMPAIGN_TYPE_CODES[:sb]
20
+ payload.each{ |p| p[:campaign_type] = campaign_type_string }
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,5 @@
1
1
  require "blurb/account"
2
+ require "blurb/campaign_requests"
2
3
  require "blurb/snapshot_requests"
3
4
  require "blurb/report_requests"
4
5
  require "blurb/request_collection"
@@ -23,13 +24,13 @@ class Blurb
23
24
  @profile_id = profile_id
24
25
  @account = account
25
26
 
26
- @sp_campaigns = RequestCollectionWithCampaignType.new(
27
+ @sp_campaigns = CampaignRequests.new(
27
28
  headers: headers_hash,
28
29
  base_url: @account.api_url,
29
30
  resource: "campaigns",
30
31
  campaign_type: CAMPAIGN_TYPE_CODES[:sp]
31
32
  )
32
- @sb_campaigns = RequestCollectionWithCampaignType.new(
33
+ @sb_campaigns = CampaignRequests.new(
33
34
  headers: headers_hash,
34
35
  base_url: @account.api_url,
35
36
  resource: "campaigns",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blurb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - dlbunker
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2020-02-11 00:00:00.000000000 Z
13
+ date: 2020-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -175,6 +175,7 @@ files:
175
175
  - lib/blurb.rb
176
176
  - lib/blurb/account.rb
177
177
  - lib/blurb/base_class.rb
178
+ - lib/blurb/campaign_requests.rb
178
179
  - lib/blurb/client.rb
179
180
  - lib/blurb/errors/failed_request.rb
180
181
  - lib/blurb/errors/invalid_report_request.rb