drip-ruby 3.1.1 → 3.2.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/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +0 -5
- data/CHANGELOG.md +8 -1
- data/lib/drip/client/subscribers.rb +8 -3
- data/lib/drip/collection.rb +1 -1
- data/lib/drip/version.rb +1 -1
- data/test/drip/client/custom_fields_test.rb +9 -1
- data/test/drip/client/subscribers_test.rb +14 -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: 70f3d91d9c2443f74403c190edb0cf38e67f6659
|
4
|
+
data.tar.gz: '0759cfde4ef6ed2361b909c6f765a9cec2579a14'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad33578769c6b1e0d45dec91e9f4fd691eb32f36df440b82b41649ea723bf5906c3bc4fa0a5341920e17e2720857c94e6da1459ebe18df023a12c1fc28686f7
|
7
|
+
data.tar.gz: c03a67601a4d2cd13154002460576ffe475049d00e5beadb84b49a7b9ba263c6806624aa847767473cf6caaa972d8d46c43edbddf2a7b4f3be55919e680237dc
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -23,11 +23,6 @@ Metrics/AbcSize:
|
|
23
23
|
Metrics/BlockLength:
|
24
24
|
Max: 46
|
25
25
|
|
26
|
-
# Offense count: 3
|
27
|
-
# Configuration parameters: CountComments.
|
28
|
-
Metrics/ClassLength:
|
29
|
-
Max: 173
|
30
|
-
|
31
26
|
# Offense count: 4
|
32
27
|
# Configuration parameters: CountComments.
|
33
28
|
Metrics/MethodLength:
|
data/CHANGELOG.md
CHANGED
@@ -6,10 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
[master]: https://github.com/DripEmail/drip-ruby/compare/v3.
|
9
|
+
[master]: https://github.com/DripEmail/drip-ruby/compare/v3.2.0...HEAD
|
10
10
|
|
11
11
|
- Your contribution here!
|
12
12
|
|
13
|
+
## [3.2.0] - 2018-08-15
|
14
|
+
|
15
|
+
[3.2.0]: https://github.com/DripEmail/drip-ruby/compare/v3.1.1...v3.2.0
|
16
|
+
|
17
|
+
- Allow `#create_or_update_subscriber` to work with Drip id. Fixes [#50](https://github.com/DripEmail/drip-ruby/issues/50)
|
18
|
+
- [#52](https://github.com/DripEmail/drip-ruby/pull/52): Fix `#custom_fields` to accept the API response without error. Fixes [#30](https://github.com/DripEmail/drip-ruby/issues/30)
|
19
|
+
|
13
20
|
## [3.1.1] - 2018-06-06
|
14
21
|
|
15
22
|
[3.1.1]: https://github.com/DripEmail/drip-ruby/compare/v3.1.0...v3.1.1
|
@@ -31,8 +31,10 @@ module Drip
|
|
31
31
|
|
32
32
|
# Public: Create or update a subscriber.
|
33
33
|
#
|
34
|
-
# email -
|
34
|
+
# email - Optional. The String subscriber email address. (Deprecated in favor of a hash argument)
|
35
35
|
# options - A Hash of options.
|
36
|
+
# - email - Required (or id). Lookup the subscriber by email.
|
37
|
+
# - id - Required (or email). Lookup the subscriber by Drip ID.
|
36
38
|
# - new_email - Optional. A new email address for the subscriber.
|
37
39
|
# If provided and a subscriber with the email above
|
38
40
|
# does not exist, this address will be used to
|
@@ -44,8 +46,11 @@ module Drip
|
|
44
46
|
#
|
45
47
|
# Returns a Drip::Response.
|
46
48
|
# See https://www.getdrip.com/docs/rest-api#create_or_update_subscriber
|
47
|
-
def create_or_update_subscriber(
|
48
|
-
data =
|
49
|
+
def create_or_update_subscriber(*args)
|
50
|
+
data = {}
|
51
|
+
data[:email] = args[0] if args[0].is_a? String
|
52
|
+
data.merge!(args.last) if args.last.is_a? Hash
|
53
|
+
raise ArgumentError, 'email: or id: parameter required' if !data.key?(:email) && !data.key?(:id)
|
49
54
|
post "#{account_id}/subscribers", generate_resource("subscribers", data)
|
50
55
|
end
|
51
56
|
|
data/lib/drip/collection.rb
CHANGED
data/lib/drip/version.rb
CHANGED
@@ -8,7 +8,15 @@ class Drip::Client::CustomFieldsTest < Drip::TestCase
|
|
8
8
|
context "#custom_fields" do
|
9
9
|
setup do
|
10
10
|
@response_status = 200
|
11
|
-
@response_body =
|
11
|
+
@response_body = <<-JSON
|
12
|
+
{
|
13
|
+
"custom_field_identifiers":[
|
14
|
+
"custom_field_1",
|
15
|
+
"custom_field_2",
|
16
|
+
"custom_field_3"
|
17
|
+
]
|
18
|
+
}
|
19
|
+
JSON
|
12
20
|
|
13
21
|
stub_request(:get, "https://api.getdrip.com/v2/12345/custom_field_identifiers").
|
14
22
|
to_return(status: @response_status, body: @response_body, headers: {})
|
@@ -65,9 +65,22 @@ class Drip::Client::SubscribersTest < Drip::TestCase
|
|
65
65
|
to_return(status: @response_status, body: @response_body, headers: {})
|
66
66
|
end
|
67
67
|
|
68
|
-
should "
|
68
|
+
should "allow request with legacy email argument" do
|
69
69
|
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
70
70
|
assert_equal expected, @client.create_or_update_subscriber(@email, @data)
|
71
|
+
assert_requested :post, "https://api.getdrip.com/v2/12345/subscribers", body: '{"subscribers":[{"email":"derrick@getdrip.com","time_zone":"America/Los_Angeles"}]}', times: 1
|
72
|
+
end
|
73
|
+
|
74
|
+
should "allow request with email keyword argument" do
|
75
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
76
|
+
assert_equal expected, @client.create_or_update_subscriber(email: @email)
|
77
|
+
assert_requested :post, "https://api.getdrip.com/v2/12345/subscribers", body: '{"subscribers":[{"email":"derrick@getdrip.com"}]}', times: 1
|
78
|
+
end
|
79
|
+
|
80
|
+
should "allow request with drip id keyword argument" do
|
81
|
+
expected = Drip::Response.new(@response_status, JSON.parse(@response_body))
|
82
|
+
assert_equal expected, @client.create_or_update_subscriber(id: 123456)
|
83
|
+
assert_requested :post, "https://api.getdrip.com/v2/12345/subscribers", body: '{"subscribers":[{"id":123456}]}', times: 1
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drip-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Reimer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|