slack-notifier 1.3.1 → 1.4.0
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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b8594811b3092b0dd7f63d28babf5c154758a1
|
4
|
+
data.tar.gz: 892cc4f5174554ff2711773f96162fdf968b9555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29ac1440fc2206c3bbfb939983a5a9445313a10a587f54760e62ee18d8c27c8d8d1341c5e537b5106f36d76167892899f12220484cb3013b251be434ba478ea5
|
7
|
+
data.tar.gz: eccee2d94d9679638a7341eb0fd2c7fab2572561590ac4318623719bc219bbc4771bea8a2c3416f872559067501f447c98ed2d1d3fadbc16da1975f1700fb241
|
@@ -52,9 +52,9 @@ module Slack
|
|
52
52
|
/ <a (?:.*?) href=['"](.+?)['"] (?:.*?)> (.+?) <\/a> /x
|
53
53
|
end
|
54
54
|
|
55
|
-
# http://rubular.com/r/
|
55
|
+
# http://rubular.com/r/guJbTK6x1f
|
56
56
|
def markdown_pattern
|
57
|
-
/\[ ([^\[\]]*?) \] \( (https?:\/\/.*?) \) /x
|
57
|
+
/\[ ([^\[\]]*?) \] \( ((https?:\/\/.*?) | (mailto:.*?)) \) /x
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
data/lib/slack-notifier.rb
CHANGED
@@ -16,6 +16,13 @@ module Slack
|
|
16
16
|
|
17
17
|
def ping message, options={}
|
18
18
|
message = LinkFormatter.format(message)
|
19
|
+
if attachments = options[:attachments] || options["attachments"]
|
20
|
+
attachments.each do |attachment|
|
21
|
+
["text", :text].each do |key|
|
22
|
+
attachment[key] = LinkFormatter.format(attachment[key]) if attachment.has_key?(key)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
19
26
|
payload = default_payload.merge(options).merge(text: message)
|
20
27
|
client = payload.delete(:http_client) || http_client
|
21
28
|
http_options = payload.delete(:http_options)
|
@@ -63,6 +63,16 @@ describe Slack::Notifier::LinkFormatter do
|
|
63
63
|
expect(formatted).to eq "こんにちは"
|
64
64
|
end
|
65
65
|
|
66
|
+
it "handles mailto links in markdown" do
|
67
|
+
formatted = described_class.format("[John](mailto:john@example.com)")
|
68
|
+
expect(formatted).to eq "<mailto:john@example.com|John>"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "handles mailto links in html" do
|
72
|
+
formatted = described_class.format("<a href='mailto:john@example.com'>John</a>")
|
73
|
+
expect(formatted).to eq "<mailto:john@example.com|John>"
|
74
|
+
end
|
75
|
+
|
66
76
|
end
|
67
77
|
|
68
78
|
end
|
@@ -32,6 +32,20 @@ describe Slack::Notifier do
|
|
32
32
|
described_class.new('http://example.com').ping "the message", channel: 'foo'
|
33
33
|
end
|
34
34
|
|
35
|
+
it "passes attachment messages through LinkFormatter" do
|
36
|
+
expect( Slack::Notifier::LinkFormatter ).to receive(:format)
|
37
|
+
.with("the message")
|
38
|
+
expect( Slack::Notifier::LinkFormatter ).to receive(:format)
|
39
|
+
.with("attachment message")
|
40
|
+
|
41
|
+
described_class.new('http://example.com').ping "the message", channel: 'foo',
|
42
|
+
attachments: [{
|
43
|
+
color: "#000",
|
44
|
+
text: "attachment message",
|
45
|
+
fallback: "fallback message"
|
46
|
+
}]
|
47
|
+
end
|
48
|
+
|
35
49
|
context "with a default channel set" do
|
36
50
|
|
37
51
|
before :each do
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Sloan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: " A slim ruby wrapper for posting to slack webhooks "
|
14
14
|
email:
|
15
15
|
- stevenosloan@gmail.com
|
16
16
|
executables: []
|
@@ -36,17 +36,17 @@ require_paths:
|
|
36
36
|
- lib
|
37
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
48
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.4.5
|
49
|
+
rubygems_version: 2.4.5.1
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: A slim ruby wrapper for posting to slack webhooks
|