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 +4 -4
- data/CHANGELOG.md +3 -0
- data/README.markdown +6 -5
- data/lib/gibbon/api_request.rb +6 -2
- data/lib/gibbon/version.rb +1 -1
- data/spec/gibbon/api_request_spec.rb +14 -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: c1f19b602cdd22a49058f62d097abe6121d04ada
|
4
|
+
data.tar.gz: 01e37c1aa62e820a9b1cba9c476bdfba7640c001
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc64c4a643ceacc05f06e3a621616eb25a57072a0486bd134cd233f650966db1d5ed7f7c7154887fd96344844325bdadfe0a9f188c2c4c29add288fe638fc339
|
7
|
+
data.tar.gz: c046252678c798d2b1f10c87f34b6a507fb4d4d7e919e2528343fbfa19803387c44c7fa52b62a7111439fdc453ff7ce9719664d871614076b0d69d86f116c080
|
data/CHANGELOG.md
CHANGED
@@ -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)
|
data/README.markdown
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/gibbon/api_request.rb
CHANGED
@@ -117,8 +117,12 @@ module Gibbon
|
|
117
117
|
|
118
118
|
if parsed_response
|
119
119
|
error_params[:body] = parsed_response
|
120
|
-
|
121
|
-
|
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
|
data/lib/gibbon/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|