mailchimp_api_v3 0.0.9 → 0.0.11

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: 4c1376959bbf12d3dd6d2b66f5f62d65c31b497a
4
- data.tar.gz: 9ba4d57d1ae8da47f06aea84e01c17afc0e75e6d
3
+ metadata.gz: 19928fd642bd7ca7ed9b40629d6e1db96391a12d
4
+ data.tar.gz: 101319ee1254dcfe89b6c15137117ba7870d12b1
5
5
  SHA512:
6
- metadata.gz: 77b72cce05b1c2fd59f64b8853055a61114b25b15229b4a486320ef2feb52bac86e359c8c4b0678d367fc44f3e95487498bbefed86e7dab0fe188bf7d3aba6cd
7
- data.tar.gz: 43fa198702a8dbd22cb0c0e1fd26cf86a4a2874463b49135eda4368f087ce1a4a7f0ceda1e0377c233148d7e7860b20e1faf1acf3d1d0c4ba51a422857be2629
6
+ metadata.gz: 42975655558150ab3cae21e4017268c588e21147aac52e85dd942f68a6735d4bf950bb6a7135297e932d6d58431efc3a084382f52e30a882e85ba0637113aa57
7
+ data.tar.gz: 6c8cd4398dae39251a0c9e10200b8984ad36fcb2294cda7cde8b9d8ac9f90b8957524821730f74f381aac851c4a3ad9701d8fcade888c2693109be2520c0f766
@@ -23,4 +23,11 @@ class Hash
23
23
  each { |k, v| result[k.to_s] = v.is_a?(Hash) ? v.deep_stringify_keys : v }
24
24
  result
25
25
  end
26
+
27
+ def divide_on(*keys)
28
+ keys.each_with_object(self.class.new) do |k, hash|
29
+ hash[k] = self[k] if key?(k)
30
+ delete k
31
+ end
32
+ end
26
33
  end
@@ -3,14 +3,15 @@ module Mailchimp
3
3
  include Remote
4
4
 
5
5
  def account
6
- Account.new self, get
6
+ Account.new self, get(path)
7
7
  end
8
8
 
9
- def lists(filter = {})
10
- raw_data = filter.respond_to?(:dup) ? filter.dup : filter
11
- data = raw_data.is_a?(String) ? { name: raw_data } : raw_data
12
- lists = Lists.new(self)
13
- data.empty? ? lists : lists.find_by(data)
9
+ def lists(*args)
10
+ subclass_from Lists, *args
11
+ # raw_data = filter.respond_to?(:dup) ? filter.dup : filter
12
+ # data = raw_data.is_a?(String) ? { name: raw_data } : raw_data
13
+ # lists = Lists.new(self)
14
+ # data.empty? ? lists : lists.find_by(data)
14
15
  end
15
16
 
16
17
  def connected?
@@ -32,6 +33,7 @@ module Mailchimp
32
33
  ) unless api_key_valid?
33
34
 
34
35
  @extra_headers = extra_headers
36
+ super self, { 'id' => '3.0' }
35
37
  end
36
38
 
37
39
  def api_key_valid?
@@ -71,7 +71,7 @@ module Mailchimp
71
71
  end
72
72
 
73
73
  def url_stub
74
- @url_stub ||= "https://#{dc}.api.mailchimp.com/3.0"
74
+ @url_stub ||= "https://#{dc}.api.mailchimp.com"
75
75
  end
76
76
 
77
77
  def params_from(options = {})
@@ -46,5 +46,9 @@ module Mailchimp
46
46
  return instance if instance
47
47
  create(data)
48
48
  end
49
+
50
+ def name_field
51
+ self.class.const_defined?(:NAME_FIELD) ? self.class::NAME_FIELD : 'name'
52
+ end
49
53
  end
50
54
  end
@@ -57,8 +57,11 @@ module Mailchimp
57
57
  end
58
58
 
59
59
  def parse_options(options = {})
60
- @offset = options['start'] if options.key? 'start'
61
- @page_size = options['page_size'] if options.key? 'page_size'
60
+ if options
61
+ @offset = options['start'] if options.key? 'start'
62
+ @page_size = options['page_size'] if options.key? 'page_size'
63
+ end
64
+
62
65
  invalidate_current_page
63
66
  end
64
67
 
@@ -11,8 +11,8 @@ module Mailchimp
11
11
 
12
12
  def initialize(client, data, collection_path = '')
13
13
  @client = client
14
- @collection_path = collection_path
15
14
  @data = data
15
+ @collection_path = collection_path
16
16
  #- puts @data # debug
17
17
  end
18
18
 
@@ -36,15 +36,15 @@ module Mailchimp
36
36
  end
37
37
  end
38
38
 
39
- def subclass_from(collection_class, options = {})
40
- if options.is_a? String
41
- # Use it as an id for an instance
42
- child_path = "#{path}/#{collection_class::PATH_KEY}"
43
- collection_class::CHILD_CLASS.get @client, child_path, options
44
- else
45
- # Get the collection
46
- collection_class.new @client, path, options
47
- end
39
+ def subclass_from(collection_class, *args)
40
+ id, name, options = parse_args(*args)
41
+ return subclass_instance_from(collection_class, id) if id
42
+
43
+ paging_options = options.divide_on('start', 'page_size') if options
44
+ collection = collection_class.new @client, path, paging_options
45
+
46
+ return collection.find_by collection.name_field => name if name
47
+ options.nil? || options.empty? ? collection : collection.where(options)
48
48
  end
49
49
 
50
50
  private
@@ -62,5 +62,26 @@ module Mailchimp
62
62
  message = options == {} ? key : "#{key}: #{options}"
63
63
  fail Mailchimp::Exception::UnknownAttribute, message
64
64
  end
65
+
66
+ def subclass_instance_from(collection_class, id)
67
+ child_path = "#{path}/#{collection_class::PATH_KEY}"
68
+ collection_class::CHILD_CLASS.get @client, child_path, id
69
+ end
70
+
71
+ def parse_args(*args)
72
+ first_arg = args.shift
73
+ second_arg = args.shift
74
+
75
+ if first_arg.is_a? String
76
+ id_and_name_from(first_arg) << second_arg
77
+ else
78
+ [nil, nil, first_arg]
79
+ end
80
+ end
81
+
82
+ # If string is a hex string assume it's an id, otherwise it's a name
83
+ def id_and_name_from(string)
84
+ string =~ /[^0-9a-f]/i ? [nil, string] : [string, nil]
85
+ end
65
86
  end
66
87
  end
@@ -9,6 +9,7 @@ module Mailchimp
9
9
  end
10
10
 
11
11
  class InterestCategories < Collection
12
+ NAME_FIELD = 'title'
12
13
  PATH_KEY = 'interest-categories'
13
14
  DATA_KEY = 'categories'
14
15
  CHILD_CLASS = InterestCategory
@@ -26,8 +26,8 @@ module Mailchimp
26
26
  @first_name = @last_name = @name = nil
27
27
  end
28
28
 
29
- def parse_name_from(new_data)
30
- clean_data = new_data.deep_stringify_keys
29
+ def parse_name_from(data)
30
+ clean_data = data.deep_stringify_keys
31
31
  fname, lname = name_parts_from clean_data
32
32
 
33
33
  merge_fields = {}
@@ -38,13 +38,13 @@ module Mailchimp
38
38
  additional_data.merge clean_data
39
39
  end
40
40
 
41
- def name_parts_from(clean_data)
42
- new_name = clean_data.delete('name')
41
+ def name_parts_from(data)
42
+ new_name = data.delete('name')
43
43
  name_parts = new_name ? new_name.split : []
44
44
 
45
45
  [
46
- clean_data.delete('first_name') || name_parts[0],
47
- clean_data.delete('last_name') || name_parts[1]
46
+ data.delete('first_name') || name_parts[0],
47
+ data.delete('last_name') || name_parts[1]
48
48
  ]
49
49
  end
50
50
  end
@@ -1,3 +1,3 @@
1
1
  module Mailchimp
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Accept-Encoding:
13
13
  - gzip, deflate
14
14
  Authorization:
15
- - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
15
+ - apikey vcr_playback-us11
16
16
  User-Agent:
17
17
  - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
18
18
  response:
@@ -56,7 +56,7 @@ http_interactions:
56
56
  Accept-Encoding:
57
57
  - gzip, deflate
58
58
  Authorization:
59
- - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
59
+ - apikey vcr_playback-us11
60
60
  User-Agent:
61
61
  - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
62
62
  response:
@@ -100,7 +100,7 @@ http_interactions:
100
100
  Accept-Encoding:
101
101
  - gzip, deflate
102
102
  Authorization:
103
- - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
103
+ - apikey vcr_playback-us11
104
104
  User-Agent:
105
105
  - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
106
106
  response:
@@ -143,7 +143,7 @@ http_interactions:
143
143
  Accept-Encoding:
144
144
  - gzip, deflate
145
145
  Authorization:
146
- - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
146
+ - apikey vcr_playback-us11
147
147
  User-Agent:
148
148
  - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
149
149
  response:
@@ -173,4 +173,220 @@ http_interactions:
173
173
  14:50:15","member_rating":2,"last_changed":"2015-07-07T11:29:25+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca","_links":[{"rel":"self","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"parent","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json"},{"rel":"update","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"PATCH","schema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"delete","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"DELETE"},{"rel":"activity","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/activity","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"},{"rel":"goals","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/goals","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"},{"rel":"notes","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/notes","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"}]}'
174
174
  http_version:
175
175
  recorded_at: Tue, 07 Jul 2015 11:29:27 GMT
176
+ - request:
177
+ method: get
178
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists?count=500&exclude_fields=lists._links,_links&offset=0
179
+ body:
180
+ encoding: US-ASCII
181
+ string: ''
182
+ headers:
183
+ Accept:
184
+ - "*/*; q=0.5, application/xml"
185
+ Accept-Encoding:
186
+ - gzip, deflate
187
+ Authorization:
188
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
189
+ User-Agent:
190
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
191
+ response:
192
+ status:
193
+ code: 200
194
+ message: OK
195
+ headers:
196
+ Server:
197
+ - nginx
198
+ Content-Type:
199
+ - application/json; charset=utf-8
200
+ Content-Length:
201
+ - '1173'
202
+ X-Request-Id:
203
+ - 7a1c4e60-2ab4-4ce4-9c61-a63a08678de4
204
+ Link:
205
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Collection.json>; rel="describedBy"
206
+ Vary:
207
+ - Accept-Encoding
208
+ Date:
209
+ - Wed, 08 Jul 2015 15:15:34 GMT
210
+ Connection:
211
+ - keep-alive
212
+ body:
213
+ encoding: ASCII-8BIT
214
+ string: '{"lists":[{"id":"e73f5910ca","name":"My first list","contact":{"company":"InSite
215
+ Arts","address1":"300 Burdett Road","address2":"London","city":"London","state":"","zip":"E14
216
+ 7DQ","country":"262","phone":"07917153555"},"permission_reminder":"Opt-in
217
+ 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-manage.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}'
218
+ http_version:
219
+ recorded_at: Wed, 08 Jul 2015 15:15:34 GMT
220
+ - request:
221
+ method: get
222
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=500&exclude_fields=members._links,_links&offset=0
223
+ body:
224
+ encoding: US-ASCII
225
+ string: ''
226
+ headers:
227
+ Accept:
228
+ - "*/*; q=0.5, application/xml"
229
+ Accept-Encoding:
230
+ - gzip, deflate
231
+ Authorization:
232
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
233
+ User-Agent:
234
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
235
+ response:
236
+ status:
237
+ code: 200
238
+ message: OK
239
+ headers:
240
+ Server:
241
+ - nginx
242
+ Content-Type:
243
+ - application/json; charset=utf-8
244
+ Content-Length:
245
+ - '1248'
246
+ X-Request-Id:
247
+ - 968e4718-b470-40ec-975b-357db8494fcf
248
+ Link:
249
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json>;
250
+ rel="describedBy"
251
+ Vary:
252
+ - Accept-Encoding
253
+ Date:
254
+ - Wed, 08 Jul 2015 15:15:34 GMT
255
+ Connection:
256
+ - keep-alive
257
+ body:
258
+ encoding: ASCII-8BIT
259
+ string: '{"members":[{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
260
+ 14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"},{"id":"a81216d35b4cbfa18632867228be02da","email_address":"bob@sayers.cc","unique_email_id":"3f73c23e26","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Bob","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
261
+ 14:50:39","member_rating":2,"last_changed":"2015-06-27T14:50:39+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"}],"list_id":"e73f5910ca","total_items":2}'
262
+ http_version:
263
+ recorded_at: Wed, 08 Jul 2015 15:15:34 GMT
264
+ - request:
265
+ method: get
266
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members?count=500&exclude_fields=members._links,_links&offset=0
267
+ body:
268
+ encoding: US-ASCII
269
+ string: ''
270
+ headers:
271
+ Accept:
272
+ - "*/*; q=0.5, application/xml"
273
+ Accept-Encoding:
274
+ - gzip, deflate
275
+ Authorization:
276
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
277
+ User-Agent:
278
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
279
+ response:
280
+ status:
281
+ code: 200
282
+ message: OK
283
+ headers:
284
+ Server:
285
+ - nginx
286
+ Content-Type:
287
+ - application/json; charset=utf-8
288
+ Content-Length:
289
+ - '1248'
290
+ X-Request-Id:
291
+ - f9d7a11e-0935-41b7-abae-1bda642326c2
292
+ Link:
293
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json>;
294
+ rel="describedBy"
295
+ Vary:
296
+ - Accept-Encoding
297
+ Date:
298
+ - Wed, 08 Jul 2015 15:15:34 GMT
299
+ Connection:
300
+ - keep-alive
301
+ body:
302
+ encoding: ASCII-8BIT
303
+ string: '{"members":[{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
304
+ 14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"},{"id":"a81216d35b4cbfa18632867228be02da","email_address":"bob@sayers.cc","unique_email_id":"3f73c23e26","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Bob","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
305
+ 14:50:39","member_rating":2,"last_changed":"2015-06-27T14:50:39+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca"}],"list_id":"e73f5910ca","total_items":2}'
306
+ http_version:
307
+ recorded_at: Wed, 08 Jul 2015 15:15:34 GMT
308
+ - request:
309
+ method: get
310
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/interest-categories?count=500&exclude_fields=categories._links,_links&offset=0
311
+ body:
312
+ encoding: US-ASCII
313
+ string: ''
314
+ headers:
315
+ Accept:
316
+ - "*/*; q=0.5, application/xml"
317
+ Accept-Encoding:
318
+ - gzip, deflate
319
+ Authorization:
320
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
321
+ User-Agent:
322
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
323
+ response:
324
+ status:
325
+ code: 200
326
+ message: OK
327
+ headers:
328
+ Server:
329
+ - nginx
330
+ Content-Type:
331
+ - application/json; charset=utf-8
332
+ Content-Length:
333
+ - '241'
334
+ X-Request-Id:
335
+ - 63c50ed8-0b5f-4e83-a097-385bc9ed39db
336
+ Link:
337
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/InterestCategories/Collection.json>;
338
+ rel="describedBy"
339
+ Vary:
340
+ - Accept-Encoding
341
+ Date:
342
+ - Wed, 08 Jul 2015 15:16:05 GMT
343
+ Connection:
344
+ - keep-alive
345
+ body:
346
+ encoding: ASCII-8BIT
347
+ string: '{"list_id":"e73f5910ca","categories":[{"list_id":"e73f5910ca","id":"f349987e8f","title":"Sex","display_order":0,"type":"radio"},{"list_id":"e73f5910ca","id":"bc914b7356","title":"Days","display_order":1,"type":"checkboxes"}],"total_items":2}'
348
+ http_version:
349
+ recorded_at: Wed, 08 Jul 2015 15:16:05 GMT
350
+ - request:
351
+ method: get
352
+ uri: https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151
353
+ body:
354
+ encoding: US-ASCII
355
+ string: ''
356
+ headers:
357
+ Accept:
358
+ - "*/*; q=0.5, application/xml"
359
+ Accept-Encoding:
360
+ - gzip, deflate
361
+ Authorization:
362
+ - apikey <%= ENV['MAILCHIMP_API_KEY'] %>
363
+ User-Agent:
364
+ - Mailchimp API v3 Ruby gem https://rubygems.org/gems/mailchimp_api_v3
365
+ response:
366
+ status:
367
+ code: 200
368
+ message: OK
369
+ headers:
370
+ Server:
371
+ - nginx
372
+ Content-Type:
373
+ - application/json; charset=utf-8
374
+ Content-Length:
375
+ - '2082'
376
+ X-Request-Id:
377
+ - fa15d507-e78c-4d90-87d4-9a69c89d1c57
378
+ Link:
379
+ - <https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json>; rel="describedBy"
380
+ Vary:
381
+ - Accept-Encoding
382
+ Date:
383
+ - Wed, 08 Jul 2015 15:16:05 GMT
384
+ Connection:
385
+ - keep-alive
386
+ body:
387
+ encoding: ASCII-8BIT
388
+ string: '{"id":"140b91c107d2058dee730e75be0b1151","email_address":"ann@sayers.cc","unique_email_id":"37a55cdc48","email_type":"html","status":"subscribed","merge_fields":{"FNAME":"Ann","LNAME":"Example"},"interests":{"ca7ab24b53":false},"stats":{"avg_open_rate":0,"avg_click_rate":0},"ip_signup":"","timestamp_signup":"","ip_opt":"86.163.13.133","timestamp_opt":"2015-06-27
389
+ 14:50:15","member_rating":2,"last_changed":"2015-07-07T12:05:57+00:00","language":"","vip":false,"email_client":"","location":{"latitude":0,"longitude":0,"gmtoff":0,"dstoff":0,"country_code":"","timezone":""},"list_id":"e73f5910ca","_links":[{"rel":"self","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"parent","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Collection.json"},{"rel":"update","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"PATCH","schema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Instance.json"},{"rel":"delete","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151","method":"DELETE"},{"rel":"activity","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/activity","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json"},{"rel":"goals","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/goals","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json"},{"rel":"notes","href":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/3.0/lists/e73f5910ca/members/140b91c107d2058dee730e75be0b1151/notes","method":"GET","targetSchema":"https://<%= ENV['MAILCHIMP_DC'] %>.api.mailchimp.com/schema/3.0/Lists/Members/Notes/Collection.json"}]}'
390
+ http_version:
391
+ recorded_at: Wed, 08 Jul 2015 15:16:05 GMT
176
392
  recorded_with: VCR 2.9.3
@@ -28,6 +28,12 @@ describe Mailchimp::List, vcr: { cassette_name: 'list' } do
28
28
  expect(members.sample).to be_a Mailchimp::List::Member
29
29
  end
30
30
 
31
+ it 'gets a subset of members' do
32
+ members = list.members last_name: 'Example'
33
+ expect(members).to be_an Array
34
+ expect(members.sample).to be_a Mailchimp::List::Member
35
+ end
36
+
31
37
  it 'has a interest_categories collection' do
32
38
  interest_categories = list.interest_categories
33
39
  expect(interest_categories).to be_an Array
@@ -51,5 +57,11 @@ describe Mailchimp::List, vcr: { cassette_name: 'list' } do
51
57
  expect(member.id).to eq id
52
58
  expect(member.email_address).to eq email_address
53
59
  end
60
+
61
+ it 'gets a member by name' do
62
+ member = list.members 'Ann Example'
63
+ expect(member).to be_a Mailchimp::List::Member
64
+ expect(member.id).to eq id
65
+ end
54
66
  end
55
67
  end
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.9
4
+ version: 0.0.11
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-08 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -282,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  version: '0'
283
283
  requirements: []
284
284
  rubyforge_project:
285
- rubygems_version: 2.4.8
285
+ rubygems_version: 2.4.7
286
286
  signing_key:
287
287
  specification_version: 4
288
288
  summary: 'Example: mailchimp.lists("My first list").member("ann@example.com")'
@@ -314,4 +314,3 @@ test_files:
314
314
  - spec/spec_helper.rb
315
315
  - spec/support/api_key.rb
316
316
  - spec/support/vcr_setup.rb
317
- has_rdoc: