effective_mailchimp 0.2.1 → 0.2.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: b36ddeb033917790b43fbe0d21fee076f284c4d1d397a4bc18b2ff6135d014aa
4
- data.tar.gz: 7d2ac0accd18fc0b1b5756b6a548329465f3d6661540a668d929f762efdbd6e3
3
+ metadata.gz: b79356ccea893a1ee2ccc083ed29b747eabace0b22cda9bc78763ac9eff0874f
4
+ data.tar.gz: c5d7f907fdb4e8c7e038df057c8e3917a7f6aa85c12570cd81fed6c45b84f31d
5
5
  SHA512:
6
- metadata.gz: b0e524dbc00a33d316d1465bbc3f94ba0d79864d1693ac81dc57ecc1f60bb9af627540e33021d6a061a12f99014dbb3993ccb80fa1e6786157cb29080dcdea5a
7
- data.tar.gz: 2ae3e23a1662c440fef0d75a758a840242c8b4d758ec28f122ae7fbee38a2f03527ca14a46b8470662a033b36df9cfca88141dc71d1546ecc63e4ae427d52b1c
6
+ metadata.gz: b1836f0b24aca7f3e1e46ee820ecf89b5755a892e64ddf96932c6d6098c3179af88ece786f46b7831e3eec8235b98eeb61baeec5d9d79e3c67f25db86a27cacd
7
+ data.tar.gz: 40d8c3c96f42ef42ce8876069440f541c38122aa833cbe127251fcc567603e184829b66c81a1582c3a91f949d5a7e270c3fc6e6bbbf2f59a0b5913ceaa4bdfe7
@@ -35,6 +35,7 @@ module EffectiveMailchimpUser
35
35
  end
36
36
 
37
37
  # These are the fields we push to Mailchimp on list_add and list_update
38
+ # Keys can only be 10 characters long
38
39
  def default_mailchimp_merge_fields
39
40
  atts = {}
40
41
 
@@ -54,7 +55,7 @@ module EffectiveMailchimpUser
54
55
  'CITY': address&.city,
55
56
  'PROVINCE': address&.province,
56
57
  'COUNTRY': address&.country,
57
- 'POSTAL_CODE': address&.postal_code
58
+ 'POSTALCODE': address&.postal_code
58
59
  )
59
60
  end
60
61
 
@@ -56,6 +56,8 @@ module Effective
56
56
  end
57
57
 
58
58
  def add_merge_field(id, name:, type: :text)
59
+ raise("invalid mailchimp merge key: #{name}. Must be 10 or fewer characters") if name.to_s.length > 10
60
+
59
61
  payload = { name: name.to_s.titleize, tag: name.to_s, type: type }
60
62
 
61
63
  begin
@@ -1,3 +1,3 @@
1
1
  module EffectiveMailchimp
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -5,4 +5,20 @@ namespace :effective_mailchimp do
5
5
  load "#{__dir__}/../../db/seeds.rb"
6
6
  end
7
7
 
8
+ # bundle exec rake effective_mailchimp:create_mailchimp_merge_fields
9
+ task create_mailchimp_merge_fields: :environment do
10
+ merge_fields = User.new.mailchimp_merge_fields()
11
+
12
+ Effective::MailchimpList.sync!
13
+
14
+ collection = Effective::MailchimpList.all
15
+
16
+ collection.find_each do |list|
17
+ puts "Creating #{list} merge fields"
18
+ list.create_mailchimp_merge_fields!(merge_fields)
19
+ end
20
+
21
+ puts 'All done'
22
+ end
23
+
8
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_mailchimp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect