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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b79356ccea893a1ee2ccc083ed29b747eabace0b22cda9bc78763ac9eff0874f
|
4
|
+
data.tar.gz: c5d7f907fdb4e8c7e038df057c8e3917a7f6aa85c12570cd81fed6c45b84f31d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
'
|
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
|
@@ -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
|