slack-ruby-bot-server-mailchimp 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/danger.yml +21 -0
- data/.github/workflows/rubocop.yml +18 -0
- data/.github/workflows/test-mongodb.yml +35 -0
- data/.github/workflows/test-postgresql.yml +36 -0
- data/CHANGELOG.md +11 -1
- data/CONTRIBUTING.md +2 -2
- data/Dangerfile +2 -0
- data/Gemfile +2 -6
- data/Gemfile.danger +6 -0
- data/README.md +23 -1
- data/RELEASING.md +4 -20
- data/lib/slack-ruby-bot-server/mailchimp/lifecycle.rb +7 -4
- data/lib/slack-ruby-bot-server/mailchimp/version.rb +1 -1
- data/slack-ruby-bot-server-mailchimp.gemspec +1 -1
- metadata +14 -11
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 766485616d688854eb10f8e7dc4995688a1b83f8e725f0b9b38c839ef48ad0d5
|
4
|
+
data.tar.gz: 80d3fe4f2c40b21877be9fe875151e1c82ecc490d7421deaf0f3ce53f74afa97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4df2b249a1b0db1389d78f7c0cf5028feca2d5983a93ea862164a0027cffefb78ca24828ecd1d0664addfdcc8ef1b69f437b4e77ff1162199a6e2ac083a6a4
|
7
|
+
data.tar.gz: 97c63866917fba27adc25a762feb21b7770b5a93ee3e032ead37676c69447259f4ca754b3a03b1c76715337d7d98c6e07e14469d5e3e58e1f8a83ad9a8d3abf0
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: danger
|
2
|
+
on: pull_request
|
3
|
+
jobs:
|
4
|
+
danger:
|
5
|
+
name: Dangerfile
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
env:
|
8
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
|
9
|
+
steps:
|
10
|
+
- name: Checkout
|
11
|
+
uses: actions/checkout@v3
|
12
|
+
with:
|
13
|
+
fetch-depth: 0
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: "2.6.2"
|
17
|
+
bundler-cache: true
|
18
|
+
- run: |
|
19
|
+
# Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
|
20
|
+
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
|
21
|
+
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: rubocop
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
rubocop:
|
7
|
+
name: RuboCop
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: Checkout
|
11
|
+
uses: actions/checkout@v3
|
12
|
+
- name: Set up Ruby
|
13
|
+
uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: "2.6.2"
|
16
|
+
bundler-cache: true
|
17
|
+
- name: Run RuboCop
|
18
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
name: test-mongodb
|
3
|
+
|
4
|
+
on: [push, pull_request]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test-mongodb:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
steps:
|
10
|
+
- name: Checkout
|
11
|
+
uses: actions/checkout@v3
|
12
|
+
- name: Setup Firefox
|
13
|
+
uses: browser-actions/setup-firefox@latest
|
14
|
+
with:
|
15
|
+
firefox-version: "54.0"
|
16
|
+
- name: Download geckodriver
|
17
|
+
uses: browser-actions/setup-geckodriver@latest
|
18
|
+
with:
|
19
|
+
geckodriver-version: "0.18.0"
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: "2.6.2"
|
23
|
+
- name: Start MongoDB
|
24
|
+
uses: supercharge/mongodb-github-action@1.7.0
|
25
|
+
with:
|
26
|
+
mongodb-version: "5"
|
27
|
+
mongodb-db: slack-ruby-bot-server-stripe_test
|
28
|
+
- name: Run tests
|
29
|
+
uses: GabrielBB/xvfb-action@v1
|
30
|
+
env:
|
31
|
+
DATABASE_ADAPTER: mongoid
|
32
|
+
with:
|
33
|
+
run: |
|
34
|
+
bundle install
|
35
|
+
bundle exec rake
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: test-postgresql
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test-postgresql:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- name: Checkout
|
10
|
+
uses: actions/checkout@v3
|
11
|
+
- name: Setup Firefox
|
12
|
+
uses: browser-actions/setup-firefox@latest
|
13
|
+
with:
|
14
|
+
firefox-version: "54.0"
|
15
|
+
- name: Download geckodriver
|
16
|
+
uses: browser-actions/setup-geckodriver@latest
|
17
|
+
with:
|
18
|
+
geckodriver-version: "0.18.0"
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: "2.6.2"
|
22
|
+
- uses: harmon758/postgresql-action@v1
|
23
|
+
with:
|
24
|
+
postgresql version: "14"
|
25
|
+
postgresql db: slack_ruby_bot_server_stripe__test
|
26
|
+
postgresql user: test
|
27
|
+
postgresql password: password
|
28
|
+
- name: Test
|
29
|
+
uses: GabrielBB/xvfb-action@v1
|
30
|
+
env:
|
31
|
+
DATABASE_ADAPTER: activerecord
|
32
|
+
DATABASE_URL: postgres://test:password@127.0.0.1:5432/slack_ruby_bot_server_stripe__test
|
33
|
+
with:
|
34
|
+
run: |
|
35
|
+
bundle install
|
36
|
+
bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
### Changelog
|
2
2
|
|
3
|
-
#### 0.
|
3
|
+
#### 0.3.0 (2023/07/26)
|
4
|
+
|
5
|
+
* [#4](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/pull/4): Replaced Travis-CI with GitHub Actions - [@dblock](https://github.com/dblock).
|
6
|
+
* [#3](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/pull/3): Fix: invalid logger reference - [@dblock](https://github.com/dblock).
|
7
|
+
* Your contribution here.
|
8
|
+
|
9
|
+
#### 0.2.0 (2019/04/06)
|
10
|
+
|
11
|
+
* [#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).
|
12
|
+
|
13
|
+
#### 0.1.0 (2019/03/23)
|
4
14
|
|
5
15
|
* Initial public release - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
@@ -12,7 +12,7 @@ Fork the [project on Github](https://github.com/slack-ruby/slack-ruby-bot-server
|
|
12
12
|
|
13
13
|
```
|
14
14
|
git clone https://github.com/contributor/slack-ruby-bot-server-mailchimp.git
|
15
|
-
cd slack-ruby-bot-server
|
15
|
+
cd slack-ruby-bot-server-mailchimp
|
16
16
|
git remote add upstream https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp.git
|
17
17
|
```
|
18
18
|
|
@@ -84,7 +84,7 @@ git push origin my-feature-branch
|
|
84
84
|
|
85
85
|
## Make a Pull Request
|
86
86
|
|
87
|
-
Go to https://github.com/contributor/slack-ruby-bot-server and select your feature branch.
|
87
|
+
Go to https://github.com/contributor/slack-ruby-bot-server-mailchimp and select your feature branch.
|
88
88
|
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
89
89
|
|
90
90
|
## Rebase
|
data/Dangerfile
CHANGED
data/Gemfile
CHANGED
@@ -3,12 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
case ENV['DATABASE_ADAPTER']
|
4
4
|
when 'mongoid' then
|
5
5
|
gem 'kaminari-mongoid'
|
6
|
-
gem 'mongoid'
|
6
|
+
gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0'
|
7
7
|
gem 'mongoid-scroll'
|
8
8
|
when 'activerecord' then
|
9
9
|
gem 'activerecord', '~> 5.0.0'
|
10
10
|
gem 'otr-activerecord', '~> 1.2.1'
|
11
|
-
gem '
|
11
|
+
gem 'pagy_cursor'
|
12
12
|
gem 'pg'
|
13
13
|
when nil then
|
14
14
|
warn "Missing ENV['DATABASE_ADAPTER']."
|
@@ -30,7 +30,3 @@ group :development, :test do
|
|
30
30
|
gem 'vcr'
|
31
31
|
gem 'webmock'
|
32
32
|
end
|
33
|
-
|
34
|
-
group :test do
|
35
|
-
gem 'slack-ruby-danger', '~> 0.1.0', require: false
|
36
|
-
end
|
data/Gemfile.danger
ADDED
data/README.md
CHANGED
@@ -2,10 +2,20 @@ Slack Ruby Bot Server Mailchimp Extension
|
|
2
2
|
=========================================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-mailchimp.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-mailchimp)
|
5
|
-
[![
|
5
|
+
[![mongodb](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/test-mongodb.yml)
|
6
|
+
[![postgresql](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/test-postgresql.yml)
|
7
|
+
[![rubocop](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/rubocop.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/actions/workflows/rubocop.yml)
|
6
8
|
|
7
9
|
A lifecycle extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that subscribes new bot users to a Mailchimp mailing list.
|
8
10
|
|
11
|
+
# Table of Contents
|
12
|
+
|
13
|
+
- [Usage](#usage)
|
14
|
+
- [Additional Member Tags](#additional-member-tags)
|
15
|
+
- [Additional Profile Information](#additional-profile-information)
|
16
|
+
- [Double Opt-In](#double-opt-in)
|
17
|
+
- [Copyright & License](#copyright--license)
|
18
|
+
|
9
19
|
### Usage
|
10
20
|
|
11
21
|
Add 'slack-ruby-bot-server-mailchimp' to Gemfile.
|
@@ -33,6 +43,12 @@ If your `Team` model responds to `.tags`, those will be attached to new subscrip
|
|
33
43
|
SlackRubyBotServer::Mailchimp.config.member_tags = ['my_bot']
|
34
44
|
```
|
35
45
|
|
46
|
+
This can be a function that accepts a team and callback options.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
SlackRubyBotServer::Mailchimp.config.member_tags = ->(team, options) { [team.tags] }
|
50
|
+
```
|
51
|
+
|
36
52
|
### Additional Profile Information
|
37
53
|
|
38
54
|
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 +57,12 @@ The default member profile information that appears in Mailchimp under "Profile
|
|
41
57
|
SlackRubyBotServer::Mailchimp.config.additional_merge_fields = { 'BOT' => 'MyBot' }
|
42
58
|
```
|
43
59
|
|
60
|
+
This can be a function that accepts a team and callback options.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
SlackRubyBotServer::Mailchimp.config.additional_merge_fields = ->(team, options) { { 'TEAM' => team.name } }
|
64
|
+
```
|
65
|
+
|
44
66
|
### Double Opt-In
|
45
67
|
|
46
68
|
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.
|
data/RELEASING.md
CHANGED
@@ -21,18 +21,10 @@ Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
|
|
21
21
|
|
22
22
|
Remove the line with "Your contribution here.", since there will be no more contributions to this release.
|
23
23
|
|
24
|
-
Change `**next**` in the "Stable Release" section in README that warns users that they are reading the documentation for an unreleased version with `**stable**`.
|
25
|
-
|
26
|
-
```
|
27
|
-
## Stable Release
|
28
|
-
|
29
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 0.2.2. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
30
|
-
```
|
31
|
-
|
32
24
|
Commit your changes.
|
33
25
|
|
34
26
|
```
|
35
|
-
git add
|
27
|
+
git add CHANGELOG.md
|
36
28
|
git commit -m "Preparing for release, 0.2.2."
|
37
29
|
git push origin master
|
38
30
|
```
|
@@ -42,10 +34,10 @@ Release.
|
|
42
34
|
```
|
43
35
|
$ rake release
|
44
36
|
|
45
|
-
slack-ruby-bot-server 0.2.2 built to pkg/slack-ruby-bot-server-0.2.2.gem.
|
37
|
+
slack-ruby-bot-server-mailchimp 0.2.2 built to pkg/slack-ruby-bot-server-mailchimp-0.2.2.gem.
|
46
38
|
Tagged v0.2.2.
|
47
39
|
Pushed git commits and tags.
|
48
|
-
Pushed slack-ruby-bot-server 0.2.2 to rubygems.org.
|
40
|
+
Pushed slack-ruby-bot-server-mailchimp 0.2.2 to rubygems.org.
|
49
41
|
```
|
50
42
|
|
51
43
|
### Prepare for the Next Version
|
@@ -60,18 +52,10 @@ Add the next release to [CHANGELOG.md](CHANGELOG.md).
|
|
60
52
|
|
61
53
|
Increment the third version number in [lib/slack-ruby-bot-server-mailchimp/version.rb](lib/slack-ruby-bot-server-mailchimp/version.rb).
|
62
54
|
|
63
|
-
Undo your change in README about the stable release.
|
64
|
-
|
65
|
-
```
|
66
|
-
## Stable Release
|
67
|
-
|
68
|
-
You're reading the documentation for the **next** release of slack-ruby-bot-server. Please see the documentation for the [last stable release, v0.2.2](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp/blob/v0.2.2/README.md) unless you're integrating with HEAD. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
69
|
-
```
|
70
|
-
|
71
55
|
Commit your changes.
|
72
56
|
|
73
57
|
```
|
74
|
-
git add
|
58
|
+
git add CHANGELOG.md lib/slack-ruby-bot-server-mailchimp/version.rb
|
75
59
|
git commit -m "Preparing for next development iteration, 0.2.3."
|
76
60
|
git push origin master
|
77
61
|
```
|
@@ -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
|
@@ -22,13 +23,15 @@ SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error,
|
|
22
23
|
member_tags = member.tags.map { |tag| tag['name'] }.sort
|
23
24
|
tags = (member_tags + tags).uniq
|
24
25
|
if tags == member_tags
|
25
|
-
|
26
|
+
SlackRubyBotServer::Service.logger.debug "Skipping #{profile.email} with identical tags (#{tags.join(', ')}), will not be added to #{SlackRubyBotServer::Mailchimp.config.mailchimp_list_id}, #{team}."
|
26
27
|
next
|
27
28
|
end
|
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
|
)
|
@@ -43,5 +46,5 @@ SlackRubyBotServer::Config.service_class.instance.on :created do |team, _error,
|
|
43
46
|
merge_fields: merge_fields
|
44
47
|
)
|
45
48
|
|
46
|
-
|
49
|
+
SlackRubyBotServer::Service.logger.info "Subscribed #{profile.email} to #{SlackRubyBotServer::Mailchimp.config.mailchimp_list_id}, #{team}."
|
47
50
|
end
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mailchimp_api_v3
|
@@ -30,30 +30,34 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 2.0.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
41
|
-
description:
|
40
|
+
version: 2.0.1
|
41
|
+
description:
|
42
42
|
email:
|
43
43
|
- dblock@dblock.org
|
44
44
|
executables: []
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".github/workflows/danger.yml"
|
49
|
+
- ".github/workflows/rubocop.yml"
|
50
|
+
- ".github/workflows/test-mongodb.yml"
|
51
|
+
- ".github/workflows/test-postgresql.yml"
|
48
52
|
- ".gitignore"
|
49
53
|
- ".rspec"
|
50
54
|
- ".rubocop.yml"
|
51
55
|
- ".rubocop_todo.yml"
|
52
|
-
- ".travis.yml"
|
53
56
|
- CHANGELOG.md
|
54
57
|
- CONTRIBUTING.md
|
55
58
|
- Dangerfile
|
56
59
|
- Gemfile
|
60
|
+
- Gemfile.danger
|
57
61
|
- LICENSE
|
58
62
|
- README.md
|
59
63
|
- RELEASING.md
|
@@ -66,7 +70,7 @@ files:
|
|
66
70
|
homepage: https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp
|
67
71
|
licenses: []
|
68
72
|
metadata: {}
|
69
|
-
post_install_message:
|
73
|
+
post_install_message:
|
70
74
|
rdoc_options: []
|
71
75
|
require_paths:
|
72
76
|
- lib
|
@@ -81,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
85
|
- !ruby/object:Gem::Version
|
82
86
|
version: '0'
|
83
87
|
requirements: []
|
84
|
-
|
85
|
-
|
86
|
-
signing_key:
|
88
|
+
rubygems_version: 3.1.6
|
89
|
+
signing_key:
|
87
90
|
specification_version: 4
|
88
91
|
summary: Mailchimp extension for slack-ruby-bot-server.
|
89
92
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
cache: bundler
|
4
|
-
|
5
|
-
matrix:
|
6
|
-
include:
|
7
|
-
- rvm: 2.6.2
|
8
|
-
script:
|
9
|
-
- bundle exec danger
|
10
|
-
- rvm: 2.6.2
|
11
|
-
env: DATABASE_ADAPTER=activerecord
|
12
|
-
services:
|
13
|
-
- postgresql
|
14
|
-
- rvm: 2.6.2
|
15
|
-
env: DATABASE_ADAPTER=mongoid
|
16
|
-
services:
|
17
|
-
- mongodb
|