gibbon 2.2.0 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9bbaffb886d48a6638dad933173180c5fa05a83
4
- data.tar.gz: 3738e10aac82b774d4e835ef4d920195c08f0989
3
+ metadata.gz: a4ade9615ee9a69d1ce2d1d560ce14ec92430dd2
4
+ data.tar.gz: a82c3dea034eead23703265b805607a0c311e14f
5
5
  SHA512:
6
- metadata.gz: 24b23d7562c0ec6a3b0afc359c2d22e7030438030bddbbec84cc008740e438736fb95f98d419377e91e915073a296a3b82c9f488d7792856deb7dc4530952fe6
7
- data.tar.gz: 03b4df6bcafa1af1a13694e7dc2a71149a4eb64bb3f43653f006dcb97e7bb0bb346933a2b9e864cc82ac35dcd12b5efa01daea136b2ac632566e04a0cf2c1de7
6
+ metadata.gz: 6dd1f3f444a7e6e0852f70705676cff464e67c3455a3be06c16bbd6597e7c33678e392c47184821b8c97c77c3b4bbe834620dbf2430c56da3e7176d2e0fa7d25
7
+ data.tar.gz: 99e997b80b822cfa08d93fa4004ccd2395aa0a699ba9e37bfb0360b891194e5e861b6f32dfe1e0f5ebcb5e42f0a8d96eab0ee76a9ff1bcbbfd47670f4affe431
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ## [Unreleased][unreleased]
2
2
 
3
+ ## [2.2.1] - 2016-01-01
4
+ - Improve MailChimpError logging
5
+
3
6
  ## [2.2.0] - 2015-12-01
4
7
  - Adds support for proxies
5
8
  - Adds support for faraday_adapters
data/README.markdown CHANGED
@@ -253,7 +253,7 @@ You can set an optional proxy url like this (or with an environment variable MAI
253
253
  gibbon.proxy = 'http://your_proxy.com:80'
254
254
  ```
255
255
 
256
- You can set a different Faraday adapter during initialization:
256
+ You can set a different [Faraday adapter](https://github.com/lostisland/faraday) during initialization:
257
257
 
258
258
  ```ruby
259
259
  gibbon = Gibbon::Request.new(api_key: "your_api_key", faraday_adapter: :net_http)
@@ -84,7 +84,7 @@ module Gibbon
84
84
  def timeout
85
85
  @request_builder.timeout
86
86
  end
87
-
87
+
88
88
  def proxy
89
89
  @request_builder.proxy
90
90
  end
@@ -96,28 +96,27 @@ module Gibbon
96
96
  # Helpers
97
97
 
98
98
  def handle_error(error)
99
- error_to_raise = nil
99
+ error_params = {}
100
100
 
101
101
  begin
102
- error_to_raise = MailChimpError.new(error.message)
103
-
104
102
  if error.is_a?(Faraday::Error::ClientError) && error.response
105
103
  parsed_response = MultiJson.load(error.response[:body])
106
104
 
107
105
  if parsed_response
108
- error_to_raise.body = parsed_response
109
- error_to_raise.title = parsed_response["title"] if parsed_response["title"]
110
- error_to_raise.detail = parsed_response["detail"] if parsed_response["detail"]
106
+ error_params[:body] = parsed_response
107
+ error_params[:title] = parsed_response["title"] if parsed_response["title"]
108
+ error_params[:detail] = parsed_response["detail"] if parsed_response["detail"]
111
109
  end
112
110
 
113
- error_to_raise.status_code = error.response[:status]
114
- error_to_raise.raw_body = error.response[:body]
111
+ error_params[:status_code] = error.response[:status]
112
+ error_params[:raw_body] = error.response[:body]
115
113
  end
116
114
  rescue MultiJson::ParseError
117
- error_to_raise.message = error.message
118
- error_to_raise.status_code = error.response[:status]
115
+ error_params[:status_code] = error.response[:status]
119
116
  end
120
117
 
118
+ error_to_raise = MailChimpError.new(error.message, error_params)
119
+
121
120
  raise error_to_raise
122
121
  end
123
122
 
@@ -1,5 +1,29 @@
1
1
  module Gibbon
2
2
  class MailChimpError < StandardError
3
- attr_accessor :title, :detail, :body, :raw_body, :status_code, :message
3
+ attr_reader :title, :detail, :body, :raw_body, :status_code
4
+
5
+ def initialize(message = "", params = {})
6
+ @title = params[:title]
7
+ @detail = params[:detail]
8
+ @body = params[:body]
9
+ @raw_body = params[:raw_body]
10
+ @status_code = params[:status_code]
11
+
12
+ super(message)
13
+ end
14
+
15
+ def to_s
16
+ super + " " + instance_variables_to_s
17
+ end
18
+
19
+ private
20
+
21
+ def instance_variables_to_s
22
+ [:title, :detail, :body, :raw_body, :status_code].map do |attr|
23
+ attr_value = send(attr)
24
+
25
+ "@#{attr}=#{attr_value.inspect}"
26
+ end.join(", ")
27
+ end
4
28
  end
5
29
  end
@@ -1,3 +1,3 @@
1
1
  module Gibbon
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  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: 2.2.0
4
+ version: 2.2.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: 2015-12-01 00:00:00.000000000 Z
11
+ date: 2016-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday