slack-ruby-bot-server-mailchimp 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +12 -0
- data/lib/slack-ruby-bot-server/mailchimp/lifecycle.rb +5 -2
- data/lib/slack-ruby-bot-server/mailchimp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeebcc779ee9d49dcd06717bd9f4c559fad159b5d731c1af3f2bb6a466ace27e
|
4
|
+
data.tar.gz: a362d30421360f06cd8cc666a5b604bb6f42ac52046a0c01615841551c79aee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 447dbb00d03066e3af0fb651fcdd15c5bd526e8d50abf95101dd52f442e7ac379beecdcf0ec2d3e5f4967cd00756a687db8aa9481a1f006a794da98c0c90189f
|
7
|
+
data.tar.gz: 0d1e2bcaf746bc67d74cd2aeb7d1c453b205f8630637c68b2aadd15a01fb21317bfaa57ea1dd87618019d38c774a3c557cfd64c31f31bb67976fb118145a47f0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
### Changelog
|
2
2
|
|
3
|
+
#### 0.2.0 (2019/4/6)
|
4
|
+
|
5
|
+
* [#2](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/pull/2): Configuration options `member_tags` and `additional_merge_fields` can now be `Proc` - [@dblock](https://github.com/dblock).
|
6
|
+
|
3
7
|
#### 0.1.0 (2019/3/23)
|
4
8
|
|
5
9
|
* Initial public release - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -33,6 +33,12 @@ If your `Team` model responds to `.tags`, those will be attached to new subscrip
|
|
33
33
|
SlackRubyBotServer::Mailchimp.config.member_tags = ['my_bot']
|
34
34
|
```
|
35
35
|
|
36
|
+
This can be a function that accepts a team and callback options.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
SlackRubyBotServer::Mailchimp.config.member_tags = ->(team, options) { [team.tags] }
|
40
|
+
```
|
41
|
+
|
36
42
|
### Additional Profile Information
|
37
43
|
|
38
44
|
The default member profile information that appears in Mailchimp under "Profile Information" for each new subscriber contains the user's email address, first and last name from Slack. You can supplement this data with `additional_merge_fields`.
|
@@ -41,6 +47,12 @@ The default member profile information that appears in Mailchimp under "Profile
|
|
41
47
|
SlackRubyBotServer::Mailchimp.config.additional_merge_fields = { 'BOT' => 'MyBot' }
|
42
48
|
```
|
43
49
|
|
50
|
+
This can be a function that accepts a team and callback options.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
SlackRubyBotServer::Mailchimp.config.additional_merge_fields = ->(team, options) { { 'TEAM' => team.name } }
|
54
|
+
```
|
55
|
+
|
44
56
|
### Double Opt-In
|
45
57
|
|
46
58
|
This integration subscribes users with double opt-in by default. Configure `member_status` to disable double opt-in. See [this doc](https://developer.mailchimp.com/documentation/mailchimp/guides/manage-subscribers-with-the-mailchimp-api) for more details.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error,
|
1
|
+
SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error, options|
|
2
2
|
raise 'missing ENV["MAILCHIMP_API_KEY"]' unless SlackRubyBotServer::Mailchimp.config.mailchimp_api_key
|
3
3
|
raise 'missing ENV["MAILCHIMP_LIST_ID"]' unless SlackRubyBotServer::Mailchimp.config.mailchimp_list_id
|
4
4
|
|
@@ -15,6 +15,7 @@ SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error,
|
|
15
15
|
|
16
16
|
# fetch and merge member tags
|
17
17
|
tags = SlackRubyBotServer::Mailchimp.config.additional_member_tags
|
18
|
+
tags = tags.call(team, options) if tags.respond_to?(:call)
|
18
19
|
tags = (tags + team.tags).uniq if team.respond_to?(:tags)
|
19
20
|
|
20
21
|
member = mailchimp_list.members.where(email_address: profile.email).first
|
@@ -28,7 +29,9 @@ SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error,
|
|
28
29
|
end
|
29
30
|
|
30
31
|
# merge fields
|
31
|
-
merge_fields = SlackRubyBotServer::Mailchimp.config.additional_merge_fields
|
32
|
+
merge_fields = SlackRubyBotServer::Mailchimp.config.additional_merge_fields
|
33
|
+
merge_fields = merge_fields.call(team, options) if merge_fields.respond_to?(:call)
|
34
|
+
merge_fields = merge_fields.merge(
|
32
35
|
'FNAME' => profile.first_name.to_s,
|
33
36
|
'LNAME' => profile.last_name.to_s
|
34
37
|
)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-bot-server-mailchimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mailchimp_api_v3
|