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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 031f71020f56af0fa71a6570754b0e642aba7b86
4
- data.tar.gz: c328180e850c51c81d4661f8cafdeea134c4cf9e
3
+ metadata.gz: d61068fcd13ef39d32840fcfe33d5089abc3d4af
4
+ data.tar.gz: a3b91f78fca56d4cb031bf18c8623376ef74697b
5
5
  SHA512:
6
- metadata.gz: 0bd40f128bf44375d6d49478e204a616193c14ed451c05d4ac5d8322bcb3cb91a67fe03563c11845a3a8ca8bfaea8dfe85723f09e03ac9355bfca5ef41d6a6f1
7
- data.tar.gz: 250e6810e7e5780c3fe3d8fad4af83e684012dddd762b7d23ff519e276c2b8f7577a12fbd17af6b2fdcf0444e31cefc989ffb761e301df6a0983bebc75632b8b
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 key (found
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
- {}.tap do |members|
48
- if body.is_a?(Hash)
49
- body.each do |key, value|
50
- klass = if value.is_a?(Array)
51
- Drip::Collections.find_class(key)
52
- else
53
- Drip::Resources.find_class(key)
54
- end
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
- members[key] = klass.new(value)
59
+ members[key] = klass.new(value)
60
+ end
57
61
  end
58
62
  end
59
63
  end
data/lib/drip/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Drip
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -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.10
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-02-21 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler