slack_mailer 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +6 -4
- data/lib/slack_mailer.rb +6 -3
- data/lib/slack_mailer/version.rb +1 -1
- data/slack_mailer.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2265ec9d5452cdea0c43e18f497bdaa31cb2632c50fb3d0e2a48e7ae8978b9e1
|
4
|
+
data.tar.gz: 40482ede6ef9f4d1315d2ddce13fa3b1e810aa6d2f5f08c48838b0a37474bf57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5ab92b3a649a5aa21fda6f137037fee01eaaa51cd060ce29ec1858d60e1ccd096fabc83f57fdc037c537a580d74060c2907c09f984705d2756ba7666656d0aa
|
7
|
+
data.tar.gz: 93f72b7ef438dc1221e24580380a55b78b0b029e04a903860e8255a04a50183fd19f32ed0765ac21df1770eab944598acd114fec09b8dda21dece9286db72c87
|
data/Gemfile.lock
CHANGED
@@ -8,7 +8,7 @@ GEM
|
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.3)
|
11
|
-
rake (
|
11
|
+
rake (13.0.1)
|
12
12
|
rspec (3.7.0)
|
13
13
|
rspec-core (~> 3.7.0)
|
14
14
|
rspec-expectations (~> 3.7.0)
|
@@ -29,7 +29,7 @@ PLATFORMS
|
|
29
29
|
|
30
30
|
DEPENDENCIES
|
31
31
|
bundler (~> 1.16.a)
|
32
|
-
rake (~>
|
32
|
+
rake (~> 13.0)
|
33
33
|
rspec (~> 3.0)
|
34
34
|
slack_mailer!
|
35
35
|
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# SlackMailer
|
2
|
+
SlackMailer gem helps separate business logic from logic of message delivery. It structures code just like ActionMailer.
|
2
3
|
|
3
4
|
## Installation
|
4
5
|
|
@@ -17,11 +18,11 @@ Or install it yourself as:
|
|
17
18
|
$ gem install slack_mailer
|
18
19
|
## Dependencies
|
19
20
|
|
20
|
-
Before using
|
21
|
+
Before using gem you need install [sidekiq](https://github.com/mperham/sidekiq) in to your project.
|
21
22
|
|
22
23
|
## Configuring
|
23
24
|
|
24
|
-
Add queue for sidekiq
|
25
|
+
Add queue for sidekiq to config/sidekiq.yml
|
25
26
|
|
26
27
|
```yml
|
27
28
|
- [slack_messages, 1]
|
@@ -38,6 +39,7 @@ Slack::Mailer::Configuration.configure do |config|
|
|
38
39
|
'https://hooks.slack.com/services/...........']
|
39
40
|
end
|
40
41
|
```
|
42
|
+
Gem balances messages by hooks. It helps not to reach a message limit through 1 hook per 1 second.
|
41
43
|
|
42
44
|
## Usage
|
43
45
|
|
@@ -54,7 +56,7 @@ class UserMailer < Slack::Mailer
|
|
54
56
|
end
|
55
57
|
```
|
56
58
|
|
57
|
-
If you want to send message via Mailer without sidekiq
|
59
|
+
If you want to send a message via Mailer without sidekiq
|
58
60
|
```ruby
|
59
61
|
class UserMailer < Slack::Mailer
|
60
62
|
|
@@ -83,7 +85,7 @@ Sending small messages(one line message)
|
|
83
85
|
Slack::Mailer.send_message('#channel', 'name', 'message')
|
84
86
|
```
|
85
87
|
|
86
|
-
Sending message
|
88
|
+
Sending message by passing sidekiq
|
87
89
|
```ruby
|
88
90
|
Slack::Mailer.send_direct_message('#channel', 'name', 'message')
|
89
91
|
```
|
data/lib/slack_mailer.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative 'slack_mailer/configuration'
|
2
2
|
require_relative 'slack_mailer/delivery_worker'
|
3
3
|
require 'slack-notifier'
|
4
|
+
require 'erb'
|
4
5
|
|
5
6
|
module Slack
|
6
7
|
class Mailer
|
@@ -34,9 +35,11 @@ module Slack
|
|
34
35
|
|
35
36
|
def collect_message(template, instance_variables)
|
36
37
|
template = "#{template}.#{Slack::Mailer::Configuration.config.templates_type}"
|
37
|
-
template
|
38
|
-
|
39
|
-
|
38
|
+
template << '.erb' if Slack::Mailer::Configuration.config.erb_in_templates
|
39
|
+
|
40
|
+
ERB.new(
|
41
|
+
File.read("#{Slack::Mailer::Configuration.config.templates_path}/#{self.class.name.underscore}/#{template}")
|
42
|
+
).result(binding)
|
40
43
|
end
|
41
44
|
|
42
45
|
end
|
data/lib/slack_mailer/version.rb
CHANGED
data/slack_mailer.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.16.a"
|
22
|
-
spec.add_development_dependency "rake", "~>
|
22
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
24
|
spec.add_dependency "slack-notifier", "~> 2.3.2"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Appodeal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.7.
|
109
|
+
rubygems_version: 2.7.3
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: This gem make more comfortable working with slack
|