blurb 0.4.8 → 0.4.10

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: 92ab9498ffa51bc559bac7ee7b4294bef3b0f8f106c5375531af20f8ae026649
4
- data.tar.gz: b7709d612fecbeb4bbd634a716fae4b259ea9d77a0bf4701125856cf90b5726b
3
+ metadata.gz: bb8a77bc06c25df00e88026b3e985ed7a0e0433fb8fc1b40d6428093f67f16bb
4
+ data.tar.gz: 13546fe28f1bcbfad9e12ea5f10391f0475442bfc5778950e4f12fa467369252
5
5
  SHA512:
6
- metadata.gz: 4e0e4ac917c156469d58b9bc9a33fa63f94cf88e79cbaf90bd999536a89773cf47ba460acb8e538fb180e583e0a6f7e52240623aec120a39aa9f3d3fc69cbc49
7
- data.tar.gz: e9d09bbc20847bfe92d177e87cfb689bc5a6c59e89fd7d0928e4b27051574b656639027236130d24c71c57e28e906cdd898a5f138bf86805a0936347ba45661e
6
+ metadata.gz: c123896ed5fd75c9f976787573548bcf61073e4cd98f8e1e7336e632ce3da2913cd16cdb46c1d1e5c0844d0419482d0194b36afb743c35621857f3c67048cd4c
7
+ data.tar.gz: 519a8ea21f110695d82d7738b5178ca1473690bce6f99143caa38ab73029de64421caabea6888a716ecc088f6902dbd11f3467598c046ad5e018b54270857e69
@@ -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.8"
7
+ spec.version = "0.4.10"
8
8
  spec.authors = ["dlbunker", "eamigo13", "smithworx"]
9
9
  spec.email = ["evan@pattern.com"]
10
10
 
@@ -27,13 +27,15 @@ class Blurb
27
27
  headers: headers_hash,
28
28
  base_url: @account.api_url,
29
29
  resource: "campaigns",
30
- campaign_type: CAMPAIGN_TYPE_CODES[:sp]
30
+ campaign_type: CAMPAIGN_TYPE_CODES[:sp],
31
+ bulk_api_limit: 10
31
32
  )
32
33
  @sb_campaigns = RequestCollectionWithCampaignType.new(
33
34
  headers: headers_hash,
34
35
  base_url: @account.api_url,
35
36
  resource: "campaigns",
36
- campaign_type: CAMPAIGN_TYPE_CODES[:sb]
37
+ campaign_type: CAMPAIGN_TYPE_CODES[:sb],
38
+ bulk_api_limit: 10
37
39
  )
38
40
  @sp_keywords = RequestCollectionWithCampaignType.new(
39
41
  headers: headers_hash,
@@ -4,9 +4,10 @@ require "blurb/base_class"
4
4
  class Blurb
5
5
  class RequestCollection < BaseClass
6
6
 
7
- def initialize(headers:, base_url:)
7
+ def initialize(headers:, base_url:, bulk_api_limit: 100)
8
8
  @base_url = base_url
9
9
  @headers = headers
10
+ @api_limit = bulk_api_limit
10
11
  end
11
12
 
12
13
  def list(url_params=nil)
@@ -46,7 +47,6 @@ class Blurb
46
47
  execute_bulk_request(
47
48
  request_type: :post,
48
49
  payload: create_array,
49
- api_limit: 100
50
50
  )
51
51
  end
52
52
 
@@ -58,7 +58,6 @@ class Blurb
58
58
  execute_bulk_request(
59
59
  request_type: :put,
60
60
  payload: update_array,
61
- api_limit: 100
62
61
  )
63
62
  end
64
63
 
@@ -86,9 +85,9 @@ class Blurb
86
85
  end
87
86
 
88
87
  # Split up bulk requests to match the api limit
89
- def execute_bulk_request(api_limit:, **execute_request_params)
88
+ def execute_bulk_request(**execute_request_params)
90
89
  results = []
91
- payloads = execute_request_params[:payload].each_slice(api_limit).to_a
90
+ payloads = execute_request_params[:payload].each_slice(@api_limit).to_a
92
91
  payloads.each do |p|
93
92
  execute_request_params[:payload] = p
94
93
  results << execute_request(execute_request_params)
@@ -3,10 +3,11 @@ require 'blurb/request_collection'
3
3
  class Blurb
4
4
  class RequestCollectionWithCampaignType < RequestCollection
5
5
 
6
- def initialize(campaign_type:, resource:, base_url:, headers:)
6
+ def initialize(campaign_type:, resource:, base_url:, headers:, bulk_api_limit: 100)
7
7
  @campaign_type = campaign_type
8
8
  @base_url = "#{base_url}/v2/#{@campaign_type}/#{resource}"
9
9
  @headers = headers
10
+ @api_limit = bulk_api_limit
10
11
  end
11
12
  end
12
13
  end
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.8
4
+ version: 0.4.10
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-10 00:00:00.000000000 Z
13
+ date: 2020-02-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler