slack-notify 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/README.md +9 -3
- data/lib/slack-notify.rb +2 -2
- data/lib/slack-notify/version.rb +1 -1
- data/spec/slack-notify/client_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ae9577d0c514b298a64e4516e24b1b3a888e11
|
4
|
+
data.tar.gz: 168e894c3fbc4206e0451bb9ff626b2232f6a23b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ae2ba9457d0f19474275265e844a8fd2461d6e7ee1154bd990cc4f3238ae7c23bf1d327c9e3e6d598e1b99cdb3d41f5a7720b7072560fbe16f318549dc9e016
|
7
|
+
data.tar.gz: e56fd9be21863aa0f1ce9656063918ec059383318b526f50cac12184ba9c5cd227869432a5f3596886ec967ed139a9864dc47134ee4ea822c770e03e370a15cd
|
data/README.md
CHANGED
@@ -59,12 +59,18 @@ client.notify("Another message", "#channel2")
|
|
59
59
|
client.notify("Message", ["#channel1", "#channel2"])
|
60
60
|
```
|
61
61
|
|
62
|
+
Send direct message:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
client.notify("Hello There!", "@username")
|
66
|
+
```
|
67
|
+
|
62
68
|
## Gotchas
|
63
69
|
|
64
|
-
|
70
|
+
Current issues with Slack API:
|
65
71
|
|
66
|
-
- No message raised if
|
67
|
-
-
|
72
|
+
- No message raised if team subdomain is invalid
|
73
|
+
- 500 server error is raised on bad requests
|
68
74
|
|
69
75
|
## License
|
70
76
|
|
data/lib/slack-notify.rb
CHANGED
@@ -33,7 +33,7 @@ module SlackNotify
|
|
33
33
|
|
34
34
|
def format_channel(channel)
|
35
35
|
[channel || @channel].flatten.compact.uniq.map do |name|
|
36
|
-
name[0]
|
36
|
+
name[0].match(/^(#|@)/) && name || "##{name}"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -72,4 +72,4 @@ module SlackNotify
|
|
72
72
|
"https://#{@team}.slack.com"
|
73
73
|
end
|
74
74
|
end
|
75
|
-
end
|
75
|
+
end
|
data/lib/slack-notify/version.rb
CHANGED
@@ -139,6 +139,17 @@ describe SlackNotify::Client do
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
+
context "when direct message" do
|
143
|
+
before do
|
144
|
+
client.stub(:send_payload).and_return(true)
|
145
|
+
client.notify("Message", "@user")
|
146
|
+
end
|
147
|
+
|
148
|
+
it "sends payload to a user" do
|
149
|
+
expect(client).to have_received(:send_payload).with(text: "Message", username: "webhookbot", channel: "@user")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
142
153
|
context "when team name is invalid" do
|
143
154
|
before do
|
144
155
|
stub_request(:post, "https://foo.slack.com/services/hooks/incoming-webhook?token=token").
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-notify
|
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
|
- Dan Sosedoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|