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 +4 -4
- data/blurb.gemspec +1 -1
- data/lib/blurb/profile.rb +4 -2
- data/lib/blurb/request_collection.rb +4 -5
- data/lib/blurb/request_collection_with_campaign_type.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8a77bc06c25df00e88026b3e985ed7a0e0433fb8fc1b40d6428093f67f16bb
|
4
|
+
data.tar.gz: 13546fe28f1bcbfad9e12ea5f10391f0475442bfc5778950e4f12fa467369252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c123896ed5fd75c9f976787573548bcf61073e4cd98f8e1e7336e632ce3da2913cd16cdb46c1d1e5c0844d0419482d0194b36afb743c35621857f3c67048cd4c
|
7
|
+
data.tar.gz: 519a8ea21f110695d82d7738b5178ca1473690bce6f99143caa38ab73029de64421caabea6888a716ecc088f6902dbd11f3467598c046ad5e018b54270857e69
|
data/blurb.gemspec
CHANGED
data/lib/blurb/profile.rb
CHANGED
@@ -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(
|
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.
|
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-
|
13
|
+
date: 2020-02-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|