gibbon 3.3.3 → 3.3.4

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
  SHA256:
3
- metadata.gz: dbdff62baa93bc714bc199105fa84691067cec6650a1a5c06dbde64da52c8bd6
4
- data.tar.gz: 5e115ce632e5e3229692f3975c0819cc165eec6a2ef41ab0fa76704ce9c83955
3
+ metadata.gz: 6e71b5768a6197caeec4d088be1af914201e7973cdc6ca403032f3882624ec5d
4
+ data.tar.gz: 58385112982bd7840d654f518c9dc93515311e27520aaf17f1f1cf062407315b
5
5
  SHA512:
6
- metadata.gz: dec423c9924c775b88110218b948f2685daa949f03ea3ee7eef7bafd4c9b97ed5db201167cb9aae66edfb9be964e227c864c2536f9ab6407e1f50b14ec2061c3
7
- data.tar.gz: dfca56671affd0cffc57cb19b4292eed8f70e7a8de60b5a8524660cb2fe44ae947f794c540781039a1de77cf2ca5918c4bb0f6cbaadfe375bd5ed916e3d84c1a
6
+ metadata.gz: 7084f3258f25872b23bec63378b8a7c7e72e8d29ede58937c18ebe3fc59449cbdef5fa6332e145bbfb1c344dca78c9ff9027c0ce5574302a112d16ea96a11564
7
+ data.tar.gz: c15e6b1f690b74bf90748c41f3d528fc1d4eb01fbe21ec743cb5bc1e2554421792e4a88660d950852747030b836e4d80a2d4802b92cfb35399e47f5db016f2bb
@@ -1,6 +1,10 @@
1
1
  ## [Unreleased][unreleased]
2
2
 
3
- ## [3.3.3] - 2020-02-7
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
@@ -6,7 +6,7 @@ platforms :rbx do
6
6
  end
7
7
 
8
8
  group :development, :test do
9
- gem 'webmock', '~>1.24.0'
9
+ gem 'webmock', '~> 3.8'
10
10
  end
11
11
 
12
12
  gemspec
@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_development_dependency 'rake'
26
26
  s.add_development_dependency "rspec", "3.5.0"
27
- s.add_development_dependency 'webmock', '~> 1.21.0'
27
+ s.add_development_dependency 'webmock', '~> 3.8'
28
28
 
29
29
  end
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Gibbon
2
- VERSION = "3.3.3"
2
+ VERSION = "3.3.4"
3
3
  end
@@ -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://apikey:#{api_key}@us1.api.mailchimp.com/3.0"
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
 
@@ -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
@@ -17,8 +17,8 @@ describe Gibbon do
17
17
  end
18
18
 
19
19
  it 'supports upsert request' do
20
- stub_request(:put, "https://apikey:1234-us1@us1.api.mailchimp.com/3.0/lists/#{list_id}/members/#{member_id}")
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.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-02-07 00:00:00.000000000 Z
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: 1.21.0
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: 1.21.0
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