monkeywrench 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -142,11 +142,13 @@ module MonkeyWrench
142
142
  # @option options [Boolean] :replace_interests (true) replace the interest groups provided (will append interest groups to existing values when false).
143
143
  def update_members(members, options = {})
144
144
  members = members.is_a?(Array) ? members : [members]
145
+ options = options.dup
145
146
  options.merge!(:id => self.id, :method => "listUpdateMember")
146
147
  members.each do |member|
147
- mailchimp_args = {:email_address => member[:email]}
148
- member[:email] = member[:new_email]
149
- member.delete(:new_email)
148
+ member = member.dup
149
+ mailchimp_args = {:email_address => member[:email],
150
+ :email => member[:email]}
151
+ member[:email] = member.delete(:new_email) if member[:new_email]
150
152
  mailchimp_args.merge!({ :merge_vars => member }.to_mailchimp)
151
153
  post(options.merge(mailchimp_args))
152
154
  end
@@ -319,6 +319,7 @@ class MonkeyWrench::ListTest < Test::Unit::TestCase
319
319
  should "accept single member's email address change as hash" do
320
320
  member = {:email => "foo@bar.com", :new_email => "bar@foo.com"}
321
321
  form_params = {:email_address => "foo@bar.com",
322
+ :email => "foo@bar.com",
322
323
  :merge_vars => {"EMAIL" => 'bar@foo.com'},
323
324
  :replace_interests => "true", :id => "my-list-id"}
324
325
  mock_chimp_post(:listUpdateMember, form_params)
@@ -329,6 +330,7 @@ class MonkeyWrench::ListTest < Test::Unit::TestCase
329
330
  members = [{:email => "foo@bar.com", :new_email => "bar@foo.com"}]
330
331
  form_params = {
331
332
  :email_address => "foo@bar.com",
333
+ :email => "foo@bar.com",
332
334
  :merge_vars => {'EMAIL' => 'bar@foo.com'},
333
335
  :replace_interests => "true", :id => "my-list-id"
334
336
  }
@@ -343,12 +345,14 @@ class MonkeyWrench::ListTest < Test::Unit::TestCase
343
345
  ]
344
346
  form_params = {
345
347
  :email_address => "foo@bar.com",
348
+ :email => "foo@bar.com",
346
349
  :merge_vars => {"EMAIL" => 'bar@foo.com'},
347
350
  :replace_interests => "true", :id => "my-list-id"
348
351
  }
349
352
  mock_chimp_post(:listUpdateMember, form_params)
350
353
  form_params = {
351
354
  :email_address => "spock@vulcan.com",
355
+ :email => "spock@vulcan.com",
352
356
  :merge_vars => {'EMAIL' => 'sylar@heroes.com'},
353
357
  :replace_interests => "true", :id => "my-list-id"
354
358
  }
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Glenn Gillen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-28 00:00:00 +00:00
17
+ date: 2010-12-12 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency