gibbon 3.1.0 → 3.1.1
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 +2 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +1 -1
- data/lib/gibbon/api_request.rb +4 -5
- data/lib/gibbon/version.rb +1 -1
- data/spec/gibbon/mailchimp_error_spec.rb +49 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ee0feabc44b4f9a9f8ba62fbb303baf69412ce0
|
4
|
+
data.tar.gz: 94ccc2373e6991acba4a32418bbe2a63ae852763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59cbe8d55f63cfd982cf1c5f59d770946177c2b567f123ce32f3527f88d05c4c0d1c1b55167f0cb48ebc9510293b0a4fa2a9100a62cdac26e00d61a66469d4b6
|
7
|
+
data.tar.gz: 64c09481ecde6b9fc53bc91f666f681af60d316591dee398f8c60785d4f117bbf8edd210231cfc1f662f02377af83ee879883bbdf50ec7a28cf31e0ad11e4c82
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
data/lib/gibbon/api_request.rb
CHANGED
@@ -102,7 +102,7 @@ module Gibbon
|
|
102
102
|
def symbolize_keys
|
103
103
|
@request_builder.symbolize_keys
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
# Helpers
|
107
107
|
|
108
108
|
def handle_error(error)
|
@@ -157,7 +157,7 @@ module Gibbon
|
|
157
157
|
client
|
158
158
|
end
|
159
159
|
|
160
|
-
def parse_response(response)
|
160
|
+
def parse_response(response)
|
161
161
|
parsed_response = nil
|
162
162
|
|
163
163
|
if response.body && !response.body.empty?
|
@@ -166,9 +166,8 @@ module Gibbon
|
|
166
166
|
body = MultiJson.load(response.body, symbolize_keys: symbolize_keys)
|
167
167
|
parsed_response = Response.new(headers: headers, body: body)
|
168
168
|
rescue MultiJson::ParseError
|
169
|
-
|
170
|
-
error
|
171
|
-
error.status_code = 500
|
169
|
+
error_params = { title: "UNPARSEABLE_RESPONSE", status_code: 500 }
|
170
|
+
error = MailChimpError.new("Unparseable response: #{response.body}", error_params)
|
172
171
|
raise error
|
173
172
|
end
|
174
173
|
end
|
data/lib/gibbon/version.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Gibbon::MailChimpError do
|
4
|
+
let(:message) { 'Foo' }
|
5
|
+
let(:params) do
|
6
|
+
{
|
7
|
+
title: 'error_title',
|
8
|
+
detail: 'error_detail',
|
9
|
+
body: 'error_body',
|
10
|
+
raw_body: 'error_raw_body',
|
11
|
+
status_code: 'error_status_code'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
@gibbon = Gibbon::MailChimpError.new(message, params)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "adds the error params to the error message" do
|
20
|
+
expected_message = "Foo " \
|
21
|
+
"@title=\"error_title\", " \
|
22
|
+
"@detail=\"error_detail\", " \
|
23
|
+
"@body=\"error_body\", " \
|
24
|
+
"@raw_body=\"error_raw_body\", " \
|
25
|
+
"@status_code=\"error_status_code\""
|
26
|
+
|
27
|
+
expect(@gibbon.message).to eq(expected_message)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'sets the title attribute' do
|
31
|
+
expect(@gibbon.title).to eq(params[:title])
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'sets the detail attribute' do
|
35
|
+
expect(@gibbon.detail).to eq(params[:detail])
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'sets the body attribute' do
|
39
|
+
expect(@gibbon.body).to eq(params[:body])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'sets the raw_body attribute' do
|
43
|
+
expect(@gibbon.raw_body).to eq(params[:raw_body])
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'sets the status_code attribute' do
|
47
|
+
expect(@gibbon.status_code).to eq(params[:status_code])
|
48
|
+
end
|
49
|
+
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.1.
|
4
|
+
version: 3.1.1
|
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-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- spec/gibbon/api_request_spec.rb
|
109
109
|
- spec/gibbon/export_spec.rb
|
110
110
|
- spec/gibbon/gibbon_spec.rb
|
111
|
+
- spec/gibbon/mailchimp_error_spec.rb
|
111
112
|
- spec/gibbon/upsert_spec.rb
|
112
113
|
- spec/spec_helper.rb
|
113
114
|
homepage: http://github.com/amro/gibbon
|
@@ -138,5 +139,6 @@ test_files:
|
|
138
139
|
- spec/gibbon/api_request_spec.rb
|
139
140
|
- spec/gibbon/export_spec.rb
|
140
141
|
- spec/gibbon/gibbon_spec.rb
|
142
|
+
- spec/gibbon/mailchimp_error_spec.rb
|
141
143
|
- spec/gibbon/upsert_spec.rb
|
142
144
|
- spec/spec_helper.rb
|