gibbon 3.3.0 → 3.4.0
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 +5 -4
- data/CHANGELOG.md +18 -1
- data/Gemfile +1 -2
- data/LICENSE.txt +1 -1
- data/README.markdown +4 -4
- data/gibbon.gemspec +3 -5
- data/lib/gibbon/api_request.rb +1 -4
- data/lib/gibbon/export.rb +1 -1
- data/lib/gibbon/request.rb +1 -1
- data/lib/gibbon/version.rb +1 -1
- data/spec/gibbon/api_request_spec.rb +5 -10
- data/spec/gibbon/export_spec.rb +7 -0
- data/spec/gibbon/upsert_spec.rb +2 -2
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6078387c488e567cb48e2c113c1201d412de3989ce740e04149bf77f37aaad97
|
4
|
+
data.tar.gz: 7adbe131b1b495bb3e8296edd7682b50db0fd5e886eae80668d45e442662b46e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad43e961eba03d11441173b136e6b75315ab0a46ac54714caf85ea68d50a44fda5fb1e70f596fd61f3337a8759a7d3da878467e1be890927816ec290038ffeb8
|
7
|
+
data.tar.gz: cc37182cfaf77bd044d01a812ef3ba5d7d5a5c3475aaceb1b4c84b915fa9772b8b33317dff78b0ac2878925a53885e1bcbc5cc41d978e04d1d05f9c5c047fb40
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
## [Unreleased][unreleased]
|
2
2
|
|
3
|
-
|
3
|
+
|
4
|
+
## [3.4.0] - 2021-03-12
|
5
|
+
- Support for Faraday 1.x.x and higer
|
6
|
+
|
7
|
+
## [3.3.4] - 2020-04-01
|
8
|
+
- Added support for setting API key via environment variable for Export API
|
9
|
+
- Updated webmock
|
10
|
+
|
11
|
+
## [3.3.3] - 2020-02-07
|
12
|
+
- Removes bit of extra conditional logic that was part of supporting older versions of Faraday
|
13
|
+
|
14
|
+
## [3.3.2] - 2020-01-19
|
15
|
+
- Bumped minimum version of Faraday 0.16.0 due to compatibility issues with legacy versions
|
16
|
+
|
17
|
+
## [3.3.1] - 2019-11-08
|
18
|
+
- Fix statically setting `faraday_adapter` did not set adapter on new requests
|
19
|
+
|
20
|
+
## [3.3.0] - 2019-10-02
|
4
21
|
- Fixed compatibility with Faraday 0.16.2+
|
5
22
|
- Set minimum Ruby to 2.3.8
|
6
23
|
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gibbon is an API wrapper for MailChimp's [API](http://kb.mailchimp.com/api/).
|
4
4
|
|
5
|
-
[![Build Status](https://
|
5
|
+
[![Build Status](https://travis-ci.com/amro/gibbon.svg?branch=master)](https://travis-ci.com/amro/gibbon)
|
6
6
|
|
7
7
|
## Important Notes
|
8
8
|
|
@@ -185,7 +185,7 @@ gibbon.lists(list_id).members(lower_case_md5_hashed_email_address).retrieve
|
|
185
185
|
Add tags to a subscriber:
|
186
186
|
|
187
187
|
```ruby
|
188
|
-
gibbon.lists(list_id).members(Digest::MD5.hexdigest(
|
188
|
+
gibbon.lists(list_id).members(Digest::MD5.hexdigest(lower_case_email_address)).tags.create(
|
189
189
|
body: {
|
190
190
|
tags: [{name:"referred-from-xyz", status:"active"},{name:"pro-plan",status:"active"}]
|
191
191
|
}
|
@@ -506,5 +506,5 @@ Thanks to everyone who has [contributed](https://github.com/amro/gibbon/contribu
|
|
506
506
|
|
507
507
|
## Copyright
|
508
508
|
|
509
|
-
* Copyright (c) 2010-
|
510
|
-
* MailChimp (c) 2001-
|
509
|
+
* Copyright (c) 2010-2020 Amro Mousa. See LICENSE.txt for details.
|
510
|
+
* MailChimp (c) 2001-2020 The Rocket Science Group.
|
data/gibbon.gemspec
CHANGED
@@ -13,19 +13,17 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{A wrapper for MailChimp API 3.0 and Export API}
|
14
14
|
s.license = "MIT"
|
15
15
|
|
16
|
-
s.rubyforge_project = "gibbon"
|
17
|
-
|
18
16
|
s.files = `git ls-files`.split("\n")
|
19
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
19
|
s.require_paths = ["lib"]
|
22
|
-
s.required_ruby_version = '>= 2.
|
20
|
+
s.required_ruby_version = '>= 2.4.0'
|
23
21
|
|
24
|
-
s.add_dependency('faraday', '>= 0.
|
22
|
+
s.add_dependency('faraday', '>= 0.16.0')
|
25
23
|
s.add_dependency('multi_json', '>= 1.11.0')
|
26
24
|
|
27
25
|
s.add_development_dependency 'rake'
|
28
26
|
s.add_development_dependency "rspec", "3.5.0"
|
29
|
-
s.add_development_dependency 'webmock', '~>
|
27
|
+
s.add_development_dependency 'webmock', '~> 3.8'
|
30
28
|
|
31
29
|
end
|
data/lib/gibbon/api_request.rb
CHANGED
@@ -109,10 +109,7 @@ module Gibbon
|
|
109
109
|
error_params = {}
|
110
110
|
|
111
111
|
begin
|
112
|
-
|
113
|
-
# Faraday::Error::ClientError was used before 0.16.0
|
114
|
-
client_error = error.is_a?(Faraday::ClientError) || error.is_a?(Faraday::Error::ClientError)
|
115
|
-
if client_error && error.response
|
112
|
+
if (error.is_a?(Faraday::ClientError) || error.is_a?(Faraday::ServerError)) && error.response
|
116
113
|
error_params[:status_code] = error.response[:status]
|
117
114
|
error_params[:raw_body] = error.response[:body]
|
118
115
|
|
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/request.rb
CHANGED
@@ -13,7 +13,7 @@ module Gibbon
|
|
13
13
|
@timeout = timeout || self.class.timeout || DEFAULT_TIMEOUT
|
14
14
|
@open_timeout = open_timeout || self.class.open_timeout || DEFAULT_OPEN_TIMEOUT
|
15
15
|
@proxy = proxy || self.class.proxy || ENV['MAILCHIMP_PROXY']
|
16
|
-
@faraday_adapter = faraday_adapter || Faraday.default_adapter
|
16
|
+
@faraday_adapter = faraday_adapter || self.class.faraday_adapter || Faraday.default_adapter
|
17
17
|
@symbolize_keys = symbolize_keys || self.class.symbolize_keys || false
|
18
18
|
@debug = debug || self.class.debug || false
|
19
19
|
@logger = logger || self.class.logger || ::Logger.new(STDOUT)
|
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
|
|
@@ -60,12 +61,6 @@ describe Gibbon::APIRequest do
|
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
63
|
-
context 'Faraday::Error::ClientError' do
|
64
|
-
let(:error_class) { Faraday::Error::ClientError }
|
65
|
-
|
66
|
-
include_examples 'client error handling'
|
67
|
-
end
|
68
|
-
|
69
64
|
context 'Faraday::ClientError' do
|
70
65
|
let(:error_class) { Faraday::ClientError }
|
71
66
|
|
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.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amro Mousa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.16.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -116,7 +116,7 @@ homepage: http://github.com/amro/gibbon
|
|
116
116
|
licenses:
|
117
117
|
- MIT
|
118
118
|
metadata: {}
|
119
|
-
post_install_message:
|
119
|
+
post_install_message:
|
120
120
|
rdoc_options: []
|
121
121
|
require_paths:
|
122
122
|
- lib
|
@@ -124,15 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: 2.
|
127
|
+
version: 2.4.0
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
135
|
-
signing_key:
|
134
|
+
rubygems_version: 3.2.14
|
135
|
+
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: A wrapper for MailChimp API 3.0 and Export API
|
138
138
|
test_files:
|