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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6392837e069b0b29a9fe559d5a518f95caa29b9c
4
- data.tar.gz: dabb45b973648b81975afb435b25cb64f369bf81
3
+ metadata.gz: 6201853c6d8df06ee5bea8ca707a4e2444afbf25
4
+ data.tar.gz: fbfd60b62cc4354911de76b8d2470974bbf76403
5
5
  SHA512:
6
- metadata.gz: a8b8395db74d7ce4e3d4ed796bc64e788fecb80882c26d3fe46a0fd609d095d73b39f039b13ccb3879c360fb7d1bfc4f65f69dad09668fb0bd068291a4dcb125
7
- data.tar.gz: 2067c8b1b458b8bb81474d31ae5dcf78b826a1217bb99b7c0cc1f4bfe39c7c7a6816dc05671ec0b8e691e1706661d15a071b49f796e1cf9a8538daa8261edf8d
6
+ metadata.gz: 44aaeb24423a9bdf94cbf62cbc457f9fc727bda716e23b89b15f5472cea87de18cc29dcd5d9fc5b7c2bad97ed556296fcc09c944e631cc581a5dae2e981d82d0
7
+ data.tar.gz: 5713218ffb8c0ac1fa05314d43bb763999fd830181f44f3b5a8ce0422d140efb32c52cca96b2c51975c06b8115f9a5022d330dcaeb5792b929005e56702f79c5
@@ -1,3 +1,3 @@
1
1
  module SlackWebhooks
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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, :icon_url
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
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-09 00:00:00.000000000 Z
11
+ date: 2015-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-notifier