effective_mailchimp 0.10.0 → 0.11.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66bc41e595203956e8013eed736d6664071e4d127f4c9e6cbe7ddeffa8767ab8
|
4
|
+
data.tar.gz: 10b66d021fd0a4fad1f1fdf99a3262cae368a67f71d66846e9513496157eb5b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bbee49aacdc23722219b5070cc536b3175a137802d06e63528145f4d039db06250d39fddda39e6b8ed26195fd5e65fc0a19c77c279034bea139aa0eec20f738
|
7
|
+
data.tar.gz: 1ab7156edf277c617c2a2810bb97e5f33293727c0fa4f30d1be33f95e949641873c241890cabc10df4dbebdc936797cf0d187a8cd0f3bcbcd5f95d4b90559305
|
@@ -16,7 +16,7 @@ module EffectiveMailchimpUser
|
|
16
16
|
def effective_mailchimp_user?; true; end
|
17
17
|
|
18
18
|
def require_mailchimp_update_fields
|
19
|
-
['email', 'last_name', 'first_name']
|
19
|
+
['id', 'email', 'last_name', 'first_name']
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -33,10 +33,14 @@ module EffectiveMailchimpUser
|
|
33
33
|
includes(mailchimp_list_members: [:mailchimp_list])
|
34
34
|
}
|
35
35
|
|
36
|
+
# A new user is created
|
37
|
+
after_commit(on: [:create], if: -> { EffectiveMailchimp.api_present? }, unless: -> { EffectiveMailchimp.supressed? || @mailchimp_member_update_enqueued }) do
|
38
|
+
mailchimp_subscribe_to_force_subscribe!
|
39
|
+
end
|
40
|
+
|
36
41
|
# The user updated the form
|
37
|
-
after_commit(if: -> { mailchimp_member_update_required? }, unless: -> { EffectiveMailchimp.supressed? || @mailchimp_member_update_enqueued }) do
|
38
|
-
|
39
|
-
EffectiveMailchimpUpdateJob.perform_later(self) # This calls user.mailchimp_update! on the background
|
42
|
+
after_commit(on: [:update], if: -> { mailchimp_member_update_required? }, unless: -> { EffectiveMailchimp.supressed? || @mailchimp_member_update_enqueued }) do
|
43
|
+
mailchimp_update_async!
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
@@ -257,6 +261,14 @@ module EffectiveMailchimpUser
|
|
257
261
|
save!
|
258
262
|
end
|
259
263
|
|
264
|
+
# Subscribe to force_subscribe lists
|
265
|
+
def mailchimp_subscribe_to_force_subscribe!
|
266
|
+
mailchimp_lists = Effective::MailchimpList.where(force_subscribe: true).to_a
|
267
|
+
return unless mailchimp_lists.present?
|
268
|
+
|
269
|
+
mailchimp_subscribe!(mailchimp_lists)
|
270
|
+
end
|
271
|
+
|
260
272
|
private
|
261
273
|
|
262
274
|
def mailchimp_with_retries(retries: 3, wait: 2, &block)
|
@@ -274,6 +286,8 @@ module EffectiveMailchimpUser
|
|
274
286
|
end
|
275
287
|
|
276
288
|
def mailchimp_member_update_required?
|
289
|
+
return false unless EffectiveMailchimp.api_present?
|
290
|
+
|
277
291
|
return false unless mailchimp_user_form_action
|
278
292
|
return false if self.class.respond_to?(:effective_memberships_user) && membership&.mailchimp_membership_update_required?
|
279
293
|
|
@@ -159,7 +159,7 @@ module Effective
|
|
159
159
|
payload = {
|
160
160
|
email_address: member.user.email,
|
161
161
|
status: (member.subscribed ? 'subscribed' : 'unsubscribed'),
|
162
|
-
merge_fields: merge_fields.
|
162
|
+
merge_fields: merge_fields.transform_values { |value| value || '' },
|
163
163
|
interests: member.interests_hash.presence
|
164
164
|
}.compact
|
165
165
|
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.11.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: 2024-12-
|
11
|
+
date: 2024-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|