gibbon 3.0.1 → 3.0.2

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: 3cadf43e229868a253bae8af2b7e609db5ffd11b
4
- data.tar.gz: 95049f9c9ce5f1d3b9cde18f4650d5be52b13947
3
+ metadata.gz: c1f19b602cdd22a49058f62d097abe6121d04ada
4
+ data.tar.gz: 01e37c1aa62e820a9b1cba9c476bdfba7640c001
5
5
  SHA512:
6
- metadata.gz: 58ab02cdd0ebd1cff4c0211b3a6674484db6a50b52aa34dc7efc746e1c75792dca7a4dedd58e8efc7e38fef73fc285f4859c809bba1f1b5cf1d674bc89cca436
7
- data.tar.gz: 15459d6835355d637505ffc34c3aecbac0a6232a271d1481952c60028f30bd7264c35bd5e922d12ec12717b36a83df59046c808f43b02c19dda60d9f60f2f33f
6
+ metadata.gz: cc64c4a643ceacc05f06e3a621616eb25a57072a0486bd134cd233f650966db1d5ed7f7c7154887fd96344844325bdadfe0a9f188c2c4c29add288fe638fc339
7
+ data.tar.gz: c046252678c798d2b1f10c87f34b6a507fb4d4d7e919e2528343fbfa19803387c44c7fa52b62a7111439fdc453ff7ce9719664d871614076b0d69d86f116c080
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased][unreleased]
2
2
 
3
+ ## [3.0.2] - 2017-05-08
4
+ - Fix subtle bug in `symbolize_keys` when parsing error
5
+
3
6
  ## [3.0.1] - 2017-01-13
4
7
  - Gibbon::Request (API 3.0) now returns a `Gibbon::Response` object that exposes `headers` and the parsed response `body`
5
8
  - Remove Export API support (this is deprected after all)
@@ -4,21 +4,22 @@ Gibbon is an API wrapper for MailChimp's [API](http://kb.mailchimp.com/api/).
4
4
 
5
5
  [![Build Status](https://secure.travis-ci.org/amro/gibbon.svg)](http://travis-ci.org/amro/gibbon)
6
6
  [![Dependency Status](https://gemnasium.com/amro/gibbon.svg)](https://gemnasium.com/amro/gibbon)
7
- ##Important Notes
7
+
8
+ ## Important Notes
8
9
 
9
10
  Please read MailChimp's [Getting Started Guide](http://kb.mailchimp.com/api/article/api-3-overview).
10
11
 
11
12
  Gibbon 3.0.0+ returns a `Gibbon::Response` instead of the response body directly. `Gibbon::Response` exposes the parsed response `body` and `headers`.
12
13
 
13
- ##Installation
14
+ ## Installation
14
15
 
15
16
  $ gem install gibbon
16
17
 
17
- ##Requirements
18
+ ## Requirements
18
19
 
19
20
  A MailChimp account and API key. You can see your API keys [here](http://admin.mailchimp.com/account/api).
20
21
 
21
- ##Usage
22
+ ## Usage
22
23
 
23
24
  First, create a *one-time use instance* of `Gibbon::Request`:
24
25
 
@@ -84,7 +85,7 @@ gibbon = Gibbon::Request.new(api_key: "your_api_key", symbolize_keys: true)
84
85
 
85
86
  MailChimp's [resource documentation](http://kb.mailchimp.com/api/resources) is a list of available resources.
86
87
 
87
- ##Debug Logging
88
+ ## Debug Logging
88
89
 
89
90
  Pass `debug: true` to enable debug logging to STDOUT.
90
91
 
@@ -117,8 +117,12 @@ module Gibbon
117
117
 
118
118
  if parsed_response
119
119
  error_params[:body] = parsed_response
120
- error_params[:title] = parsed_response["title"] if parsed_response["title"]
121
- error_params[:detail] = parsed_response["detail"] if parsed_response["detail"]
120
+
121
+ title_key = symbolize_keys ? :title : "title"
122
+ detail_key = symbolize_keys ? :detail : "detail"
123
+
124
+ error_params[:title] = parsed_response[title_key] if parsed_response[title_key]
125
+ error_params[:detail] = parsed_response[detail_key] if parsed_response[detail_key]
122
126
  end
123
127
 
124
128
  end
@@ -1,3 +1,3 @@
1
1
  module Gibbon
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
@@ -42,5 +42,19 @@ describe Gibbon::APIRequest do
42
42
  expect(boom.raw_body).to eq "A non JSON response"
43
43
  end
44
44
  end
45
+
46
+ context "when symbolize_keys is true" do
47
+ it "sets title and detail on the error params" do
48
+ response_values = {:status => 422, :headers => {}, :body => '{"title": "foo", "detail": "bar"}'}
49
+ exception = Faraday::Error::ClientError.new("the server responded with status 422", response_values)
50
+ api_request = Gibbon::APIRequest.new(builder: Gibbon::Request.new(symbolize_keys: true))
51
+ begin
52
+ api_request.send :handle_error, exception
53
+ rescue => boom
54
+ expect(boom.title).to eq "foo"
55
+ expect(boom.detail).to eq "bar"
56
+ end
57
+ end
58
+ end
45
59
  end
46
60
  end
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: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amro Mousa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-14 00:00:00.000000000 Z
11
+ date: 2017-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday