mailchimp_api_v3 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61eb0ac85e729bf6310175b16636c5f5664710d1
4
- data.tar.gz: 892f6d64134d54cd1a50cf7c2d206fb52210f355
3
+ metadata.gz: 463b5715b8ca2923efd8eb8575ca8179929caf6d
4
+ data.tar.gz: d34a2023fa0fcf9cd1dc0bb9c81b40c4ed1429ad
5
5
  SHA512:
6
- metadata.gz: 4b5e4925fcaf4b8d0898b7621ccaef0b0b8e4b148b04ecca3ace715e460346bf3146743b5667d2a1627b634e29912edd475bddd4e173b94aa88fec209dd7fd11
7
- data.tar.gz: 970507bbd172fd7fbf2334fa9bd7f73642a61ccde8434deb41d34aa2c18c14a1137fda97e13ee3ff148516b6b5bd99c32c15c71dfdf3201aeb8155bb2cc082a6
6
+ metadata.gz: cc6bfd5203a5daa249d6ce42ef1278f9e2d881e2b5a45497a4faa08c943099a05a1c342bc98b3698049eff5188b4715315559a2b1abedc03ba5c969c866f4f37
7
+ data.tar.gz: b3e97220a895b9505e8730118f07502c090647143da541b1368bfec2ea0f9cb1df08ca8cbe86969194a399b41bf52e568001038258edbd7667a80fef61748f0f
@@ -13,8 +13,10 @@ module Mailchimp
13
13
  Account.new self, get
14
14
  end
15
15
 
16
- def lists
17
- Lists.new self
16
+ def lists(filter = {})
17
+ data = filter.is_a?(String) ? { name: filter.dup } : filter.dup
18
+ lists = Lists.new(self)
19
+ data.empty? ? lists : lists.find_by(data)
18
20
  end
19
21
 
20
22
  def connected?
@@ -1,3 +1,3 @@
1
1
  module Mailchimp
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -220,4 +220,48 @@ http_interactions:
220
220
  only","use_archive_bar":true,"campaign_defaults":{"from_name":"Sam Sayers","from_email":"sam@sayers.cc","subject":"","language":"en"},"notify_on_subscribe":"","notify_on_unsubscribe":"","date_created":"2015-06-27T14:49:18+00:00","list_rating":0,"email_type_option":false,"subscribe_url_short":"http://eepurl.com/brGTO9","subscribe_url_long":"http://insitearts.us11.list-manage1.com/subscribe?u=1dbca289fd41b54838bcbb501&id=e73f5910ca","beamer_address":"us11-6692a2b3c3-bcd2a8b144@inbound.mailchimp.com","visibility":"pub","modules":[],"stats":{"member_count":2,"unsubscribe_count":0,"cleaned_count":0,"member_count_since_send":2,"unsubscribe_count_since_send":0,"cleaned_count_since_send":0,"campaign_count":0,"campaign_last_sent":"","merge_field_count":2,"avg_sub_rate":0,"avg_unsub_rate":0,"target_sub_rate":0,"open_rate":0,"click_rate":0,"last_sub_date":"2015-06-27T14:50:39+00:00","last_unsub_date":""}}],"total_items":1}'
221
221
  http_version:
222
222
  recorded_at: Tue, 07 Jul 2015 11:29:36 GMT
223
+ - request:
224
+ method: get
225
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists?count=500&exclude_fields=lists._links,_links&offset=0
226
+ body:
227
+ encoding: US-ASCII
228
+ string: ''
229
+ headers:
230
+ Accept:
231
+ - "*/*; q=0.5, application/xml"
232
+ Accept-Encoding:
233
+ - gzip, deflate
234
+ Authorization:
235
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
236
+ User-Agent:
237
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
238
+ response:
239
+ status:
240
+ code: 200
241
+ message: OK
242
+ headers:
243
+ Server:
244
+ - nginx
245
+ Content-Type:
246
+ - application/json; charset=utf-8
247
+ Content-Length:
248
+ - '1174'
249
+ X-Request-Id:
250
+ - 150a25a3-40ed-4dd6-9454-5b7c04bc0e91
251
+ Link:
252
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Collection.json>; rel="describedBy"
253
+ Vary:
254
+ - Accept-Encoding
255
+ Date:
256
+ - Wed, 08 Jul 2015 10:22:17 GMT
257
+ Connection:
258
+ - keep-alive
259
+ body:
260
+ encoding: ASCII-8BIT
261
+ string: '{"lists":[{"id":"e73f5910ca","name":"My first list","contact":{"company":"InSite
262
+ Arts","address1":"300 Burdett Road","address2":"London","city":"London","state":"","zip":"E14
263
+ 7DQ","country":"262","phone":"07917153555"},"permission_reminder":"Opt-in
264
+ only","use_archive_bar":true,"campaign_defaults":{"from_name":"Sam Sayers","from_email":"sam@sayers.cc","subject":"","language":"en"},"notify_on_subscribe":"","notify_on_unsubscribe":"","date_created":"2015-06-27T14:49:18+00:00","list_rating":0,"email_type_option":false,"subscribe_url_short":"http://eepurl.com/brGTO9","subscribe_url_long":"http://insitearts.us11.list-manage1.com/subscribe?u=1dbca289fd41b54838bcbb501&id=e73f5910ca","beamer_address":"us11-6692a2b3c3-bcd2a8b144@inbound.mailchimp.com","visibility":"pub","modules":[],"stats":{"member_count":2,"unsubscribe_count":0,"cleaned_count":0,"member_count_since_send":2,"unsubscribe_count_since_send":0,"cleaned_count_since_send":0,"campaign_count":0,"campaign_last_sent":"","merge_field_count":2,"avg_sub_rate":0,"avg_unsub_rate":0,"target_sub_rate":0,"open_rate":0,"click_rate":0,"last_sub_date":"2015-06-27T14:50:39+00:00","last_unsub_date":""}}],"total_items":1}'
265
+ http_version:
266
+ recorded_at: Wed, 08 Jul 2015 10:22:17 GMT
223
267
  recorded_with: VCR 2.9.3
@@ -33,6 +33,12 @@ describe Mailchimp::Client, vcr: { cassette_name: 'client' } do
33
33
  expect(lists).to be_an Array
34
34
  expect(lists.sample).to be_a Mailchimp::List
35
35
  end
36
+
37
+ it 'retrieves a list by name' do
38
+ list = Mailchimp::Client.new.lists 'My first list'
39
+ expect(list).to be_a Mailchimp::List
40
+ expect(list.name).to eq 'My first list'
41
+ end
36
42
  end
37
43
 
38
44
  context 'exceptions' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailchimp_api_v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xenapto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-07 00:00:00.000000000 Z
11
+ date: 2015-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -284,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
284
  version: '0'
285
285
  requirements: []
286
286
  rubyforge_project:
287
- rubygems_version: 2.4.6
287
+ rubygems_version: 2.4.8
288
288
  signing_key:
289
289
  specification_version: 4
290
290
  summary: 'Example: mailchimp.lists("My first list").member("ann@example.com")'
@@ -316,3 +316,4 @@ test_files:
316
316
  - spec/spec_helper.rb
317
317
  - spec/support/api_key.rb
318
318
  - spec/support/vcr_setup.rb
319
+ has_rdoc: