effective_mailchimp 0.5.0 → 0.5.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57f2e87a71e74c97178552f620fa255eb992d7ba6329681f283c140205c7b991
|
4
|
+
data.tar.gz: 0b4a7b098353735f7aae1dbf7cb857477fdd780f1fef3f15ea1318f4383ff434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac169326fba074be7af97f386d93edb215220bce91750fa8e410487d601ae7f91e496aa7b4bdcda0a290d216a0cf0ef0e80639cdd8176d2f62c7fc7690891e1f
|
7
|
+
data.tar.gz: 06edb4d4261b098133462d263fe1ec6f12d327668eba7d81a8eb765d2b8dc53352d4e71ebd5317c08a7f3d5c95c0c67ebefd5d95c08279550ad0e51063820cf0
|
@@ -50,18 +50,21 @@ module EffectiveMailchimpUser
|
|
50
50
|
|
51
51
|
# Api method to just subscribe this user to this list right now
|
52
52
|
# Pass one list or an Array of lists
|
53
|
-
def mailchimp_subscribe!(mailchimp_list)
|
53
|
+
def mailchimp_subscribe!(mailchimp_list, subscribed: true, now: false)
|
54
54
|
mailchimp_lists = Array(mailchimp_list)
|
55
55
|
raise('expected a MailchimpList') unless mailchimp_lists.all? { |list| list.kind_of?(Effective::MailchimpList) }
|
56
56
|
|
57
57
|
mailchimp_lists.each do |mailchimp_list|
|
58
58
|
member = build_mailchimp_list_member(mailchimp_list: mailchimp_list)
|
59
|
-
member.assign_attributes(subscribed:
|
59
|
+
member.assign_attributes(subscribed: subscribed)
|
60
60
|
end
|
61
61
|
|
62
62
|
# This sets up the after_commit to run the mailchimp_update! job
|
63
63
|
assign_attributes(mailchimp_user_form_action: true)
|
64
64
|
|
65
|
+
# For use in a rake task. Run the update right now
|
66
|
+
mailchimp_update! if now
|
67
|
+
|
65
68
|
save!
|
66
69
|
end
|
67
70
|
|
@@ -113,6 +116,8 @@ module EffectiveMailchimpUser
|
|
113
116
|
end
|
114
117
|
|
115
118
|
if respond_to?(:membership)
|
119
|
+
membership = memberships.first() # Individual or organization membership
|
120
|
+
|
116
121
|
atts.merge!(
|
117
122
|
'CATEGORY': membership&.categories&.to_sentence,
|
118
123
|
'STATUS': membership&.statuses&.to_sentence,
|
@@ -121,6 +126,13 @@ module EffectiveMailchimpUser
|
|
121
126
|
)
|
122
127
|
end
|
123
128
|
|
129
|
+
if self.class.respond_to?(:effective_memberships_organization_user?)
|
130
|
+
atts.merge!(
|
131
|
+
'COMPANY': representatives.map { |rep| rep.organization.to_s }.join(', ').presence,
|
132
|
+
'ROLES': representatives.flat_map { |rep| rep.roles }.compact.join(', ').presence,
|
133
|
+
)
|
134
|
+
end
|
135
|
+
|
124
136
|
atts
|
125
137
|
end
|
126
138
|
|
@@ -197,7 +209,7 @@ module EffectiveMailchimpUser
|
|
197
209
|
|
198
210
|
member.assign_mailchimp_attributes(list_member) if list_member.present?
|
199
211
|
rescue MailchimpMarketing::ApiError => e
|
200
|
-
if e.to_s.downcase.include?("cannot be subscribed")
|
212
|
+
if e.to_s.downcase.include?("cannot be subscribed") || e.to_s.downcase.include?('deleted')
|
201
213
|
member.assign_mailchimp_cannot_be_subscribed
|
202
214
|
else
|
203
215
|
raise(e)
|
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.5.
|
4
|
+
version: 0.5.2
|
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-
|
11
|
+
date: 2024-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|