gibbon 3.2.0 → 3.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 12a6fecb32704fd28e939c71d68d04b002daa26b
4
- data.tar.gz: b203c08f25fab5920c4714448709cf16c1297a74
2
+ SHA256:
3
+ metadata.gz: 9948496f6f0ccccd5c2796b5d6ad2e1c656e3fd4db624bbb36a24e81d9161be7
4
+ data.tar.gz: 16ae83c4ec4af77425a9534b0c8c037fde234e694f21e77aa3572cad035867b4
5
5
  SHA512:
6
- metadata.gz: 049a905ad6d6ccb68ed25d76e3192ab38e2342405c57aa89070817e79ad64a3d0d635129821b44cc69da778381134f9cada53480644defc8350c9da065851fc2
7
- data.tar.gz: 15b2cc277b73e3e9b6af78045061d16924cdf677547e82e96ec5c04f37a966f359bbb8e1b589d12f6493e82c5d02b3884dac82328ee92560fab6487d4cf3ce26
6
+ metadata.gz: 6e68e1c2b1e77f738e48a6a7256fb35c0904ae1d7f487daaeccd9b65cfc98ab57d3244f5f3fa1e699cd424fbaf36561ae83d3891f02029317595831c031c65d0
7
+ data.tar.gz: 443c2f49c096106061887b29d052d05064a23b508740da354aea4f49bbed3201366c9a548155da051664906fc40b39e4bf9611571707db82bcb542859e7402c2
@@ -4,7 +4,8 @@ cache: bundler
4
4
  before_install:
5
5
  - gem install bundler # -v 1.7.14 if a specific version is needed
6
6
  rvm:
7
- - 2.0.0
8
7
  - 2.1.5
9
8
  - 2.2.2
10
- - 2.3.3
9
+ - 2.3.8
10
+ - 2.4.5
11
+ - 2.5.3
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased][unreleased]
2
2
 
3
+ ## [3.2.1] - 2019-10-02
4
+ - Fixed compatibility with Faraday 0.16.2+
5
+ - Set minimum Ruby to 2.3.8
6
+
7
+ ## [3.2.1] - 2017-11-08
8
+ - Set minimum Ruby to 2.1
9
+
3
10
  ## [3.2.0] - 2017-11-08
4
11
  - Force TLS version 1.2
5
12
 
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at amromousa@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -3,7 +3,6 @@
3
3
  Gibbon is an API wrapper for MailChimp's [API](http://kb.mailchimp.com/api/).
4
4
 
5
5
  [![Build Status](https://secure.travis-ci.org/amro/gibbon.svg)](http://travis-ci.org/amro/gibbon)
6
- [![Dependency Status](https://gemnasium.com/amro/gibbon.svg)](https://gemnasium.com/amro/gibbon)
7
6
 
8
7
  ## Important Notes
9
8
 
@@ -27,7 +26,7 @@ First, create a *one-time use instance* of `Gibbon::Request`:
27
26
  gibbon = Gibbon::Request.new(api_key: "your_api_key")
28
27
  ```
29
28
 
30
- ***Note*** Only reuse instances of Gibbon after terminating a call with a verb, which makes a request. Requests are light weight objects that update an internal path based on your call chain. When you terminate a call chain with a verb, a request instance makes a request an resets the path.
29
+ ***Note*** Only reuse instances of Gibbon after terminating a call with a verb, which makes a request. Requests are light weight objects that update an internal path based on your call chain. When you terminate a call chain with a verb, a request instance makes a request and resets the path.
31
30
 
32
31
  You can set an individual request's `timeout` and `open_timeout` like this:
33
32
 
@@ -111,7 +110,7 @@ Gibbon::Request.logger = MyLogger.new
111
110
 
112
111
  ### Lists
113
112
 
114
- Fetch all lists:
113
+ Fetch first page of lists:
115
114
 
116
115
  ```ruby
117
116
  gibbon.lists.retrieve
@@ -131,7 +130,7 @@ gibbon.lists(list_id).members.retrieve
131
130
 
132
131
  ### Subscribers
133
132
 
134
- Get all subscribers for a list:
133
+ Get first page of subscribers for a list:
135
134
 
136
135
  ```ruby
137
136
  gibbon.lists(list_id).members.retrieve
@@ -179,6 +178,21 @@ Get a specific member's information (open/click rates etc.) from MailChimp:
179
178
  gibbon.lists(list_id).members(lower_case_md5_hashed_email_address).retrieve
180
179
  ```
181
180
 
181
+ ### Tags
182
+
183
+ [Tags](https://mailchimp.com/help/getting-started-tags/) are a flexible way to organize (slice and dice) your list: for example, you can send a campaign directly to one or more tags.
184
+
185
+ Add tags to a subscriber:
186
+
187
+ ```ruby
188
+ gibbon.lists(list_id).members(Digest::MD5.hexdigest(email)).tags.create(
189
+ body: {
190
+ tags: [{name:"referred-from-xyz", status:"active"},{name:"pro-plan",status:"active"}]
191
+ }
192
+ )
193
+ ```
194
+
195
+
182
196
  ### Batch Operations
183
197
 
184
198
  Any API call that can be made directly can also be organized into batch operations. Performing batch operations requires you to generate a hash for each individual API call and pass them as an `Array` to the Batch endpoint.
@@ -237,7 +251,7 @@ gibbon.lists(list_id).members.retrieve(params: {"fields": "members.email_address
237
251
 
238
252
  ### Campaigns
239
253
 
240
- Get all campaigns:
254
+ Get first page of campaigns:
241
255
 
242
256
  ```ruby
243
257
  campaigns = gibbon.campaigns.retrieve
@@ -477,7 +491,7 @@ This fetches and returns all of the results at once. Pass a block if you'd like
477
491
 
478
492
  ```ruby
479
493
  export = Gibbon::Export.new(api_key: "your_api_key", timeout: 1200)
480
- export.list(id: list_id) do |row|
494
+ export.list(id: list_id) do |row|
481
495
  puts row
482
496
  end
483
497
  ```
@@ -492,5 +506,5 @@ Thanks to everyone who has [contributed](https://github.com/amro/gibbon/contribu
492
506
 
493
507
  ## Copyright
494
508
 
495
- * Copyright (c) 2010-2017 Amro Mousa. See LICENSE.txt for details.
496
- * MailChimp (c) 2001-2017 The Rocket Science Group.
509
+ * Copyright (c) 2010-2018 Amro Mousa. See LICENSE.txt for details.
510
+ * MailChimp (c) 2001-2018 The Rocket Science Group.
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
- s.required_ruby_version = '>= 2.0.0'
22
+ s.required_ruby_version = '>= 2.3.8'
23
23
 
24
24
  s.add_dependency('faraday', '>= 0.9.1')
25
25
  s.add_dependency('multi_json', '>= 1.11.0')
@@ -109,7 +109,10 @@ module Gibbon
109
109
  error_params = {}
110
110
 
111
111
  begin
112
- if error.is_a?(Faraday::Error::ClientError) && error.response
112
+ # Faraday::ClientError is used in Faraday 0.16.0+
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
113
116
  error_params[:status_code] = error.response[:status]
114
117
  error_params[:raw_body] = error.response[:body]
115
118
 
@@ -1,3 +1,3 @@
1
1
  module Gibbon
2
- VERSION = "3.2.0"
3
- end
2
+ VERSION = "3.3.0"
3
+ end
@@ -9,52 +9,66 @@ describe Gibbon::APIRequest do
9
9
  @api_root = "https://apikey:#{api_key}@us1.api.mailchimp.com/3.0"
10
10
  end
11
11
 
12
- it "surfaces client request exceptions as a Gibbon::MailChimpError" do
13
- exception = Faraday::Error::ClientError.new("the server responded with status 503")
14
- stub_request(:get, "#{@api_root}/lists").to_raise(exception)
15
- expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
16
- end
17
-
18
- it "surfaces an unparseable client request exception as a Gibbon::MailChimpError" do
19
- exception = Faraday::Error::ClientError.new(
20
- "the server responded with status 503")
21
- stub_request(:get, "#{@api_root}/lists").to_raise(exception)
22
- expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
23
- end
12
+ shared_examples_for 'client error handling' do
13
+ it "surfaces client request exceptions as a Gibbon::MailChimpError" do
14
+ exception = error_class.new("the server responded with status 503")
15
+ stub_request(:get, "#{@api_root}/lists").to_raise(exception)
16
+ expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
17
+ end
24
18
 
25
- it "surfaces an unparseable response body as a Gibbon::MailChimpError" do
26
- response_values = {:status => 503, :headers => {}, :body => '[foo]'}
27
- exception = Faraday::Error::ClientError.new("the server responded with status 503", response_values)
19
+ it "surfaces an unparseable client request exception as a Gibbon::MailChimpError" do
20
+ exception = error_class.new(
21
+ "the server responded with status 503")
22
+ stub_request(:get, "#{@api_root}/lists").to_raise(exception)
23
+ expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
24
+ end
28
25
 
29
- stub_request(:get, "#{@api_root}/lists").to_raise(exception)
30
- expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
31
- end
26
+ it "surfaces an unparseable response body as a Gibbon::MailChimpError" do
27
+ response_values = {:status => 503, :headers => {}, :body => '[foo]'}
28
+ exception = error_class.new("the server responded with status 503", response_values)
32
29
 
33
- context "handle_error" do
34
- it "includes status and raw body even when json can't be parsed" do
35
- response_values = {:status => 503, :headers => {}, :body => 'A non JSON response'}
36
- exception = Faraday::Error::ClientError.new("the server responded with status 503", response_values)
37
- api_request = Gibbon::APIRequest.new(builder: Gibbon::Request)
38
- begin
39
- api_request.send :handle_error, exception
40
- rescue => boom
41
- expect(boom.status_code).to eq 503
42
- expect(boom.raw_body).to eq "A non JSON response"
43
- end
30
+ stub_request(:get, "#{@api_root}/lists").to_raise(exception)
31
+ expect { @gibbon.lists.retrieve }.to raise_error(Gibbon::MailChimpError)
44
32
  end
45
33
 
46
- context "when symbolize_keys is true" do
47
- it "sets title and detail on the error params" do
48
- response_values = {:status => 422, :headers => {}, :body => '{"title": "foo", "detail": "bar"}'}
49
- exception = Faraday::Error::ClientError.new("the server responded with status 422", response_values)
50
- api_request = Gibbon::APIRequest.new(builder: Gibbon::Request.new(symbolize_keys: true))
34
+ context "handle_error" do
35
+ it "includes status and raw body even when json can't be parsed" do
36
+ response_values = {:status => 503, :headers => {}, :body => 'A non JSON response'}
37
+ exception = error_class.new("the server responded with status 503", response_values)
38
+ api_request = Gibbon::APIRequest.new(builder: Gibbon::Request)
51
39
  begin
52
40
  api_request.send :handle_error, exception
53
41
  rescue => boom
54
- expect(boom.title).to eq "foo"
55
- expect(boom.detail).to eq "bar"
42
+ expect(boom.status_code).to eq 503
43
+ expect(boom.raw_body).to eq "A non JSON response"
44
+ end
45
+ end
46
+
47
+ context "when symbolize_keys is true" do
48
+ it "sets title and detail on the error params" do
49
+ response_values = {:status => 422, :headers => {}, :body => '{"title": "foo", "detail": "bar"}'}
50
+ exception = error_class.new("the server responded with status 422", response_values)
51
+ api_request = Gibbon::APIRequest.new(builder: Gibbon::Request.new(symbolize_keys: true))
52
+ begin
53
+ api_request.send :handle_error, exception
54
+ rescue => boom
55
+ expect(boom.title).to eq "foo"
56
+ expect(boom.detail).to eq "bar"
57
+ end
56
58
  end
57
59
  end
58
60
  end
59
61
  end
62
+
63
+ context 'Faraday::Error::ClientError' do
64
+ let(:error_class) { Faraday::Error::ClientError }
65
+
66
+ include_examples 'client error handling'
67
+ end
68
+
69
+ context 'Faraday::ClientError' do
70
+ let(:error_class) { Faraday::ClientError }
71
+
72
+ include_examples 'client error handling'
73
+ end
60
74
  end
@@ -73,7 +73,7 @@ describe Gibbon do
73
73
  expect(@gibbon.proxy).to be_nil
74
74
  end
75
75
 
76
- it "sets an proxy url key from the 'MAILCHIMP_PROXY_URL' ENV variable" do
76
+ it "sets a proxy url key from the 'MAILCHIMP_PROXY' ENV variable" do
77
77
  ENV['MAILCHIMP_PROXY'] = @proxy
78
78
  @gibbon = Gibbon::Request.new
79
79
  expect(@gibbon.proxy).to eq(@proxy)
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.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amro Mousa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-08 00:00:00.000000000 Z
11
+ date: 2019-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -91,6 +91,7 @@ files:
91
91
  - ".gitignore"
92
92
  - ".travis.yml"
93
93
  - CHANGELOG.md
94
+ - CODE_OF_CONDUCT.md
94
95
  - Gemfile
95
96
  - LICENSE.txt
96
97
  - README.markdown
@@ -123,15 +124,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
124
  requirements:
124
125
  - - ">="
125
126
  - !ruby/object:Gem::Version
126
- version: 2.0.0
127
+ version: 2.3.8
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
130
  - - ">="
130
131
  - !ruby/object:Gem::Version
131
132
  version: '0'
132
133
  requirements: []
133
- rubyforge_project: gibbon
134
- rubygems_version: 2.4.6
134
+ rubygems_version: 3.0.6
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: A wrapper for MailChimp API 3.0 and Export API