effective_mailchimp 0.12.1 → 0.13.0
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 +4 -4
- data/app/jobs/effective_mailchimp_sync_users_job.rb +1 -1
- data/app/models/concerns/effective_mailchimp_user.rb +25 -6
- data/app/models/effective/mailchimp_category.rb +1 -1
- data/app/models/effective/mailchimp_list.rb +1 -1
- data/lib/effective_mailchimp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31dffa22772d034a5df21da6e0bd15113175fd449d806fd2e898bfdc22c9b03e
|
|
4
|
+
data.tar.gz: 142a406ed9f436444f37679daf42dcbda703cfd69c67ff37ba3f94848f7cc80e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec26c38b432ebeda82f6a3755f70ba4b5c11730021dba16d5235000e998b3bf51650c664d3572baef6811e49b359e706824f78b8a144236dcb98e9be3f726f85
|
|
7
|
+
data.tar.gz: d866e478901bb322b46757b57c7ef8429c4e783f92d839733bf0b3e32e3c9c1e25bce28a178c5e170c1f7279dfaccbbbb73277f51eb91439e03b2758996154e3
|
|
@@ -15,7 +15,7 @@ class EffectiveMailchimpSyncUsersJob < ApplicationJob
|
|
|
15
15
|
user.mailchimp_update!(api: api)
|
|
16
16
|
rescue => e
|
|
17
17
|
EffectiveLogger.error(e.message, associated: user) if defined?(EffectiveLogger)
|
|
18
|
-
|
|
18
|
+
EffectiveResources.send_error(e, user_id: user.id)
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ module EffectiveMailchimpUser
|
|
|
33
33
|
|
|
34
34
|
# A new user is created
|
|
35
35
|
after_commit(on: [:create], if: -> { EffectiveMailchimp.api_present? }, unless: -> { EffectiveMailchimp.supressed? || @mailchimp_member_update_enqueued }) do
|
|
36
|
-
|
|
36
|
+
mailchimp_subscribe_all!
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# The user updated the form
|
|
@@ -260,8 +260,8 @@ module EffectiveMailchimpUser
|
|
|
260
260
|
# Nothing to do.
|
|
261
261
|
end
|
|
262
262
|
|
|
263
|
-
if
|
|
264
|
-
|
|
263
|
+
if !EffectiveMailchimp.silence_api_errors?
|
|
264
|
+
EffectiveResources.send_error(e, user_id: id || 'nil')
|
|
265
265
|
end
|
|
266
266
|
|
|
267
267
|
end
|
|
@@ -270,12 +270,31 @@ module EffectiveMailchimpUser
|
|
|
270
270
|
without_mailchimp_update_async { save! }
|
|
271
271
|
end
|
|
272
272
|
|
|
273
|
+
# No longer used. We use mailchimp_subscribe_all! instead
|
|
273
274
|
# Subscribe to force_subscribe lists
|
|
274
|
-
def mailchimp_subscribe_to_force_subscribe!
|
|
275
|
-
|
|
275
|
+
# def mailchimp_subscribe_to_force_subscribe!
|
|
276
|
+
# mailchimp_lists = Effective::MailchimpList.where(force_subscribe: true).to_a
|
|
277
|
+
# return unless mailchimp_lists.present?
|
|
278
|
+
|
|
279
|
+
# mailchimp_subscribe!(mailchimp_lists)
|
|
280
|
+
# end
|
|
281
|
+
|
|
282
|
+
def mailchimp_subscribe_all!
|
|
283
|
+
mailchimp_lists = Effective::MailchimpList.subscribable.sorted.all.to_a
|
|
276
284
|
return unless mailchimp_lists.present?
|
|
277
285
|
|
|
278
|
-
|
|
286
|
+
mailchimp_lists.each do |mailchimp_list|
|
|
287
|
+
member = build_mailchimp_list_member(mailchimp_list: mailchimp_list)
|
|
288
|
+
member.assign_attributes(subscribed: true)
|
|
289
|
+
|
|
290
|
+
mailchimp_list.mailchimp_categories.each do |mailchimp_category|
|
|
291
|
+
mailchimp_interests = mailchimp_category.mailchimp_interests
|
|
292
|
+
mailchimp_interests.each { |mailchimp_interest| member.build_interests(mailchimp_interest) }
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# This sets up the after_commit to run the mailchimp_update! job
|
|
297
|
+
save!
|
|
279
298
|
end
|
|
280
299
|
|
|
281
300
|
def without_mailchimp_update_async(&block)
|
|
@@ -3,7 +3,7 @@ module Effective
|
|
|
3
3
|
self.table_name = (EffectiveMailchimp.mailchimp_categories_table_name || :mailchimp_categories).to_s
|
|
4
4
|
|
|
5
5
|
belongs_to :mailchimp_list
|
|
6
|
-
has_many :mailchimp_interests
|
|
6
|
+
has_many :mailchimp_interests, -> { Effective::MailchimpInterest.sorted }, class_name: 'Effective::MailchimpInterest', inverse_of: :mailchimp_category
|
|
7
7
|
|
|
8
8
|
effective_resource do
|
|
9
9
|
mailchimp_id :string # ID of this Mailchimp InterestCategory
|
|
@@ -118,7 +118,7 @@ module Effective
|
|
|
118
118
|
user.mailchimp_subscribe!(self, subscribed: true, now: true)
|
|
119
119
|
rescue => e
|
|
120
120
|
EffectiveLogger.error(e.message, associated: user) if defined?(EffectiveLogger)
|
|
121
|
-
|
|
121
|
+
EffectiveResources.send_error(e, user_id: user.id, mailchimp_list_id: id)
|
|
122
122
|
raise(e) if Rails.env.test? || Rails.env.development?
|
|
123
123
|
end
|
|
124
124
|
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.
|
|
4
|
+
version: 0.13.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:
|
|
11
|
+
date: 2026-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|