mailchimp_api_v3 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50da97b5f8e1e28910279d7d648f719d71ab93b2
4
- data.tar.gz: ccea721d3b09e2b344bc9ce53894c846713ffafc
3
+ metadata.gz: 2af7e50f509f07dcf5f8b68abc441ef7b3450095
4
+ data.tar.gz: a6fe532cd1e757b7139609241544aafe1faba3e9
5
5
  SHA512:
6
- metadata.gz: e4d634f48ef8dabd8fbf7eb1d34b58a5f57b770826a622aeade75fd1ecbcb2a029fbbe021a8eebc6fa273b5db976e8b003b34e9aa3e878d1fdcff7b2c233fd5b
7
- data.tar.gz: a68ba6bc97a35b8cae94272cdd978e16c2fba528bdd9a8a4bc4f39fdf97e5d1bf572f3a6bd1de5532d467954ac0938442ae12c76432fb26eb37e295c5dbec724
6
+ metadata.gz: 254823f7faf6a9dc40bb7063818d95be0bd63e89b750867a5df1a5badeae0de119f1e9ae411f210f6f483abbc7f4c6946d32fa5e31695d9e852c3f5b45967077
7
+ data.tar.gz: d0f907b8bfecc8645d23b221ca8d2b647c3d5bd8b98f9b611a6bd29500a242ee0ec34c10b0c8818e8bbefe1e63436962412e37e081721de33f446f42b90bce4e
data/README.md CHANGED
@@ -57,6 +57,32 @@ member.name # => "Ann Example"
57
57
  member.update last_name: 'Williams'
58
58
  ```
59
59
 
60
+ ```ruby
61
+ # ActiveRecord-like methods
62
+ mailchimp = Mailchimp.connect
63
+ members = mailchimp.lists('e73f5910ca').where last_name: 'Example'
64
+ members.count # => 3
65
+ member = mailchimp.lists('e73f5910ca').first_or_create(
66
+ email_address: 'ann@example.com',
67
+ name: 'Ann Example',
68
+ status: 'subscribed'
69
+ )
70
+ ```
71
+
72
+ ```ruby
73
+ # Dealing with big lists
74
+ mailchimp = Mailchimp.connect
75
+ list = mailchimp.lists('e73f5910ca')
76
+
77
+ list.members.find_each do |member|
78
+ # Do something
79
+ end
80
+
81
+ list.members.find_in_pages do |members|
82
+ # Do something to a page of members
83
+ end
84
+ ```
85
+
60
86
  ### Contributing
61
87
 
62
88
  [![Developer](http://img.shields.io/badge/developer-awesome-brightgreen.svg?style=flat)](http://xenapto.com)
@@ -54,8 +54,11 @@ module Mailchimp
54
54
  instance = self.class::CHILD_CLASS.get @client, path, clean_data.delete('id')
55
55
  instance ? instance.update(clean_data) : create(clean_data)
56
56
  else
57
- find_by(clean_data)
57
+ instance = find_by(clean_data)
58
+ create(clean_data) unless instance
58
59
  end
60
+
61
+ instance
59
62
  end
60
63
 
61
64
  def name_field
@@ -1,3 +1,3 @@
1
1
  module Mailchimp
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.15'
3
3
  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.14
4
+ version: 0.0.15
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-11 00:00:00.000000000 Z
11
+ date: 2015-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client