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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5863ce163571867687599035a3efb7ae64f0be27
4
- data.tar.gz: bc2afd9c27b43999b3fae7e20332af73945305f1
3
+ metadata.gz: a36d1e7fe83d03c1a4e903c27626dac393eed101
4
+ data.tar.gz: 9fe82b43fbc7c0e7d92f7f6035dedae101190969
5
5
  SHA512:
6
- metadata.gz: 6cd38d270b357e015498fb881e2556efb4ea89e1926ef1c81dbb6072eb825d0632b51cd3ce6877465e9daa330f412bcb5f67246185c28e6b05141a898abedb8a
7
- data.tar.gz: 3c3f56bdbb3654b366ed4ea557f07a7ed986611638a4e679cd312778f461938d3c65478b7fdadcd8e41cc92dd0b020eaed28cc1d1d34c36f36098b1c611843c5
6
+ metadata.gz: a910079fd12ae97ee81ad1d33a9df21c1a1bd318910d1dbf14ed4632d0b59ee415b56abb3ed5da140a8bbd019b95f96f09fb29e26a3bde31c92d39b75af96e2a
7
+ data.tar.gz: 6701a0dbeefc07793463b0bd9956674f0ad6044f818dfb9674b1d2cb7d5e25ce304cedd8ee0388984637859c51255ab0a342126e877237534c94b746da29a129
@@ -5,4 +5,4 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1.0
7
7
  - jruby-19mode
8
- - rbx
8
+ - rbx-2
@@ -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}})
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gibbon"
6
- s.version = "1.1.2"
6
+ s.version = "1.1.3"
7
7
  s.authors = ["Amro Mousa"]
8
8
  s.email = ["amromousa@gmail.com"]
9
9
  s.homepage = "http://github.com/amro/gibbon"
@@ -30,11 +30,20 @@ module Gibbon
30
30
  parsed_response = nil
31
31
 
32
32
  if (response.body)
33
- parsed_response = MultiJson.load(response.body)
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
@@ -1,5 +1,5 @@
1
1
  module Gibbon
2
2
  class MailChimpError < StandardError
3
- attr_accessor :code
3
+ attr_accessor :code, :name
4
4
  end
5
- end
5
+ end
@@ -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.2
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-03-17 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty