drip-ruby 0.0.10 → 0.0.11
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/README.md +2 -2
- data/lib/drip/response.rb +13 -9
- data/lib/drip/version.rb +1 -1
- data/test/drip/response_test.rb +12 -0
- 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: d61068fcd13ef39d32840fcfe33d5089abc3d4af
|
4
|
+
data.tar.gz: a3b91f78fca56d4cb031bf18c8623376ef74697b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86d7d713a5682193967be81180e4dbfd478baaa6b3ef9a24f108158222c452c052bf5e15d7bad8c93792bf0bc43112f304932b4a0e540a8362bd584f42de3e5a
|
7
|
+
data.tar.gz: c44f72fb547cf904e4ca6ea8b3fc419aff5babbcd28707e903c25ea0402b775ac4d6aa638acaa01f5451854a8e29b4511008c911fe854b5d5e50f6d4faf129f4
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Authentication
|
25
25
|
|
26
|
-
For private integrations, you may use your personal API
|
26
|
+
For private integrations, you may use your personal API Token (found
|
27
27
|
[here](https://www.getdrip.com/user/edit)) via the `api_key` setting:
|
28
28
|
|
29
29
|
```ruby
|
@@ -90,7 +90,7 @@ for a complete API reference.
|
|
90
90
|
|
91
91
|
Here are some common use cases for the API client.
|
92
92
|
|
93
|
-
###Fetching user accounts
|
93
|
+
### Fetching user accounts
|
94
94
|
|
95
95
|
Once you have an access token for a Drip user, you can fetch their accounts.
|
96
96
|
|
data/lib/drip/response.rb
CHANGED
@@ -44,16 +44,20 @@ module Drip
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def parse_members
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
47
|
+
if status == 429
|
48
|
+
body
|
49
|
+
else
|
50
|
+
{}.tap do |members|
|
51
|
+
if body.is_a?(Hash)
|
52
|
+
body.each do |key, value|
|
53
|
+
klass = if value.is_a?(Array)
|
54
|
+
Drip::Collections.find_class(key)
|
55
|
+
else
|
56
|
+
Drip::Resources.find_class(key)
|
57
|
+
end
|
55
58
|
|
56
|
-
|
59
|
+
members[key] = klass.new(value)
|
60
|
+
end
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
data/lib/drip/version.rb
CHANGED
data/test/drip/response_test.rb
CHANGED
@@ -121,4 +121,16 @@ class Drip::ResponseTest < Drip::TestCase
|
|
121
121
|
assert_equal 1, @subject.subscribers.count
|
122
122
|
end
|
123
123
|
end
|
124
|
+
|
125
|
+
context "rate limit response" do
|
126
|
+
setup do
|
127
|
+
@body = {"message"=>"API rate limit exceeded. Please try again in an hour."}
|
128
|
+
@subject = Drip::Response.new(429, @body)
|
129
|
+
end
|
130
|
+
|
131
|
+
should "parse correctly" do
|
132
|
+
assert_equal 429, @subject.status
|
133
|
+
assert_equal @body["message"], @subject.message
|
134
|
+
end
|
135
|
+
end
|
124
136
|
end
|
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: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derrick Reimer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|