gibbon 4.1.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.markdown +2 -2
- data/lib/gibbon/api_request.rb +7 -7
- data/lib/gibbon/version.rb +1 -1
- data/spec/gibbon/api_request_spec.rb +1 -1
- data/spec/gibbon/request_spec.rb +3 -3
- data/spec/gibbon/upsert_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03c53ed2d53ab67b1eb57e172b588844a8f58933e42b0e1ec082d89fe2c3f5fa
|
|
4
|
+
data.tar.gz: 96dd6b830075c0abf1e2d22d9937ccc99aba546c8168cbc0e35a72da2bc98334
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb64ec1e82f6106b597c1303dbea2bac8b5b6fd493d20a79a72421b01dd89583141ff1decd72bd2ea1172151258dc9474aedeefb805881e787e822b6fd9027a0
|
|
7
|
+
data.tar.gz: b2d40dcca0dfad041330e8c2dafe6b7072796109230ef8f11cb0e90bebabde4be06981a335ec1ab0aaa3118af568c6bd1b9257d9f0bedb768379ed1818137d08
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [4.1.1] - 2026-11-08
|
|
2
|
+
- Use the current MultiJSON API for JSON serialization, parsing, and parse errors to eliminate deprecation warnings and prepare for MultiJSON 2.0 (#330).
|
|
3
|
+
- Preserve Gibbon's public `symbolize_keys` option while passing `symbolize_names` to MultiJSON internally.
|
|
4
|
+
|
|
1
5
|
## [4.1.0] - 2026-11-02
|
|
2
6
|
- Require Ruby 3.2+ (drops support for EOL Ruby 3.1)
|
|
3
7
|
- Require `multi_json` 1.21.2+, whose JSON adapter supports `json` 3.x, and remove the `json < 3.0` constraint added in 4.0.1
|
data/README.markdown
CHANGED
|
@@ -27,7 +27,7 @@ gem "gibbon"
|
|
|
27
27
|
* **Ruby 3.2 or newer.** Gibbon 4.1 dropped support for Ruby 3.1; Gibbon 4.0 dropped support for Ruby 2.4 through 3.0.
|
|
28
28
|
* A MailChimp account and API key. You can see your API keys [here](https://admin.mailchimp.com/account/api).
|
|
29
29
|
|
|
30
|
-
Gibbon depends on [Faraday](https://github.com/lostisland/faraday) (both 1.x and 2.x are supported) and [
|
|
30
|
+
Gibbon depends on [Faraday](https://github.com/lostisland/faraday) (both 1.x and 2.x are supported) and [MultiJSON](https://github.com/sferik/multi_json). Connections to MailChimp negotiate TLS 1.2 or newer.
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
@@ -513,7 +513,7 @@ Full release history lives in the [CHANGELOG](CHANGELOG.md). The breaking change
|
|
|
513
513
|
Gibbon 4.1 contains no API changes. It changes what it runs on:
|
|
514
514
|
|
|
515
515
|
* **Ruby 3.2 or newer is required.** Ruby 3.1 is EOL and is no longer supported. If you are on Ruby 3.1, stay on Gibbon 4.0.1.
|
|
516
|
-
* **
|
|
516
|
+
* **MultiJSON 1.21.2 or newer is required**, and Gibbon no longer constrains the `json` gem. This lets you use `json` 3.x.
|
|
517
517
|
|
|
518
518
|
### Upgrading to 4.0
|
|
519
519
|
|
data/lib/gibbon/api_request.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Gibbon
|
|
|
23
23
|
|
|
24
24
|
begin
|
|
25
25
|
response = self.rest_client.post do |request|
|
|
26
|
-
configure_request(request: request, params: params, headers: headers, body:
|
|
26
|
+
configure_request(request: request, params: params, headers: headers, body: MultiJSON.generate(body))
|
|
27
27
|
end
|
|
28
28
|
parse_response(response)
|
|
29
29
|
rescue => e
|
|
@@ -39,7 +39,7 @@ module Gibbon
|
|
|
39
39
|
|
|
40
40
|
begin
|
|
41
41
|
response = self.rest_client.patch do |request|
|
|
42
|
-
configure_request(request: request, params: params, headers: headers, body:
|
|
42
|
+
configure_request(request: request, params: params, headers: headers, body: MultiJSON.generate(body))
|
|
43
43
|
end
|
|
44
44
|
parse_response(response)
|
|
45
45
|
rescue => e
|
|
@@ -55,7 +55,7 @@ module Gibbon
|
|
|
55
55
|
|
|
56
56
|
begin
|
|
57
57
|
response = self.rest_client.put do |request|
|
|
58
|
-
configure_request(request: request, params: params, headers: headers, body:
|
|
58
|
+
configure_request(request: request, params: params, headers: headers, body: MultiJSON.generate(body))
|
|
59
59
|
end
|
|
60
60
|
parse_response(response)
|
|
61
61
|
rescue => e
|
|
@@ -142,7 +142,7 @@ module Gibbon
|
|
|
142
142
|
error_params[:status_code] = error.response[:status]
|
|
143
143
|
error_params[:raw_body] = error.response[:body]
|
|
144
144
|
|
|
145
|
-
parsed_response =
|
|
145
|
+
parsed_response = MultiJSON.parse(error.response[:body], symbolize_names: symbolize_keys)
|
|
146
146
|
|
|
147
147
|
if parsed_response
|
|
148
148
|
error_params[:body] = parsed_response
|
|
@@ -155,7 +155,7 @@ module Gibbon
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
end
|
|
158
|
-
rescue
|
|
158
|
+
rescue MultiJSON::ParseError
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
error_to_raise = MailChimpError.new(error.message, error_params)
|
|
@@ -198,9 +198,9 @@ module Gibbon
|
|
|
198
198
|
if response.body && !response.body.empty?
|
|
199
199
|
begin
|
|
200
200
|
headers = response.headers
|
|
201
|
-
body =
|
|
201
|
+
body = MultiJSON.parse(response.body, symbolize_names: symbolize_keys)
|
|
202
202
|
parsed_response = Response.new(headers: headers, body: body)
|
|
203
|
-
rescue
|
|
203
|
+
rescue MultiJSON::ParseError
|
|
204
204
|
error_params = { title: "UNPARSEABLE_RESPONSE", status_code: 500 }
|
|
205
205
|
error = MailChimpError.new("Unparseable response: #{response.body}", error_params)
|
|
206
206
|
raise error
|
data/lib/gibbon/version.rb
CHANGED
|
@@ -89,7 +89,7 @@ describe Gibbon::APIRequest do
|
|
|
89
89
|
expect(e.title).to eq "Invalid Resource"
|
|
90
90
|
expect(e.detail).to eq "The resource submitted could not be validated."
|
|
91
91
|
expect(e.raw_body).to eq error_body
|
|
92
|
-
expect(e.body).to eq
|
|
92
|
+
expect(e.body).to eq MultiJSON.parse(error_body)
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
data/spec/gibbon/request_spec.rb
CHANGED
|
@@ -57,7 +57,7 @@ describe Gibbon::Request do
|
|
|
57
57
|
|
|
58
58
|
it "maps create to POST" do
|
|
59
59
|
stub = stub_request(:post, "#{api_root}/lists")
|
|
60
|
-
.with(body:
|
|
60
|
+
.with(body: MultiJSON.generate(body), basic_auth: basic_auth_credentials, headers: { 'Content-Type' => 'application/json' })
|
|
61
61
|
.to_return(status: 200)
|
|
62
62
|
@gibbon.lists.create(body: body)
|
|
63
63
|
expect(stub).to have_been_requested
|
|
@@ -65,7 +65,7 @@ describe Gibbon::Request do
|
|
|
65
65
|
|
|
66
66
|
it "maps update to PATCH" do
|
|
67
67
|
stub = stub_request(:patch, "#{api_root}/lists/list123")
|
|
68
|
-
.with(body:
|
|
68
|
+
.with(body: MultiJSON.generate(body), basic_auth: basic_auth_credentials, headers: { 'Content-Type' => 'application/json' })
|
|
69
69
|
.to_return(status: 200)
|
|
70
70
|
@gibbon.lists("list123").update(body: body)
|
|
71
71
|
expect(stub).to have_been_requested
|
|
@@ -73,7 +73,7 @@ describe Gibbon::Request do
|
|
|
73
73
|
|
|
74
74
|
it "maps upsert to PUT" do
|
|
75
75
|
stub = stub_request(:put, "#{api_root}/lists/list123")
|
|
76
|
-
.with(body:
|
|
76
|
+
.with(body: MultiJSON.generate(body), basic_auth: basic_auth_credentials, headers: { 'Content-Type' => 'application/json' })
|
|
77
77
|
.to_return(status: 200)
|
|
78
78
|
@gibbon.lists("list123").upsert(body: body)
|
|
79
79
|
expect(stub).to have_been_requested
|
data/spec/gibbon/upsert_spec.rb
CHANGED
|
@@ -18,7 +18,7 @@ describe Gibbon do
|
|
|
18
18
|
|
|
19
19
|
it 'supports upsert request' do
|
|
20
20
|
stub_request(:put, "https://us1.api.mailchimp.com/3.0/lists/#{list_id}/members/#{member_id}")
|
|
21
|
-
.with(body:
|
|
21
|
+
.with(body: MultiJSON.generate(request_body), basic_auth: ['apikey', '1234-us1'])
|
|
22
22
|
.to_return(status: 200)
|
|
23
23
|
|
|
24
24
|
Gibbon::Request.new(api_key: api_key)
|