effective_mailchimp 0.12.1 → 0.12.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: aa9d96445bf95082e5171bc0926653d0b05721fa92851615f982dc59b5c9e530
4
- data.tar.gz: e163f4cda78afbbbadc2dbf23a91ee087098d0a49c3fdfeb90d1f81fe4c1c108
3
+ metadata.gz: f2fad1ea962c5ce92c425a1a7f298f2e3a55893ed243cf5ebfeba361f1453158
4
+ data.tar.gz: b846cabc690f49d38314448c147e837f16934bc99a5240fca2d6b8bd2c977d73
5
5
  SHA512:
6
- metadata.gz: 4831da7064dc4f21da2974bd0d832931672d2130b768aa2e33294b2dc3a784f968a3db3328da3b2ae9239eed4f261559f28f17c25ef1f8d8091a641529d82eac
7
- data.tar.gz: b8cf3d3377c1c8bf5152d59f677eb3a0bfaf3e081587163edddb6f4cf5573479ba5d30c53076ec2f5a1474adefbcfb9063c58ec9fb444703b044f8afa4dd02f5
6
+ metadata.gz: e1e34ee35a3061e812dc7dbb8140c9712cd0836eae94b074e4f2a3fb2bd5eb442652786c2096a96cc8d0e8de0e74ea980cc5e01182b384787690091004c35f60
7
+ data.tar.gz: 22d4b527af3de708c92c6d0b784b6092bc11e2e9d5e0c95cb6b010f415501d6171e2415124b2c0214c163937218035764e53d38725d4d2b61605879bde1c8947
@@ -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
- mailchimp_subscribe_to_force_subscribe!
36
+ mailchimp_subscribe_all!
37
37
  end
38
38
 
39
39
  # The user updated the form
@@ -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
- mailchimp_lists = Effective::MailchimpList.where(force_subscribe: true).to_a
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
- mailchimp_subscribe!(mailchimp_lists)
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveMailchimp
2
- VERSION = '0.12.1'.freeze
2
+ VERSION = '0.12.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.12.1
4
+ version: 0.12.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: 2025-12-18 00:00:00.000000000 Z
11
+ date: 2025-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails