slappy 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -12
- data/lib/slappy/version.rb +1 -1
- data/lib/slappy.rb +13 -0
- 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: 26e15337ee96df3976f78672ee576f6eb247e475
|
4
|
+
data.tar.gz: 6fd8714fcf6a87aa094b11db890d511bb1aab457
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f73b384121b7fa2d7f48a53e9e265ac5206ddee17184f659a546db34f7f710e13ac026444e9fbbd6a28c5d8101aca185391956bec7cf686a8ef6142560ca9b5a
|
7
|
+
data.tar.gz: 50b4a56ec88f0d5ab1158d14e57f451768ce4d1e4134bf4aa256238200e268f3aca15d4a37f600ffde2cef7f85fbffa52a5d3e4b413d470758897d47d3a0dddf
|
data/README.md
CHANGED
@@ -50,8 +50,7 @@ Slappy.configure do |config|
|
|
50
50
|
config.icon_emoji = ':slappy:'
|
51
51
|
end
|
52
52
|
|
53
|
-
slappy
|
54
|
-
slappy.say 'hello!' #=> username: slappy, channel: '#general', icon_emoji: ':slappy:'
|
53
|
+
Slappy.say 'hello!' #=> username: slappy, channel: '#general', icon_emoji: ':slappy:'
|
55
54
|
```
|
56
55
|
|
57
56
|
#### Configuration Parameters
|
@@ -70,32 +69,30 @@ icon_url - default: nil
|
|
70
69
|
```ruby
|
71
70
|
require 'slappy'
|
72
71
|
|
73
|
-
slappy = Slappy::Client.new
|
74
|
-
|
75
72
|
# called when start up
|
76
|
-
|
73
|
+
Slappy.hello do
|
77
74
|
puts 'successfly connected'
|
78
75
|
end
|
79
76
|
|
80
77
|
# called when match message
|
81
|
-
|
78
|
+
Slappy.hear(/foo/) do
|
82
79
|
puts 'foo'
|
83
80
|
end
|
84
81
|
|
85
82
|
# called when match message with pattern match
|
86
|
-
|
83
|
+
Slappy.hear(/bar (.*)/) do |event|
|
87
84
|
puts event.matches[1] #=> Event#matches return MatchData object
|
88
85
|
end
|
89
86
|
|
90
87
|
# event object is slack event JSON (convert to [hashie](https://github.com/intridea/hashie))
|
91
|
-
|
88
|
+
Slappy.hear(/bar (.*)/) do |event|
|
92
89
|
puts event.channel #=> channel id
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
Slappy.say 'slappy!', channel: event.channel #=> to received message channel
|
91
|
+
Slappy.say 'slappy!', channel: '#general'
|
92
|
+
Slappy.say 'slappy!', username: 'slappy!', icon_emoji: ':slappy:'
|
96
93
|
end
|
97
94
|
|
98
|
-
|
95
|
+
Slappy.start
|
99
96
|
```
|
100
97
|
|
101
98
|
## How to run tests
|
data/lib/slappy/version.rb
CHANGED
data/lib/slappy.rb
CHANGED
@@ -17,5 +17,18 @@ module Slappy
|
|
17
17
|
def configuration
|
18
18
|
@configuration || configure
|
19
19
|
end
|
20
|
+
|
21
|
+
def client
|
22
|
+
@client ||= Client.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def method_missing(method, *args, &block)
|
26
|
+
return super unless client.respond_to?(method)
|
27
|
+
client.send(method, *args, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
def respond_to?(method)
|
31
|
+
client.respond_to?(method) || super
|
32
|
+
end
|
20
33
|
end
|
21
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slappy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yuemori
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-api
|