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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54d7de208c117108a53fc2398ce550a9adbb5cae
4
- data.tar.gz: 5c947dba3118362792ecb120f7448c72d73c6fd3
3
+ metadata.gz: 26e15337ee96df3976f78672ee576f6eb247e475
4
+ data.tar.gz: 6fd8714fcf6a87aa094b11db890d511bb1aab457
5
5
  SHA512:
6
- metadata.gz: 1654a5728b43668360277e9aec071d2be4047f807823af831233d9545165a4d4902a2bd2da3e11cee499614da4435805f0e2271fa47fa36f089065da02fa9c35
7
- data.tar.gz: 8b3cfc43fc42de4c940ed08edce47daf186f2c9b8115fb67d15a9b4f9df7433ec0dcf5a7a80d927145b2019d8fda2acd6e9557e556e12e6728599107d086591c
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 = Slappy::Client.new
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
- slappy.hello do
73
+ Slappy.hello do
77
74
  puts 'successfly connected'
78
75
  end
79
76
 
80
77
  # called when match message
81
- slappy.hear(/foo/) do
78
+ Slappy.hear(/foo/) do
82
79
  puts 'foo'
83
80
  end
84
81
 
85
82
  # called when match message with pattern match
86
- slappy.hear(/bar (.*)/) do |event|
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
- slappy.hear(/bar (.*)/) do |event|
88
+ Slappy.hear(/bar (.*)/) do |event|
92
89
  puts event.channel #=> channel id
93
- slappy.say 'slappy!', channel: event.channel #=> to received message channel
94
- slappy.say 'slappy!', channel: '#general'
95
- slappy.say 'slappy!', username: 'slappy!', icon_emoji: ':slappy:'
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
- slappy.start
95
+ Slappy.start
99
96
  ```
100
97
 
101
98
  ## How to run tests
@@ -1,3 +1,3 @@
1
1
  module Slappy
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
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.1.1
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-06 00:00:00.000000000 Z
11
+ date: 2015-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-api