drip-ruby 3.4.2 → 3.5.0
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 +4 -4
- data/.github/workflows/ci.yml +35 -0
- data/.rubocop.yml +27 -6
- data/.rubocop_todo.yml +1 -97
- data/CHANGELOG.md +41 -1
- data/Gemfile +9 -8
- data/README.md +1 -2
- data/drip-ruby.gemspec +4 -4
- data/flake.lock +61 -0
- data/flake.nix +32 -0
- data/lib/drip/client/accounts.rb +3 -1
- data/lib/drip/client/broadcasts.rb +3 -1
- data/lib/drip/client/campaign_subscriptions.rb +3 -1
- data/lib/drip/client/campaigns.rb +6 -4
- data/lib/drip/client/configuration.rb +9 -1
- data/lib/drip/client/conversions.rb +3 -1
- data/lib/drip/client/forms.rb +3 -1
- data/lib/drip/client/http_client.rb +30 -11
- data/lib/drip/client/orders.rb +1 -1
- data/lib/drip/client/shopper_activity.rb +26 -2
- data/lib/drip/client/subscribers.rb +5 -4
- data/lib/drip/client/webhooks.rb +4 -2
- data/lib/drip/client/workflow_triggers.rb +5 -3
- data/lib/drip/client/workflows.rb +5 -5
- data/lib/drip/client.rb +3 -3
- data/lib/drip/collection.rb +2 -2
- data/lib/drip/resource.rb +6 -6
- data/lib/drip/resources/tag.rb +0 -5
- data/lib/drip/response.rb +21 -18
- data/lib/drip/version.rb +1 -1
- data/test/drip/client/accounts_test.rb +18 -2
- data/test/drip/client/broadcasts_test.rb +2 -2
- data/test/drip/client/campaign_subscriptions_test.rb +1 -1
- data/test/drip/client/campaigns_test.rb +5 -5
- data/test/drip/client/configuration_test.rb +14 -1
- data/test/drip/client/conversions_test.rb +2 -2
- data/test/drip/client/custom_fields_test.rb +1 -1
- data/test/drip/client/events_test.rb +1 -1
- data/test/drip/client/forms_test.rb +2 -2
- data/test/drip/client/http_client_test.rb +32 -2
- data/test/drip/client/orders_test.rb +1 -1
- data/test/drip/client/shopper_activity_test.rb +35 -1
- data/test/drip/client/subscribers_test.rb +39 -2
- data/test/drip/client/tags_test.rb +1 -1
- data/test/drip/client/users_test.rb +1 -1
- data/test/drip/client/webhooks_test.rb +1 -1
- data/test/drip/client/workflow_triggers_test.rb +2 -2
- data/test/drip/client/workflows_test.rb +18 -2
- data/test/drip/client_test.rb +8 -6
- data/test/drip/collection_test.rb +1 -1
- data/test/drip/collections/account_test.rb +1 -1
- data/test/drip/collections/broadcasts_test.rb +1 -1
- data/test/drip/collections/campaign_subscriptions_test.rb +1 -1
- data/test/drip/collections/campaigns_test.rb +1 -1
- data/test/drip/collections/errors_test.rb +1 -1
- data/test/drip/collections/orders_test.rb +1 -1
- data/test/drip/collections/purchases_test.rb +1 -1
- data/test/drip/collections/tags_test.rb +1 -1
- data/test/drip/collections/webhooks_test.rb +1 -1
- data/test/drip/collections/workflow_triggers_test.rb +1 -1
- data/test/drip/collections/workflows_test.rb +1 -1
- data/test/drip/collections_test.rb +1 -1
- data/test/drip/request_test.rb +1 -1
- data/test/drip/resource_test.rb +1 -1
- data/test/drip/resources/account_test.rb +1 -1
- data/test/drip/resources/order_test.rb +1 -1
- data/test/drip/resources/subscriber_test.rb +1 -1
- data/test/drip/resources/tag_test.rb +1 -1
- data/test/drip/resources_test.rb +1 -1
- data/test/drip/response_test.rb +1 -1
- data/test/test_helper.rb +2 -2
- metadata +10 -53
- data/.travis.yml +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../../test_helper'
|
|
4
4
|
|
|
5
5
|
class Drip::Client::SubscribersTest < Drip::TestCase
|
|
6
6
|
def setup
|
|
@@ -81,7 +81,7 @@ class Drip::Client::SubscribersTest < Drip::TestCase
|
|
|
81
81
|
|
|
82
82
|
should "allow request with drip id keyword argument" do
|
|
83
83
|
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
|
84
|
-
assert_equal expected, @client.create_or_update_subscriber(id:
|
|
84
|
+
assert_equal expected, @client.create_or_update_subscriber(id: 123_456)
|
|
85
85
|
assert_requested :post, "https://api.getdrip.com/v2/12345/subscribers", body: '{"subscribers":[{"id":123456}]}', times: 1
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -164,6 +164,25 @@ class Drip::Client::SubscribersTest < Drip::TestCase
|
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
167
|
+
context "#subscribe with a campaign id that needs escaping" do
|
|
168
|
+
setup do
|
|
169
|
+
@email = "derrick@getdrip.com"
|
|
170
|
+
@campaign_id = "abc/123 xyz"
|
|
171
|
+
@data = { "time_zone" => "America/Los_Angeles" }
|
|
172
|
+
|
|
173
|
+
@response_status = 201
|
|
174
|
+
@response_body = "{}"
|
|
175
|
+
|
|
176
|
+
stub_request(:post, "https://api.getdrip.com/v2/12345/campaigns/#{CGI.escape @campaign_id}/subscribers").
|
|
177
|
+
to_return(status: @response_status, body: @response_body, headers: {})
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
should "escape the campaign id in the request path" do
|
|
181
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
|
182
|
+
assert_equal expected, @client.subscribe(@email, @campaign_id, @data)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
167
186
|
context "#unsubscribe" do
|
|
168
187
|
context "if no campaign id is provided" do
|
|
169
188
|
setup do
|
|
@@ -199,6 +218,24 @@ class Drip::Client::SubscribersTest < Drip::TestCase
|
|
|
199
218
|
assert_equal expected, @client.unsubscribe(@id, campaign_id: @campaign)
|
|
200
219
|
end
|
|
201
220
|
end
|
|
221
|
+
|
|
222
|
+
context "if a campaign id that needs escaping is provided" do
|
|
223
|
+
setup do
|
|
224
|
+
@id = "derrick@getdrip.com"
|
|
225
|
+
@campaign = "abc/123 xyz"
|
|
226
|
+
|
|
227
|
+
@response_status = 201
|
|
228
|
+
@response_body = "{}"
|
|
229
|
+
|
|
230
|
+
stub_request(:post, "https://api.getdrip.com/v2/12345/subscribers/#{CGI.escape @id}/remove?campaign_id=#{CGI.escape @campaign}").
|
|
231
|
+
to_return(status: @response_status, body: @response_body, headers: {})
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
should "escape the campaign id in the query string" do
|
|
235
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
|
236
|
+
assert_equal expected, @client.unsubscribe(@id, campaign_id: @campaign)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
202
239
|
end
|
|
203
240
|
|
|
204
241
|
context "#unsubscribe_from_all" do
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../../test_helper'
|
|
4
4
|
|
|
5
5
|
class Drip::Client::WorkflowTriggersTest < Drip::TestCase
|
|
6
6
|
def setup
|
|
@@ -9,7 +9,7 @@ class Drip::Client::WorkflowTriggersTest < Drip::TestCase
|
|
|
9
9
|
|
|
10
10
|
context "#workflow_triggers" do
|
|
11
11
|
setup do
|
|
12
|
-
@id =
|
|
12
|
+
@id = 9_999_999
|
|
13
13
|
@response_status = 200
|
|
14
14
|
@response_body = "{}"
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../../test_helper'
|
|
4
4
|
|
|
5
5
|
class Drip::Client::WorkflowsTest < Drip::TestCase
|
|
6
6
|
def setup
|
|
@@ -38,6 +38,22 @@ class Drip::Client::WorkflowsTest < Drip::TestCase
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
context "#workflow with an id that needs escaping" do
|
|
42
|
+
setup do
|
|
43
|
+
@response_status = 200
|
|
44
|
+
@response_body = "{}"
|
|
45
|
+
@id = "abc/123 xyz"
|
|
46
|
+
|
|
47
|
+
stub_request(:get, "https://api.getdrip.com/v2/12345/workflows/#{CGI.escape @id}").
|
|
48
|
+
to_return(status: @response_status, body: @response_body, headers: {})
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
should "escape the id in the request path" do
|
|
52
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
|
53
|
+
assert_equal expected, @client.workflow(@id)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
41
57
|
context "#activate_workflow" do
|
|
42
58
|
setup do
|
|
43
59
|
@response_status = 204
|
|
@@ -76,7 +92,7 @@ class Drip::Client::WorkflowsTest < Drip::TestCase
|
|
|
76
92
|
"email" => "someone@example.com",
|
|
77
93
|
"time_zone" => "America/Los_Angeles"
|
|
78
94
|
}
|
|
79
|
-
@id =
|
|
95
|
+
@id = 9_999_999
|
|
80
96
|
@payload = { "subscribers" => [@data] }.to_json
|
|
81
97
|
|
|
82
98
|
@response_status = 204
|
data/test/drip/client_test.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require_relative '../test_helper'
|
|
4
4
|
require "base64"
|
|
5
5
|
|
|
6
6
|
class Drip::ClientTest < Drip::TestCase
|
|
@@ -43,7 +43,8 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
43
43
|
api_key: "aaaa",
|
|
44
44
|
access_token: "bbbb",
|
|
45
45
|
http_open_timeout: 20,
|
|
46
|
-
http_timeout: 25
|
|
46
|
+
http_timeout: 25,
|
|
47
|
+
skip_analytics: true
|
|
47
48
|
)
|
|
48
49
|
|
|
49
50
|
assert_equal "1234567", client.account_id
|
|
@@ -51,6 +52,7 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
51
52
|
assert_equal "bbbb", client.access_token
|
|
52
53
|
assert_equal 20, client.http_open_timeout
|
|
53
54
|
assert_equal 25, client.http_timeout
|
|
55
|
+
assert client.skip_analytics, "config should skip analytics"
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
should "accept options after initialization" do
|
|
@@ -65,7 +67,7 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
65
67
|
setup do
|
|
66
68
|
@client = Drip::Client.new do |config|
|
|
67
69
|
config.api_key = "Hello world"
|
|
68
|
-
config.account_id =
|
|
70
|
+
config.account_id = 12_345
|
|
69
71
|
end
|
|
70
72
|
end
|
|
71
73
|
|
|
@@ -112,7 +114,7 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
112
114
|
should "return a resource and note deprecation" do
|
|
113
115
|
client = Drip::Client.new
|
|
114
116
|
resource = nil
|
|
115
|
-
assert_output(nil, /^\[DEPRECATED\] Drip
|
|
117
|
+
assert_output(nil, /^\[DEPRECATED\] Drip::Client\#generate_resource is deprecated/) { resource = client.generate_resource("hello", {}) }
|
|
116
118
|
assert_equal({ "hello" => [{}] }, resource)
|
|
117
119
|
end
|
|
118
120
|
end
|
|
@@ -122,7 +124,7 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
122
124
|
should "return default content type and print warning" do
|
|
123
125
|
client = Drip::Client.new
|
|
124
126
|
content_type = nil
|
|
125
|
-
assert_output(nil, /^\[DEPRECATED\] Drip
|
|
127
|
+
assert_output(nil, /^\[DEPRECATED\] Drip::Client\#content_type is deprecated/) { content_type = client.content_type }
|
|
126
128
|
assert_equal "application/vnd.api+json", content_type
|
|
127
129
|
end
|
|
128
130
|
end
|
|
@@ -135,7 +137,7 @@ class Drip::ClientTest < Drip::TestCase
|
|
|
135
137
|
|
|
136
138
|
client = Drip::Client.new
|
|
137
139
|
response = nil
|
|
138
|
-
assert_output(nil, /^\[DEPRECATED\] Drip
|
|
140
|
+
assert_output(nil, /^\[DEPRECATED\] Drip::Client\#get please use the API endpoint specific methods/) { response = client.get("testpath") }
|
|
139
141
|
assert_equal({}, response.body)
|
|
140
142
|
end
|
|
141
143
|
end
|
data/test/drip/request_test.rb
CHANGED
data/test/drip/resource_test.rb
CHANGED
data/test/drip/resources_test.rb
CHANGED
data/test/drip/response_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
require 'simplecov'
|
|
4
4
|
SimpleCov.start
|
|
5
5
|
|
|
6
|
-
$LOAD_PATH.unshift File.expand_path('
|
|
6
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
|
7
7
|
|
|
8
8
|
require "drip"
|
|
9
9
|
require "minitest/autorun"
|
|
10
10
|
require "shoulda-context"
|
|
11
|
-
require "mocha/
|
|
11
|
+
require "mocha/minitest"
|
|
12
12
|
require "webmock/minitest"
|
|
13
13
|
|
|
14
14
|
class Drip::TestCase < Minitest::Test
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: drip-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Drip
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: A simple wrapper for the Drip API
|
|
14
13
|
email:
|
|
@@ -18,16 +17,18 @@ extensions: []
|
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
20
19
|
- ".github/pull_request_template.md"
|
|
20
|
+
- ".github/workflows/ci.yml"
|
|
21
21
|
- ".gitignore"
|
|
22
22
|
- ".rubocop.yml"
|
|
23
23
|
- ".rubocop_todo.yml"
|
|
24
|
-
- ".travis.yml"
|
|
25
24
|
- CHANGELOG.md
|
|
26
25
|
- Gemfile
|
|
27
26
|
- LICENSE.txt
|
|
28
27
|
- README.md
|
|
29
28
|
- Rakefile
|
|
30
29
|
- drip-ruby.gemspec
|
|
30
|
+
- flake.lock
|
|
31
|
+
- flake.nix
|
|
31
32
|
- lib/drip.rb
|
|
32
33
|
- lib/drip/client.rb
|
|
33
34
|
- lib/drip/client/accounts.rb
|
|
@@ -126,8 +127,8 @@ files:
|
|
|
126
127
|
homepage: http://github.com/DripEmail/drip-ruby
|
|
127
128
|
licenses:
|
|
128
129
|
- MIT
|
|
129
|
-
metadata:
|
|
130
|
-
|
|
130
|
+
metadata:
|
|
131
|
+
rubygems_mfa_required: 'true'
|
|
131
132
|
rdoc_options: []
|
|
132
133
|
require_paths:
|
|
133
134
|
- lib
|
|
@@ -135,58 +136,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
135
136
|
requirements:
|
|
136
137
|
- - ">="
|
|
137
138
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
139
|
+
version: '3.1'
|
|
139
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
requirements:
|
|
141
142
|
- - ">="
|
|
142
143
|
- !ruby/object:Gem::Version
|
|
143
144
|
version: '0'
|
|
144
145
|
requirements: []
|
|
145
|
-
rubygems_version: 3.
|
|
146
|
-
signing_key:
|
|
146
|
+
rubygems_version: 3.7.2
|
|
147
147
|
specification_version: 4
|
|
148
148
|
summary: A Ruby gem for interacting with the Drip API
|
|
149
|
-
test_files:
|
|
150
|
-
- test/drip/client/accounts_test.rb
|
|
151
|
-
- test/drip/client/broadcasts_test.rb
|
|
152
|
-
- test/drip/client/campaign_subscriptions_test.rb
|
|
153
|
-
- test/drip/client/campaigns_test.rb
|
|
154
|
-
- test/drip/client/configuration_test.rb
|
|
155
|
-
- test/drip/client/conversions_test.rb
|
|
156
|
-
- test/drip/client/custom_fields_test.rb
|
|
157
|
-
- test/drip/client/events_test.rb
|
|
158
|
-
- test/drip/client/forms_test.rb
|
|
159
|
-
- test/drip/client/http_client_test.rb
|
|
160
|
-
- test/drip/client/orders_test.rb
|
|
161
|
-
- test/drip/client/shopper_activity_test.rb
|
|
162
|
-
- test/drip/client/subscribers_test.rb
|
|
163
|
-
- test/drip/client/tags_test.rb
|
|
164
|
-
- test/drip/client/users_test.rb
|
|
165
|
-
- test/drip/client/webhooks_test.rb
|
|
166
|
-
- test/drip/client/workflow_triggers_test.rb
|
|
167
|
-
- test/drip/client/workflows_test.rb
|
|
168
|
-
- test/drip/client_test.rb
|
|
169
|
-
- test/drip/collection_test.rb
|
|
170
|
-
- test/drip/collections/account_test.rb
|
|
171
|
-
- test/drip/collections/broadcasts_test.rb
|
|
172
|
-
- test/drip/collections/campaign_subscriptions_test.rb
|
|
173
|
-
- test/drip/collections/campaigns_test.rb
|
|
174
|
-
- test/drip/collections/errors_test.rb
|
|
175
|
-
- test/drip/collections/orders_test.rb
|
|
176
|
-
- test/drip/collections/purchases_test.rb
|
|
177
|
-
- test/drip/collections/tags_test.rb
|
|
178
|
-
- test/drip/collections/webhooks_test.rb
|
|
179
|
-
- test/drip/collections/workflow_triggers_test.rb
|
|
180
|
-
- test/drip/collections/workflows_test.rb
|
|
181
|
-
- test/drip/collections_test.rb
|
|
182
|
-
- test/drip/request_test.rb
|
|
183
|
-
- test/drip/resource_test.rb
|
|
184
|
-
- test/drip/resources/account_test.rb
|
|
185
|
-
- test/drip/resources/order_test.rb
|
|
186
|
-
- test/drip/resources/subscriber_test.rb
|
|
187
|
-
- test/drip/resources/tag_test.rb
|
|
188
|
-
- test/drip/resources_test.rb
|
|
189
|
-
- test/drip/response_test.rb
|
|
190
|
-
- test/fixtures/resources/not_found_error.json
|
|
191
|
-
- test/fixtures/resources/subscriber.json
|
|
192
|
-
- test/test_helper.rb
|
|
149
|
+
test_files: []
|