effective_mailchimp 0.5.1 → 0.5.2

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: 42b138c379e2bef73c47ff7dfdf53ed004505b0e892ff407a16558cfa2deac4b
4
- data.tar.gz: 199f1d58e6f32d182c80cfd5be9d4ca970bbf828944820563af7319126ce6ea0
3
+ metadata.gz: 57f2e87a71e74c97178552f620fa255eb992d7ba6329681f283c140205c7b991
4
+ data.tar.gz: 0b4a7b098353735f7aae1dbf7cb857477fdd780f1fef3f15ea1318f4383ff434
5
5
  SHA512:
6
- metadata.gz: 55ffa0423f7a02d94d3f74113b9139f44e71943b9748a82106d54c3ddf93abf26057c86755fec0a1a058e1706052aad79e4100066e7cc8fe0c3c9560331c61d5
7
- data.tar.gz: 6306b88940c840bf58f099436362e0c386e440ac1e511e42c088a163f8cdc322b8597e30c9554b95f54e0a93fccf0f639c7b63f323475a7a19e7e6ca63aaa412
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: true)
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveMailchimp
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.5.2'.freeze
3
3
  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.5.1
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-03-18 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails