effective_mailchimp 0.3.0 → 0.4.0

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
  SHA256:
3
- metadata.gz: 6a5caed2328b202f012d4c813afb0c5038aa304b6b7efdcf30097bcc7ff7be2e
4
- data.tar.gz: ed2fb79473591925eaf5ac5f2556464afb01269370e173215988afa33630dd12
3
+ metadata.gz: 214e9412954d0415e5263797289e58956f53b56828715aaf390e7c9d7db09f61
4
+ data.tar.gz: 6a029f0bb604421755c58cfa5f988d581cc688f990de102901f2e5938a643980
5
5
  SHA512:
6
- metadata.gz: 272d0eda1823ee5df64c6f32612707cf5a80cabcd27b8cfd1ed346b2dc6e95142482e81fbc4f8c2bbd8afbce92be580898685b4c6833c83728bd30a408f8f9d4
7
- data.tar.gz: 33c4543526fe5b465f4a2252482fd5d9774f62a06f2b82cc825274599f0e3f53f0a5f48891e66c4cb983451669f23e4e201c7979f4207e30e0051c7f49696f69
6
+ metadata.gz: 8e6b26604ad0d1c0e094706da41be5280f757073747a2203de09854990562f0a947022f3e05223c1e38bca818c77840d320a589d3bd1968f624a1dfd26b9e911
7
+ data.tar.gz: 18513f661502df66716ddf9b293ae05fd1b5d14c6e2ff68678172b3b3d4d90b606238dfe98979f38cf85fefa8562e92e8fa0dbc9b85e1ce2dd08ce247ca8100d
@@ -183,13 +183,13 @@ module EffectiveMailchimpUser
183
183
 
184
184
  assign_attributes(mailchimp_user_form_action: nil)
185
185
 
186
- mailchimp_list_members.map do |member|
186
+ mailchimp_list_members.each do |member|
187
187
  if member.mailchimp_id.blank? && member.subscribed?
188
188
  list_member = api.list_member_add(member)
189
- member.assign_mailchimp_attributes(list_member)
189
+ member.assign_mailchimp_attributes(list_member) if list_member.present?
190
190
  elsif member.mailchimp_id.present?
191
191
  list_member = api.list_member_update(member)
192
- member.assign_mailchimp_attributes(list_member)
192
+ member.assign_mailchimp_attributes(list_member) if list_member.present?
193
193
  end
194
194
  end
195
195
 
@@ -94,7 +94,13 @@ module Effective
94
94
  merge_fields: merge_fields.delete_if { |k, v| v.blank? }
95
95
  }
96
96
 
97
- client.lists.add_list_member(member.mailchimp_list.mailchimp_id, payload)
97
+ begin
98
+ client.lists.add_list_member(member.mailchimp_list.mailchimp_id, payload)
99
+ rescue MailchimpMarketing::ApiError => e
100
+ return false if e.status == 400 && e.to_s.downcase.include?("member in compliance state")
101
+ raise(e)
102
+ end
103
+
98
104
  end
99
105
 
100
106
  def list_member_update(member)
@@ -1,6 +1,5 @@
1
1
  module Effective
2
2
  class MailchimpList < ActiveRecord::Base
3
-
4
3
  self.table_name = (EffectiveMailchimp.mailchimp_lists_table_name || :mailchimp_lists).to_s
5
4
 
6
5
  has_many :mailchimp_list_members, dependent: :delete_all
@@ -1,7 +1,4 @@
1
1
  EffectiveMailchimp.setup do |config|
2
- # config.mailchimp_lists_table_name = :mailchimp_lists
3
- # config.mailchimp_list_members_table_name = :mailchimp_list_members
4
-
5
2
  # Layout Settings
6
3
  # Configure the Layout per controller, or all at once
7
4
  # config.layout = { application: 'application', admin: 'admin' }
@@ -1,6 +1,5 @@
1
1
  class CreateEffectiveMailchimp < ActiveRecord::Migration[6.0]
2
2
  def change
3
-
4
3
  create_table :mailchimp_lists do |t|
5
4
  t.string :mailchimp_id
6
5
  t.string :web_id
@@ -1,3 +1,3 @@
1
1
  module EffectiveMailchimp
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -20,7 +20,7 @@ module EffectiveMailchimp
20
20
  end
21
21
 
22
22
  def create_migration_file
23
- migration_template ('../' * 3) + 'db/migrate/01_create_effective_mailchimp.rb.erb', 'db/migrate/create_effective_mailchimp.rb'
23
+ migration_template ('../' * 3) + 'db/migrate/101_create_effective_mailchimp.rb', 'db/migrate/create_effective_mailchimp.rb'
24
24
  end
25
25
 
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_mailchimp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-04 00:00:00.000000000 Z
11
+ date: 2023-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -211,7 +211,7 @@ files:
211
211
  - app/views/effective/mailchimp_user/_sync.html.haml
212
212
  - config/effective_mailchimp.rb
213
213
  - config/routes.rb
214
- - db/migrate/01_create_effective_mailchimp.rb.erb
214
+ - db/migrate/101_create_effective_mailchimp.rb
215
215
  - db/seeds.rb
216
216
  - lib/effective_mailchimp.rb
217
217
  - lib/effective_mailchimp/engine.rb