gibbon 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gibbon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.markdown +0 -2
- data/gibbon.gemspec +1 -1
- data/lib/gibbon/api_category.rb +10 -1
- data/lib/gibbon/mailchimp_error.rb +2 -2
- data/spec/gibbon/gibbon_spec.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: a36d1e7fe83d03c1a4e903c27626dac393eed101
|
4
|
+
data.tar.gz: 9fe82b43fbc7c0e7d92f7f6035dedae101190969
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a910079fd12ae97ee81ad1d33a9df21c1a1bd318910d1dbf14ed4632d0b59ee415b56abb3ed5da140a8bbd019b95f96f09fb29e26a3bde31c92d39b75af96e2a
|
7
|
+
data.tar.gz: 6701a0dbeefc07793463b0bd9956674f0ad6044f818dfb9674b1d2cb7d5e25ce304cedd8ee0388984637859c51255ab0a342126e877237534c94b746da29a129
|
data/.travis.yml
CHANGED
data/README.markdown
CHANGED
@@ -95,8 +95,6 @@ Subscribe a member to a list:
|
|
95
95
|
|
96
96
|
gb.lists.subscribe({:id => list_id, :email => {:email => 'email_address'}, :merge_vars => {:FNAME => 'First Name', :LNAME => 'Last Name'}, :double_optin => false})
|
97
97
|
|
98
|
-
> Note: This will send a welcome email to the new subscriber
|
99
|
-
|
100
98
|
Here's an example showing pagination. The following code fetches the first page of 100 members subscribed to your list:
|
101
99
|
|
102
100
|
gb.lists.members({:id => list_id, :opts => {:start => 0, :limit => 100}})
|
data/gibbon.gemspec
CHANGED
data/lib/gibbon/api_category.rb
CHANGED
@@ -30,11 +30,20 @@ module Gibbon
|
|
30
30
|
parsed_response = nil
|
31
31
|
|
32
32
|
if (response.body)
|
33
|
-
|
33
|
+
begin
|
34
|
+
parsed_response = MultiJson.load(response.body)
|
35
|
+
rescue MultiJson::ParseError
|
36
|
+
parsed_response = {
|
37
|
+
"error" => "Unparseable response: #{response.body}",
|
38
|
+
"name" => "UNPARSEABLE_RESPONSE",
|
39
|
+
"code" => 500
|
40
|
+
}
|
41
|
+
end
|
34
42
|
|
35
43
|
if should_raise_for_response?(parsed_response)
|
36
44
|
error = MailChimpError.new(parsed_response["error"])
|
37
45
|
error.code = parsed_response["code"]
|
46
|
+
error.name = parsed_response["name"]
|
38
47
|
raise error
|
39
48
|
end
|
40
49
|
end
|
data/spec/gibbon/gibbon_spec.rb
CHANGED
@@ -209,6 +209,18 @@ describe Gibbon do
|
|
209
209
|
allow(Gibbon::APICategory).to receive(:post).and_return(Struct.new(:body).new(MultiJson.dump({"cid" => "1234567"})))
|
210
210
|
expect(@gibbon.campaigns.send({"cid" => "1234567"})).to eq({"cid" => "1234567"})
|
211
211
|
end
|
212
|
+
|
213
|
+
it "not throw exception if configured to and the API returns an unparsable response" do
|
214
|
+
@gibbon.throws_exceptions = false
|
215
|
+
allow(Gibbon::APICategory).to receive(:post).and_return(Struct.new(:body).new("<HTML>Invalid response</HTML>"))
|
216
|
+
expect(@gibbon.say.hello).to eq({"name" => "UNPARSEABLE_RESPONSE", "error" => "Unparseable response: <HTML>Invalid response</HTML>", "code" => 500})
|
217
|
+
end
|
218
|
+
|
219
|
+
it "throw exception if configured to and the API returns an unparsable response" do
|
220
|
+
@gibbon.throws_exceptions = true
|
221
|
+
allow(Gibbon::APICategory).to receive(:post).and_return(Struct.new(:body).new("<HTML>Invalid response</HTML>"))
|
222
|
+
expect{@gibbon.say.hello}.to raise_error(Gibbon::MailChimpError)
|
223
|
+
end
|
212
224
|
end
|
213
225
|
|
214
226
|
describe "export API" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gibbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amro Mousa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|