slackhook 1.0 → 1.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 +4 -4
- data/lib/slackhook/version.rb +1 -1
- data/lib/slackhook/webhook_service.rb +10 -1
- 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: d149e24a892fb18632105335b67193dd91d3f122
|
|
4
|
+
data.tar.gz: cafc5b55dbee7865dafa25977047a756d902df06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8f3ecf28a3dd0339af74378df0f41e5b847ac950a62e9770384b6c90538214b736a77242383c750f9b7fd9fe14451ac0046c002063d87bb4fd0d9bb5c03a68d
|
|
7
|
+
data.tar.gz: 09e352475a98727694cbeba904b65e4ea14478650627d2d907027bce0e73085d9df0259960cc9fc13ab02a5dea224a477173753c5f45a98c89c48fd2281e5c85
|
data/lib/slackhook/version.rb
CHANGED
|
@@ -6,8 +6,10 @@ require "json"
|
|
|
6
6
|
module WebhookService
|
|
7
7
|
class Webhook
|
|
8
8
|
def initialize options = {}
|
|
9
|
+
raise ArgumentError.new('icon_type and icon_url are mutualy exclusive!') if options[:icon_type].present? && options[:icon_url].present?
|
|
9
10
|
@text = options.fetch(:text, nil)
|
|
10
11
|
@icon_type = options.fetch(:icon_type, nil)
|
|
12
|
+
@icon_url = options.fetch(:icon_url, nil)
|
|
11
13
|
@channel = options.fetch(:channel, nil)
|
|
12
14
|
@username = options.fetch(:username, nil)
|
|
13
15
|
@webhook_url = options.fetch(:webhook_url, nil)
|
|
@@ -15,7 +17,14 @@ module WebhookService
|
|
|
15
17
|
|
|
16
18
|
def send
|
|
17
19
|
uri = URI::encode(@webhook_url)
|
|
18
|
-
@toSend = { channel: @channel, text: @text, username: @username
|
|
20
|
+
@toSend = { channel: @channel, text: @text, username: @username }
|
|
21
|
+
|
|
22
|
+
if @icon_type.present?
|
|
23
|
+
@toSend.merge!(icon_emoji: @icon_type)
|
|
24
|
+
elsif @icon_url.present?
|
|
25
|
+
@toSend.merge!(icon_url: @icon_url)
|
|
26
|
+
end
|
|
27
|
+
|
|
19
28
|
uri = URI.parse(uri)
|
|
20
29
|
https = Net::HTTP.new(uri.host,uri.port)
|
|
21
30
|
https.use_ssl = true
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slackhook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.1'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Urielable
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|