slack-notify 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c643856420715a7cb90434dc3c1c5afdf7da488b
4
- data.tar.gz: f73121509a88d716b54b875f431db25f3355dec1
3
+ metadata.gz: a5bab3674aac3d4d7a627bc89f344dc60253c064
4
+ data.tar.gz: 3dccd4e68f9f5bf70e757d5a4476cf86c7c88a8b
5
5
  SHA512:
6
- metadata.gz: 719157dda53b568ff17a98b42a6d6bbe0f5feb1c609359f7e34aeb3da38e9a7b3f45a06482623bdf9f04f69ac9e3ff50511b5b79e83e60a16efac3469a3efa4a
7
- data.tar.gz: 355bcb7153a585d9dad1322bbe45c854c21f4b4f279ffa26608461bf95986c97e52c2b0e087a1fcdb825b30d9362b81ccb19814973cc4bcf24c109d4073b1ebe
6
+ metadata.gz: 75d67b94abb259bfb34c446a7e586d442f9e26524f1243e8e1d541e5613226178ede8f3c057a07a84aaa352257b12ad3941adafe797438147460568689329a81
7
+ data.tar.gz: 4a889d95e5747b3fe06d4439a5a0e9521aa396e84903de325320d4a4e782f979a22cc7d826df2cd23dc4a0e7089823c6026d3dd77c070010af79ac42374e60e0
data/README.md CHANGED
@@ -46,7 +46,8 @@ client = SlackNotify::Client.new("team", "token", {
46
46
  channel: "#development",
47
47
  username: "mybot",
48
48
  icon_url: "http://mydomain.com/myimage.png",
49
- icon_emoji: ":shipit:"
49
+ icon_emoji: ":shipit:",
50
+ link_names: 1
50
51
  })
51
52
  ```
52
53
 
@@ -12,6 +12,7 @@ module SlackNotify
12
12
  @channel = options[:channel]
13
13
  @icon_url = options[:icon_url]
14
14
  @icon_emoji = options[:icon_emoji]
15
+ @link_names = options[:link_names]
15
16
 
16
17
  validate_arguments
17
18
  end
@@ -27,7 +28,8 @@ module SlackNotify
27
28
  channel: chan,
28
29
  username: @username,
29
30
  icon_url: @icon_url,
30
- icon_emoji: @icon_emoji
31
+ icon_emoji: @icon_emoji,
32
+ link_names: @link_names
31
33
  )
32
34
 
33
35
  send_payload(payload)
@@ -52,4 +54,4 @@ module SlackNotify
52
54
  [channel || @channel || "#general"].flatten.compact.uniq
53
55
  end
54
56
  end
55
- end
57
+ end
@@ -1,6 +1,6 @@
1
1
  module SlackNotify
2
2
  class Payload
3
- attr_accessor :username, :text, :channel, :icon_url, :icon_emoji
3
+ attr_accessor :username, :text, :channel, :icon_url, :icon_emoji, :link_names
4
4
 
5
5
  def initialize(options = {})
6
6
  @username = options[:username] || "webhookbot"
@@ -8,6 +8,7 @@ module SlackNotify
8
8
  @text = options[:text]
9
9
  @icon_url = options[:icon_url]
10
10
  @icon_emoji = options[:icon_emoji]
11
+ @link_names = options[:link_names]
11
12
 
12
13
  unless channel[0] =~ /^(#|@)/
13
14
  @channel = "##{@channel}"
@@ -20,10 +21,11 @@ module SlackNotify
20
21
  username: username,
21
22
  channel: channel,
22
23
  icon_url: icon_url,
23
- icon_emoji: icon_emoji
24
+ icon_emoji: icon_emoji,
25
+ link_names: link_names
24
26
  }
25
27
 
26
28
  hash.delete_if { |_,v| v.nil? }
27
29
  end
28
30
  end
29
- end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module SlackNotify
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -101,6 +101,21 @@ describe SlackNotify::Client do
101
101
  end
102
102
  end
103
103
 
104
+ context "when link_names is set" do
105
+ let(:client) { described_class.new("foo", "bar", link_names: 1) }
106
+
107
+ before do
108
+ stub_request(:post, "https://foo.slack.com/services/hooks/incoming-webhook?token=bar").
109
+ with(:body => {"{\"text\":\"Message\",\"username\":\"webhookbot\",\"channel\":\"#general\",\"link_names\":1}"=>true},
110
+ :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.0'}).
111
+ to_return(:status => 200, :body => "", :headers => {})
112
+ end
113
+
114
+ it "includes link_names in payload" do
115
+ client.notify("Message")
116
+ end
117
+ end
118
+
104
119
  context "with multiple channels" do
105
120
  before do
106
121
  client.stub(:send_payload) { true }
@@ -7,7 +7,8 @@ describe SlackNotify::Payload do
7
7
  channel: "#bar",
8
8
  text: "hola",
9
9
  icon_url: "http://domain.com/image.png",
10
- icon_emoji: ":chart_with_upwards_trend:"
10
+ icon_emoji: ":chart_with_upwards_trend:",
11
+ link_names: 1
11
12
  }
12
13
  end
13
14
 
@@ -35,6 +36,10 @@ describe SlackNotify::Payload do
35
36
  expect(payload.icon_emoji).to eq ":chart_with_upwards_trend:"
36
37
  end
37
38
 
39
+ it "sets link_names" do
40
+ expect(payload.link_names).to eq 1
41
+ end
42
+
38
43
  context "on missing pound in channel" do
39
44
  let(:options) do
40
45
  { channel: "foo" }
@@ -77,6 +82,7 @@ describe SlackNotify::Payload do
77
82
  channel: "#bar",
78
83
  icon_url: "http://domain.com/image.png",
79
84
  icon_emoji: ":chart_with_upwards_trend:",
85
+ link_names: 1,
80
86
  text: "hola",
81
87
  username: "foo"
82
88
  )
@@ -101,5 +107,15 @@ describe SlackNotify::Payload do
101
107
  expect(hash.keys).not_to include "icon_emoji"
102
108
  end
103
109
  end
110
+
111
+ context "when link_names is not set" do
112
+ before do
113
+ options[:link_names] = nil
114
+ end
115
+
116
+ it "excludes link_names" do
117
+ expect(hash.keys).not_to include "link_names"
118
+ end
119
+ end
104
120
  end
105
- end
121
+ end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
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-06-01 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10'
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
40
  version: '10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.7'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.13'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.13'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: faraday
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.9.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.9.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: json
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.8'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.8'
111
111
  description: Send notifications to a Slack channel
@@ -115,9 +115,9 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - .gitignore
119
- - .rspec
120
- - .travis.yml
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".travis.yml"
121
121
  - Gemfile
122
122
  - LICENSE.txt
123
123
  - README.md
@@ -142,17 +142,17 @@ require_paths:
142
142
  - lib
143
143
  required_ruby_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - '>='
145
+ - - ">="
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.1.11
155
+ rubygems_version: 2.2.2
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Send notifications to a Slack channel