slacked 0.9.1 → 0.9.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
- SHA1:
3
- metadata.gz: 11d1d52d36df88fa4f403b9ba8097380bae094f7
4
- data.tar.gz: 05eb2fcda4d3744a4b326ce1cf50d622f568c80b
2
+ SHA256:
3
+ metadata.gz: 754d79d20a83f26f90777e3f386eb26382bd83a61c212156cabbdf1f5b5f970e
4
+ data.tar.gz: d9f5f2e038b9905df35bce18591ebd1d209b3daecf01c902f4eb697c96b12563
5
5
  SHA512:
6
- metadata.gz: 05a09bc4ef9b7f6bdf126ab16f57bc5f0e29107b2fdbbc5023ef9f7020628f0983704687378ab3a448f05793f46b7505346d68c6da921613e38036077cc0ad7d
7
- data.tar.gz: 5f0b3474f752ec00b288619629eddf1721a79e8a7110a2eb0a799f01528d2225ff85456935a3e827fbf6f78f162fff5a237e7a097a83ed986f1faf8096d3b123
6
+ metadata.gz: 1b930dcf234123c5997070120c9747252189e25f476de92dc44fcc9cc4a4fb7a4094c782fb12db20b8fe7e29b4d2d9bf4d4e6434d64144d8bfa5fe29b5e1f1c6
7
+ data.tar.gz: b05b1537b869823d3ddd6299ca6450c03207e12cf5a00131b20b3fe942c90178adfbe9c91d9c5473cf56fd685678df40aba713ad207c2da2b079cd0408cf2c85
data/README.md CHANGED
@@ -32,7 +32,7 @@ Then run the installer:
32
32
 
33
33
  $ bundle exec rails g slacked:install
34
34
 
35
- This will create a .env file in the root of the rails application. Specify the Webhook Url and the message to be sent.
35
+ This will create a .env file in the root of the rails application. Specify the default Webhook Url and the message to be sent.
36
36
 
37
37
  ```ruby
38
38
  SLACK_WEBHOOK= "WEBHOOK_URL"
@@ -41,7 +41,7 @@ SLACK_DEFAULT_MESSAGE= "TEST"
41
41
 
42
42
 
43
43
  ## Usage
44
- Set the SLACK_WEBOOK env variable with the value of the webhook which you want to send the messages.
44
+ Set the SLACK_WEBHOOK env variable with the default value of the webhook which you want to send the messages. If you would like to send messages to different webhooks, you can do so by specifying the webhook url in the `config` parameter to `Slacked#post` or `Slacked#post_async`.
45
45
  If you want to send a unique message in your application like 'Application is running' you can set the SLACK_DEFAULT_MESSAGE and call the message methods without sending an argument.
46
46
 
47
47
 
@@ -82,7 +82,12 @@ or
82
82
  Slacked.post_async "Let's play fetch!", {icon_emoji: ':dog:'}
83
83
  ```
84
84
 
85
- Right now we only have the config for the icon, if you need another one let us know or submit a pull request.
85
+ or
86
+ ```ruby
87
+ Slacked.post_async 'This goes to a specific channel!', {webhook_url: <WEBHOOK_URL>}
88
+ ```
89
+
90
+ Right now we only have the config for the icon and the webhook url, if you need another one let us know or submit a pull request.
86
91
 
87
92
  ## Example
88
93
 
@@ -107,11 +112,12 @@ config.slacked_disabled = true
107
112
 
108
113
  The default value is false
109
114
 
110
- ## Contributors
115
+ ## Contributors
111
116
 
112
117
  - [Kaio Magalhães](https://github.com/kaiomagalhaes)
113
118
  - [Lockyy](https://github.com/Lockyy)
114
119
  - [Sean H.](https://github.com/seathony)
120
+ - [Tomas Barry](https://github.com/TomasBarry)
115
121
 
116
122
 
117
123
  ## License
@@ -1,15 +1,20 @@
1
1
  module Slacked
2
2
  SLACK_PROFILE_IMAGE=':robot_face:'
3
- SLACK_WEBHOOK_URL_KEY='SLACK_WEBHOOK'
3
+ SLACK_WEBHOOK_URL_KEY = 'SLACK_WEBHOOK'
4
4
  SLACK_DEFAULT_MESSAGE_KEY='SLACK_DEFAULT_MESSAGE'
5
- SLACK_DEFAULT_CONFIG= {
6
- icon_emoji: SLACK_PROFILE_IMAGE
7
- }
5
+ SLACK_DEFAULT_CONFIG = {
6
+ icon_emoji: SLACK_PROFILE_IMAGE,
7
+ webhook_url: ENV[SLACK_WEBHOOK_URL_KEY]
8
+ }.freeze
8
9
 
9
10
  class << self
10
11
  def post message = ENV[SLACK_DEFAULT_MESSAGE_KEY], config = SLACK_DEFAULT_CONFIG
11
12
  return false if message.nil? || message.empty? || disabled?
12
- slack_notifier.ping message, SLACK_DEFAULT_CONFIG.merge(config)
13
+
14
+ merged_configs = SLACK_DEFAULT_CONFIG.merge(config)
15
+ webhook_url = merged_configs.fetch(:webhook_url, SLACK_WEBHOOK_URL_KEY)
16
+ slack_notifier(webhook_url)
17
+ .ping(message, merged_configs)
13
18
  end
14
19
 
15
20
  def post_async message= ENV[SLACK_DEFAULT_MESSAGE_KEY], config = SLACK_DEFAULT_CONFIG
@@ -27,8 +32,9 @@ module Slacked
27
32
  end
28
33
 
29
34
  private
30
- def slack_notifier webhook_url = ENV[SLACK_WEBHOOK_URL_KEY]
31
- Slack::Notifier.new webhook_url
35
+
36
+ def slack_notifier(webhook_url)
37
+ Slack::Notifier.new(webhook_url)
32
38
  end
33
39
 
34
40
  def rails?
@@ -1,3 +1,3 @@
1
1
  module Slacked
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slacked
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2015-12-19 00:00:00.000000000 Z
13
+ date: 2019-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -172,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  requirements: []
175
- rubyforge_project:
176
- rubygems_version: 2.4.8
175
+ rubygems_version: 3.0.4
177
176
  signing_key:
178
177
  specification_version: 4
179
178
  summary: A super simple and easy way to send notifications to Slack from your Rails