slack_webhooks 0.0.4 → 0.0.5
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/slack_webhooks/version.rb +1 -1
- data/lib/slack_webhooks.rb +23 -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: 6201853c6d8df06ee5bea8ca707a4e2444afbf25
|
4
|
+
data.tar.gz: fbfd60b62cc4354911de76b8d2470974bbf76403
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44aaeb24423a9bdf94cbf62cbc457f9fc727bda716e23b89b15f5472cea87de18cc29dcd5d9fc5b7c2bad97ed556296fcc09c944e631cc581a5dae2e981d82d0
|
7
|
+
data.tar.gz: 5713218ffb8c0ac1fa05314d43bb763999fd830181f44f3b5a8ce0422d140efb32c52cca96b2c51975c06b8115f9a5022d330dcaeb5792b929005e56702f79c5
|
data/lib/slack_webhooks.rb
CHANGED
@@ -6,7 +6,9 @@ module SlackWebhooks
|
|
6
6
|
class Hook
|
7
7
|
|
8
8
|
attr_accessor :command, :trigger_word, :channel, :username, :text, :webhook_url,
|
9
|
-
:botname,
|
9
|
+
:botname,
|
10
|
+
:icon_url, # Set the icon for the bot
|
11
|
+
:usage_options
|
10
12
|
alias_method :user_name, :username
|
11
13
|
|
12
14
|
# botname is the name to post to the channel with.
|
@@ -46,6 +48,17 @@ module SlackWebhooks
|
|
46
48
|
|
47
49
|
end
|
48
50
|
|
51
|
+
# Takes similar options as send
|
52
|
+
def usage=(text, options={})
|
53
|
+
options['pretext'] = text
|
54
|
+
self.usage_options = options
|
55
|
+
end
|
56
|
+
|
57
|
+
def send_usage(extra_text='')
|
58
|
+
self.channel = self.username
|
59
|
+
self.send(extra_text, self.usage_options)
|
60
|
+
end
|
61
|
+
|
49
62
|
def send(s, options={})
|
50
63
|
# Now send it to back to the channel on slack
|
51
64
|
s = "#{command} #{text}" if s.nil?
|
@@ -67,5 +80,14 @@ module SlackWebhooks
|
|
67
80
|
p resp
|
68
81
|
p resp.message
|
69
82
|
end
|
83
|
+
|
84
|
+
def help?
|
85
|
+
if self.text == "help"
|
86
|
+
# send help directly to user
|
87
|
+
send_usage
|
88
|
+
return true
|
89
|
+
end
|
90
|
+
return false
|
91
|
+
end
|
70
92
|
end
|
71
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_webhooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-notifier
|