gibbon 3.3.3 → 3.3.4
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.
Potentially problematic release.
This version of gibbon might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile +1 -1
- data/gibbon.gemspec +1 -1
- data/lib/gibbon/export.rb +1 -1
- data/lib/gibbon/version.rb +1 -1
- data/spec/gibbon/api_request_spec.rb +5 -4
- data/spec/gibbon/export_spec.rb +7 -0
- data/spec/gibbon/upsert_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e71b5768a6197caeec4d088be1af914201e7973cdc6ca403032f3882624ec5d
|
4
|
+
data.tar.gz: 58385112982bd7840d654f518c9dc93515311e27520aaf17f1f1cf062407315b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7084f3258f25872b23bec63378b8a7c7e72e8d29ede58937c18ebe3fc59449cbdef5fa6332e145bbfb1c344dca78c9ff9027c0ce5574302a112d16ea96a11564
|
7
|
+
data.tar.gz: c15e6b1f690b74bf90748c41f3d528fc1d4eb01fbe21ec743cb5bc1e2554421792e4a88660d950852747030b836e4d80a2d4802b92cfb35399e47f5db016f2bb
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
## [Unreleased][unreleased]
|
2
2
|
|
3
|
-
## [3.3.
|
3
|
+
## [3.3.4] - 2020-04-01
|
4
|
+
- Added support for setting API key via environment variable for Export API
|
5
|
+
- Updated webmock
|
6
|
+
|
7
|
+
## [3.3.3] - 2020-02-07
|
4
8
|
- Removes bit of extra conditional logic that was part of supporting older versions of Faraday
|
5
9
|
|
6
10
|
## [3.3.2] - 2020-01-19
|
data/Gemfile
CHANGED
data/gibbon.gemspec
CHANGED
data/lib/gibbon/export.rb
CHANGED
@@ -7,7 +7,7 @@ module Gibbon
|
|
7
7
|
attr_accessor :api_key, :timeout
|
8
8
|
|
9
9
|
def initialize(api_key: nil, timeout: nil)
|
10
|
-
@api_key = api_key || self.class.api_key
|
10
|
+
@api_key = api_key || self.class.api_key || ENV['MAILCHIMP_API_KEY']
|
11
11
|
@timeout = timeout || self.class.timeout || 600
|
12
12
|
end
|
13
13
|
|
data/lib/gibbon/version.rb
CHANGED
@@ -6,20 +6,21 @@ describe Gibbon::APIRequest do
|
|
6
6
|
|
7
7
|
before do
|
8
8
|
@gibbon = Gibbon::Request.new(api_key: api_key)
|
9
|
-
@api_root = "https://
|
9
|
+
@api_root = "https://us1.api.mailchimp.com/3.0"
|
10
|
+
@basic_auth_credentials = ['apikey', api_key]
|
10
11
|
end
|
11
12
|
|
12
13
|
shared_examples_for 'client error handling' do
|
13
14
|
it "surfaces client request exceptions as a Gibbon::MailChimpError" do
|
14
15
|
exception = error_class.new("the server responded with status 503")
|
15
|
-
stub_request(:get, "#{@api_root}/lists").to_raise(exception)
|
16
|
+
stub_request(:get, "#{@api_root}/lists").with(basic_auth: @basic_auth_credentials).to_raise(exception)
|
16
17
|
expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
|
17
18
|
end
|
18
19
|
|
19
20
|
it "surfaces an unparseable client request exception as a Gibbon::MailChimpError" do
|
20
21
|
exception = error_class.new(
|
21
22
|
"the server responded with status 503")
|
22
|
-
stub_request(:get, "#{@api_root}/lists").to_raise(exception)
|
23
|
+
stub_request(:get, "#{@api_root}/lists").with(basic_auth: @basic_auth_credentials).to_raise(exception)
|
23
24
|
expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
|
24
25
|
end
|
25
26
|
|
@@ -27,7 +28,7 @@ describe Gibbon::APIRequest do
|
|
27
28
|
response_values = {:status => 503, :headers => {}, :body => '[foo]'}
|
28
29
|
exception = error_class.new("the server responded with status 503", response_values)
|
29
30
|
|
30
|
-
stub_request(:get, "#{@api_root}/lists").to_raise(exception)
|
31
|
+
stub_request(:get, "#{@api_root}/lists").with(basic_auth: @basic_auth_credentials).to_raise(exception)
|
31
32
|
expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
|
32
33
|
end
|
33
34
|
|
data/spec/gibbon/export_spec.rb
CHANGED
@@ -17,6 +17,13 @@ describe Gibbon::Export do
|
|
17
17
|
expect {@export.list(id: "123456")}.to raise_error(Gibbon::GibbonError)
|
18
18
|
end
|
19
19
|
|
20
|
+
it "sets an API key from the 'MAILCHIMP_API_KEY' ENV variable" do
|
21
|
+
ENV['MAILCHIMP_API_KEY'] = 'TESTKEY-us1'
|
22
|
+
@export = Gibbon::Export.new
|
23
|
+
expect(@export.api_key).to eq('TESTKEY-us1')
|
24
|
+
ENV.delete('MAILCHIMP_API_KEY')
|
25
|
+
end
|
26
|
+
|
20
27
|
it "sets correct endpoint from api key" do
|
21
28
|
@api_key = "TESTKEY-us1"
|
22
29
|
@export.api_key = @api_key
|
data/spec/gibbon/upsert_spec.rb
CHANGED
@@ -17,8 +17,8 @@ describe Gibbon do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'supports upsert request' do
|
20
|
-
stub_request(:put, "https://
|
21
|
-
.with(body: MultiJson.dump(request_body))
|
20
|
+
stub_request(:put, "https://us1.api.mailchimp.com/3.0/lists/#{list_id}/members/#{member_id}")
|
21
|
+
.with(body: MultiJson.dump(request_body), basic_auth: ['apikey', '1234-us1'])
|
22
22
|
.to_return(status: 200)
|
23
23
|
|
24
24
|
Gibbon::Request.new(api_key: api_key)
|
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.3.
|
4
|
+
version: 3.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amro Mousa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '3.8'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '3.8'
|
83
83
|
description: A wrapper for MailChimp API 3.0 and Export API
|
84
84
|
email:
|
85
85
|
- amromousa@gmail.com
|