slack-ruby-bot 0.1.0 → 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/.gitignore +2 -0
- data/.rubocop_todo.yml +5 -9
- data/CHANGELOG.md +6 -0
- data/README.md +34 -5
- data/TUTORIAL.md +148 -0
- data/examples/minimal/Gemfile.lock +1 -1
- data/lib/slack-ruby-bot/app.rb +10 -0
- data/lib/slack-ruby-bot/commands/about.rb +3 -0
- data/lib/slack-ruby-bot/commands/base.rb +30 -1
- data/lib/slack-ruby-bot/hooks/message.rb +98 -16
- data/lib/slack-ruby-bot/rspec/support/fixtures/slack/auth_test.yml +1 -47
- data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/it_behaves_like_a_slack_bot.rb +5 -2
- data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_error.rb +0 -1
- data/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_slack_message.rb +0 -1
- data/lib/slack-ruby-bot/rspec/support/slack_ruby_bot_configure.rb +7 -3
- data/lib/slack-ruby-bot/version.rb +1 -1
- data/screenshots/demo.gif +0 -0
- data/slack-ruby-bot.gemspec +1 -0
- data/spec/slack-ruby-bot/commands/about_spec.rb +4 -7
- data/spec/slack-ruby-bot/commands/commands_spec.rb +21 -0
- data/spec/slack-ruby-bot/commands/empty_text_spec.rb +21 -0
- data/spec/slack-ruby-bot/commands/help_spec.rb +1 -4
- data/spec/slack-ruby-bot/commands/hi_spec.rb +1 -4
- data/spec/slack-ruby-bot/commands/operators_spec.rb +20 -0
- data/spec/slack-ruby-bot/commands/unknown_spec.rb +2 -5
- data/spec/slack-ruby-bot/rspec/respond_with_error_spec.rb +19 -0
- metadata +52 -31
- data/Gemfile.lock +0 -107
- data/lib/slack-ruby-bot/fixtures/slack/auth_test.yml +0 -48
- data/lib/slack-ruby-bot/rspec/fixtures/slack/auth_test.yml +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83ecb7fe802af333ec3950f148959ce2c19095cc
|
4
|
+
data.tar.gz: da223c787bfe98e74543f1cc878ae04272c9b554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a29f81647a5b1b1d4156f4d51668697ce44ac6c80cba4ac4feb2f375c2d3eb4c31ac9af952dbae030e0c9646e4ec59ac3818d9bbfb2d989cbe24f0796453080
|
7
|
+
data.tar.gz: bd3d763b1334da9ccc10712f5b26bfc7f2f6942cdea9f9013edfeb3304881eca2bf8ad12cfd1e154339cd683bc365a24bb51ce4b6f8027064d3dfbe5d5dbc1ab
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
-
# on 2015-07-
|
2
|
+
# on 2015-07-10 08:49:06 -0400 using RuboCop version 0.32.1.
|
3
3
|
# The point is for the user to remove these configuration records
|
4
4
|
# one by one as the offenses are removed from the code base.
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
@@ -9,25 +9,21 @@
|
|
9
9
|
Lint/HandleExceptions:
|
10
10
|
Enabled: false
|
11
11
|
|
12
|
-
# Offense count:
|
12
|
+
# Offense count: 1
|
13
13
|
Metrics/AbcSize:
|
14
14
|
Max: 21
|
15
15
|
|
16
|
-
# Offense count:
|
17
|
-
Metrics/CyclomaticComplexity:
|
18
|
-
Max: 7
|
19
|
-
|
20
|
-
# Offense count: 18
|
16
|
+
# Offense count: 24
|
21
17
|
# Configuration parameters: AllowURI, URISchemes.
|
22
18
|
Metrics/LineLength:
|
23
|
-
Max:
|
19
|
+
Max: 142
|
24
20
|
|
25
21
|
# Offense count: 1
|
26
22
|
# Configuration parameters: CountComments.
|
27
23
|
Metrics/MethodLength:
|
28
24
|
Max: 17
|
29
25
|
|
30
|
-
# Offense count:
|
26
|
+
# Offense count: 15
|
31
27
|
Style/Documentation:
|
32
28
|
Enabled: false
|
33
29
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### 0.2.0 (7/10/2015)
|
2
|
+
|
3
|
+
* Sending `send_message` with nil or empty text will yield `Nothing to see here.` with a GIF instead of `no_text` - [@dblock](https://github.com/dblock).
|
4
|
+
* Added support for operators with `operator [name]` - [@dblock](https://github.com/dblock).
|
5
|
+
* Added support for custom commands with `command [name]` - [@dblock](https://github.com/dblock).
|
6
|
+
|
1
7
|
### 0.1.0 (6/2/2015)
|
2
8
|
|
3
9
|
* Initial public release - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
Slack-Ruby-Bot
|
2
2
|
==============
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/slack-ruby-bot.svg)](http://badge.fury.io/rb/slack-ruby-bot)
|
4
5
|
[![Build Status](https://travis-ci.org/dblock/slack-ruby-bot.png)](https://travis-ci.org/dblock/slack-ruby-bot)
|
5
6
|
|
6
|
-
A generic Slack bot framework written in Ruby. This library does all the heavy lifting so you can focus on implementing slack bot commands.
|
7
|
+
A generic Slack bot framework written in Ruby. This library does all the heavy lifting so you can focus on implementing slack bot commands, without introducing unnecessary requirements or limitations. It's a Slack bot boilerplate.
|
7
8
|
|
8
9
|
## Usage
|
9
10
|
|
@@ -36,19 +37,47 @@ end
|
|
36
37
|
PongBot::App.instance.run
|
37
38
|
```
|
38
39
|
|
39
|
-
After [registering the bot](DEPLOYMENT.md), run with `SLACK_API_KEY=... bundle exec ruby pongbot.rb`.
|
40
|
+
After [registering the bot](DEPLOYMENT.md), run with `SLACK_API_KEY=... bundle exec ruby pongbot.rb`. Have the bot join a channel and send it a ping.
|
41
|
+
|
42
|
+
![](screenshots/demo.gif)
|
43
|
+
|
44
|
+
### A Production Bot
|
45
|
+
|
46
|
+
A typical production Slack bot is a combination of a vanilla web server and a websocket application that talks to the Slack Real Time Messaging API. See our [Writing a Production Bot](TUTORIAL.md) tutorial for more information.
|
40
47
|
|
41
48
|
### More Involved Examples
|
42
49
|
|
43
|
-
|
50
|
+
The following examples of production-grade bots based on slack-ruby-bot are listed in growing order of complexity.
|
51
|
+
|
52
|
+
* [slack-mathbot](https://github.com/dblock/slack-mathbot): Slack integration with math.
|
53
|
+
* [slack-gamebot](https://github.com/dblock/slack-gamebot): A generic game bot for ping-pong, chess, etc.
|
44
54
|
|
45
|
-
|
55
|
+
### Commands and Operators
|
56
|
+
|
57
|
+
Bots are addressed by name and respond to commands and operators. By default a command class responds, case-insensitively, to its name. A class called `Phone` that inherits from `SlackRubyBot::Commands::Base` responds to `phone` and `Phone`. To respond to custom commands and to disable automatic class name matching, use the `command` keyword. The following command responds to `call` and `呼び出し` (call in Japanese).
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
class Phone < SlackRubyBot::Commands::Base
|
61
|
+
command 'call'
|
62
|
+
command '呼び出し'
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
Operators are 1-letter long and are similar to commands. They don't require addressing a bot nor separating an operator from its arguments. The following class responds to `=2+2`.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
class Calculator < SlackRubyBot::Commands::Base
|
70
|
+
operator '='
|
71
|
+
end
|
72
|
+
```
|
46
73
|
|
47
74
|
### Built-In Commands
|
48
75
|
|
76
|
+
Slack-ruby-bot comes with several built-in commands. You can re-define built-in commands, normally, as described above.
|
77
|
+
|
49
78
|
#### [bot name]
|
50
79
|
|
51
|
-
Shows bot version and links.
|
80
|
+
This is also known as the `default` command. Shows bot version and links.
|
52
81
|
|
53
82
|
#### [bot name] hi
|
54
83
|
|
data/TUTORIAL.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
## Production Bot Tutorial
|
2
|
+
|
3
|
+
In this tutorial we'll implement [slack-mathbot](https://github.com/dblock/slack-mathbot).
|
4
|
+
|
5
|
+
### Introduction
|
6
|
+
|
7
|
+
A typical production Slack bot is a combination of a vanilla web server and a websocket application that talks to the [Slack Real Time Messaging API](https://api.slack.com/rtm). The web server is optional, but most people will run their Slack bots on [Heroku](https://dashboard.heroku.com) in which case a web server is required to prevent Heroku from shutting the bot down. It also makes it convenient to develop a bot and test using `foreman`.
|
8
|
+
|
9
|
+
### Getting Started
|
10
|
+
|
11
|
+
#### Gemfile
|
12
|
+
|
13
|
+
Create a `Gemfile` that uses [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot), [sinatra](https://github.com/sinatra/sinatra) (a web framework) and [puma](https://github.com/puma/puma) (a web server). For development we'll also use [foreman](https://github.com/theforeman/foreman) and write tests with [rspec](https://github.com/rspec/rspec).
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
source 'http://rubygems.org'
|
17
|
+
|
18
|
+
gem 'slack-ruby-bot'
|
19
|
+
gem 'puma'
|
20
|
+
gem 'sinatra'
|
21
|
+
|
22
|
+
group :development, :test do
|
23
|
+
gem 'rake'
|
24
|
+
gem 'foreman'
|
25
|
+
end
|
26
|
+
|
27
|
+
group :test do
|
28
|
+
gem 'rspec'
|
29
|
+
gem 'rack-test'
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
Run `bundle install` to get all the gems.
|
34
|
+
|
35
|
+
#### Application
|
36
|
+
|
37
|
+
Create a folder called `slack-mathbot` and inside of it create `app.rb`.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
module SlackMathbot
|
41
|
+
class App < SlackRubyBot::App
|
42
|
+
end
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
#### Commands
|
47
|
+
|
48
|
+
Create a folder called `slack-mathbot/commands` and inside of it create `calculate.rb`. For now this calculator will always return 4.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
module SlackMathbot
|
52
|
+
module Commands
|
53
|
+
class Calculate < SlackRubyBot::Commands::Base
|
54
|
+
def self.call(data, command, arguments)
|
55
|
+
send_message data.channel, '4'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
#### Require Everything
|
63
|
+
|
64
|
+
Create a `slack-mathbot.rb` at the root and require the above files.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
require 'slack-ruby-bot'
|
68
|
+
require 'slack-mathbot/commands/calculate'
|
69
|
+
require 'slack-mathbot/app'
|
70
|
+
```
|
71
|
+
|
72
|
+
#### Web Server
|
73
|
+
|
74
|
+
We will need to keep the bot alive on Heroku, so create `web.rb`.
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
require 'sinatra/base'
|
78
|
+
|
79
|
+
module SlackMathbot
|
80
|
+
class Web < Sinatra::Base
|
81
|
+
get '/' do
|
82
|
+
'Math is good for you.'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Config.ru
|
89
|
+
|
90
|
+
Tie all the pieces togehter in `config.ru` which creates a thread for the bot and runs the web server on the main thread.
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
94
|
+
|
95
|
+
require 'slack-mathbot'
|
96
|
+
require 'web'
|
97
|
+
|
98
|
+
Thread.new do
|
99
|
+
begin
|
100
|
+
SlackMathbot::App.instance.run
|
101
|
+
rescue Exception => e
|
102
|
+
STDERR.puts "ERROR: #{e}"
|
103
|
+
STDERR.puts e.backtrace
|
104
|
+
raise e
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
run SlackMathbot::Web
|
109
|
+
```
|
110
|
+
|
111
|
+
### Create a Bot User
|
112
|
+
|
113
|
+
In Slack administration create a new Bot Integration under [services/new/bot](http://slack.com/services/new/bot).
|
114
|
+
|
115
|
+
![](screenshots/register-bot.png)
|
116
|
+
|
117
|
+
On the next screen, note the API token.
|
118
|
+
|
119
|
+
#### .env
|
120
|
+
|
121
|
+
Create a `.env` file with the API token from above and make sure to add it to `.gitignore`.
|
122
|
+
|
123
|
+
```
|
124
|
+
SLACK_API_TOKEN=...
|
125
|
+
```
|
126
|
+
|
127
|
+
### Run the Bot
|
128
|
+
|
129
|
+
Run `foreman start`. Your bot should be running.
|
130
|
+
|
131
|
+
```
|
132
|
+
14:32:32 web.1 | Puma starting in single mode...
|
133
|
+
14:32:32 web.1 | * Version 2.11.3 (ruby 2.1.6-p336), codename: Intrepid Squirrel
|
134
|
+
14:32:32 web.1 | * Min threads: 0, max threads: 16
|
135
|
+
14:32:32 web.1 | * Environment: development
|
136
|
+
14:32:35 web.1 | * Listening on tcp://0.0.0.0:5000
|
137
|
+
14:32:35 web.1 | Use Ctrl-C to stop
|
138
|
+
14:32:36 web.1 | I, [2015-07-10T14:32:36.216663 #98948] INFO -- : Welcome 'mathbot' to the 'xyz' team at https://xyz.slack.com/.
|
139
|
+
14:32:36 web.1 | I, [2015-07-10T14:32:36.766955 #98948] INFO -- : Successfully connected to https://xyz.slack.com/.
|
140
|
+
```
|
141
|
+
|
142
|
+
### Test
|
143
|
+
|
144
|
+
Invite the bot to a channel via `/invite [bot name]` and send it a `calculate` command with `[bot name] calculate 2+2`. It will respond with `4` from the code above.
|
145
|
+
|
146
|
+
### Deploy
|
147
|
+
|
148
|
+
See [DEPLOYMENT](DEPLOYMENT.md) for how to deploy your bot to production.
|
data/lib/slack-ruby-bot/app.rb
CHANGED
@@ -79,5 +79,15 @@ module SlackRubyBot
|
|
79
79
|
end
|
80
80
|
logger.info "Welcome '#{SlackRubyBot.config.user}' to the '#{SlackRubyBot.config.team}' team at #{SlackRubyBot.config.url}."
|
81
81
|
end
|
82
|
+
|
83
|
+
def reset!
|
84
|
+
SlackRubyBot.configure do |config|
|
85
|
+
config.url = nil
|
86
|
+
config.team = nil
|
87
|
+
config.user = nil
|
88
|
+
config.team_id = nil
|
89
|
+
config.user_id = nil
|
90
|
+
end
|
91
|
+
end
|
82
92
|
end
|
83
93
|
end
|
@@ -1,8 +1,15 @@
|
|
1
1
|
module SlackRubyBot
|
2
2
|
module Commands
|
3
3
|
class Base
|
4
|
+
class_attribute :operators
|
5
|
+
class_attribute :commands
|
6
|
+
|
4
7
|
def self.send_message(channel, text)
|
5
|
-
|
8
|
+
if text && text.length > 0
|
9
|
+
Slack.chat_postMessage(channel: channel, text: text)
|
10
|
+
else
|
11
|
+
send_message_with_gif channel, 'Nothing to see here.', 'nothing'
|
12
|
+
end
|
6
13
|
end
|
7
14
|
|
8
15
|
def self.send_message_with_gif(channel, text, keywords)
|
@@ -22,6 +29,28 @@ module SlackRubyBot
|
|
22
29
|
Logger.new(STDOUT)
|
23
30
|
end
|
24
31
|
end
|
32
|
+
|
33
|
+
def self.responds_to_command?(command)
|
34
|
+
commands ? commands.include?(command) : command == default_command_name
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.default_command_name
|
38
|
+
name && name.split(':').last.downcase
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.responds_to_operator?(operator)
|
42
|
+
operators && operators.include?(operator)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.operator(value)
|
46
|
+
self.operators ||= []
|
47
|
+
self.operators << value.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.command(value)
|
51
|
+
self.commands ||= []
|
52
|
+
self.commands << value.to_s
|
53
|
+
end
|
25
54
|
end
|
26
55
|
end
|
27
56
|
end
|
@@ -5,36 +5,118 @@ module SlackRubyBot
|
|
5
5
|
|
6
6
|
def message(data)
|
7
7
|
data = Hashie::Mash.new(data)
|
8
|
-
|
9
|
-
return unless
|
10
|
-
klass
|
11
|
-
klass.call data, command, arguments
|
8
|
+
klass, command, arguments = text_to_class(data.text)
|
9
|
+
return unless klass
|
10
|
+
klass.call(data, command, arguments)
|
12
11
|
end
|
13
12
|
|
14
13
|
private
|
15
14
|
|
15
|
+
#
|
16
|
+
# Lookup a class that can execute a command or an operator.
|
17
|
+
#
|
18
|
+
# @param [String] text Free-formed text from Slack.
|
19
|
+
#
|
20
|
+
# @return [SlackRubyBot::Commands::Base] A child class of SlackRubyBot::Commands::Base.
|
21
|
+
#
|
22
|
+
def text_to_class(text)
|
23
|
+
return unless text
|
24
|
+
command, arguments = parse_command(text)
|
25
|
+
if command
|
26
|
+
[command_to_class(command) || SlackRubyBot::Commands::Unknown, command, arguments]
|
27
|
+
else
|
28
|
+
command, arguments = parse_operator(text)
|
29
|
+
[operator_to_class(command), command, arguments]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Split text into a command and its arguments.
|
35
|
+
#
|
36
|
+
# @param [String] text Free-formed text from Slack, eg. `bot do something`.
|
37
|
+
#
|
38
|
+
# @return [Array] An array of command and arguments or nil.
|
39
|
+
#
|
16
40
|
def parse_command(text)
|
17
41
|
return unless text
|
18
|
-
text = '= ' + text[1..text.length] if text[0] == '='
|
19
42
|
parts = text.split.reject(&:blank?)
|
20
|
-
|
21
|
-
|
22
|
-
|
43
|
+
return unless parts && parts.any?
|
44
|
+
# command is [bot] <command> (argument1, ...)
|
45
|
+
bot_or_operator = parts.first.downcase
|
46
|
+
return unless SlackRubyBot.config.user == bot_or_operator
|
47
|
+
command = parts[1].try(:downcase) || 'default'
|
48
|
+
arguments = parts[2..parts.length]
|
49
|
+
[command, arguments]
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Split text into an operator and its arguments.
|
54
|
+
#
|
55
|
+
# @param [String] text Free-formed text from Slack, eg. =2+2.
|
56
|
+
#
|
57
|
+
# @return [Array] An array and arguments or nil.
|
58
|
+
#
|
59
|
+
def parse_operator(text)
|
60
|
+
return unless text && text.length > 0
|
61
|
+
[text[0], text[1..text.length].split.reject(&:blank?)]
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# All commands.
|
66
|
+
#
|
67
|
+
# @return [Array] Descendants of SlackRubyBot::Commands::Base.
|
68
|
+
#
|
69
|
+
def command_classes
|
70
|
+
SlackRubyBot::Commands::Base.descendants
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# All non-built-in, ie. custom commands.
|
75
|
+
#
|
76
|
+
# @return [Array] Non-built-in descendants of SlackRubyBot::Commands::Base.
|
77
|
+
#
|
78
|
+
def child_command_classes
|
79
|
+
command_classes.reject do |k|
|
80
|
+
k.name && k.name.starts_with?('SlackRubyBot::Commands::')
|
23
81
|
end
|
24
|
-
[parts.first.downcase, parts[1].try(:downcase), parts[2..parts.length]] if parts && parts.any?
|
25
82
|
end
|
26
83
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
84
|
+
#
|
85
|
+
# All built-in commands.
|
86
|
+
#
|
87
|
+
# @return [Array] Built-in descendants of SlackRubyBot::Commands::Base.
|
88
|
+
#
|
89
|
+
def built_in_command_classes
|
90
|
+
command_classes.select do |k|
|
91
|
+
k.name && k.name.starts_with?('SlackRubyBot::Commands::')
|
92
|
+
end
|
31
93
|
end
|
32
94
|
|
95
|
+
#
|
96
|
+
# Converts a command to a class.
|
97
|
+
#
|
98
|
+
# @param [String] command Command tet.
|
99
|
+
#
|
100
|
+
# @return [SlackRubyBot::Commands::Base] A command implementation.
|
101
|
+
#
|
33
102
|
def command_to_class(command)
|
34
103
|
# prioritize implementations to built-in classes
|
35
|
-
klass =
|
36
|
-
klass ||=
|
37
|
-
klass
|
104
|
+
klass = child_command_classes.detect { |d| d.responds_to_command?(command) }
|
105
|
+
klass ||= built_in_command_classes.detect { |d| d.responds_to_command?(command) }
|
106
|
+
klass
|
107
|
+
end
|
108
|
+
|
109
|
+
#
|
110
|
+
# Converts an operator to a class.
|
111
|
+
#
|
112
|
+
# @param [String] operator Operator text.
|
113
|
+
#
|
114
|
+
# @return [<type>] An operator implementation.
|
115
|
+
#
|
116
|
+
def operator_to_class(operator)
|
117
|
+
command_classes.detect do |k|
|
118
|
+
k.responds_to_operator?(operator)
|
119
|
+
end
|
38
120
|
end
|
39
121
|
end
|
40
122
|
end
|
@@ -52,52 +52,6 @@ http_interactions:
|
|
52
52
|
- keep-alive
|
53
53
|
body:
|
54
54
|
encoding: UTF-8
|
55
|
-
string: '{"ok":true,"url":"https:\/\/rubybot.slack.com\/","team":"
|
55
|
+
string: '{"ok":true,"url":"https:\/\/rubybot.slack.com\/","team":"team_name","user":"user_name","team_id":"TDEADBEEF","user_id":"UBAADFOOD"}'
|
56
56
|
http_version:
|
57
57
|
recorded_at: Tue, 28 Apr 2015 12:55:22 GMT
|
58
|
-
- request:
|
59
|
-
method: post
|
60
|
-
uri: https://slack.com/api/rtm.start
|
61
|
-
body:
|
62
|
-
encoding: UTF-8
|
63
|
-
string: token=token
|
64
|
-
headers:
|
65
|
-
Accept:
|
66
|
-
- application/json; charset=utf-8
|
67
|
-
User-Agent:
|
68
|
-
- Slack Ruby Gem 1.1.1
|
69
|
-
Content-Type:
|
70
|
-
- application/x-www-form-urlencoded
|
71
|
-
Accept-Encoding:
|
72
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
73
|
-
response:
|
74
|
-
status:
|
75
|
-
code: 200
|
76
|
-
message: OK
|
77
|
-
headers:
|
78
|
-
Access-Control-Allow-Origin:
|
79
|
-
- '*'
|
80
|
-
Content-Type:
|
81
|
-
- application/json; charset=utf-8
|
82
|
-
Date:
|
83
|
-
- Tue, 28 Apr 2015 21:41:33 GMT
|
84
|
-
Server:
|
85
|
-
- Apache
|
86
|
-
Strict-Transport-Security:
|
87
|
-
- max-age=31536000; includeSubDomains; preload
|
88
|
-
Vary:
|
89
|
-
- Accept-Encoding
|
90
|
-
X-Content-Type-Options:
|
91
|
-
- nosniff
|
92
|
-
X-Xss-Protection:
|
93
|
-
- '0'
|
94
|
-
Content-Length:
|
95
|
-
- '55'
|
96
|
-
Connection:
|
97
|
-
- keep-alive
|
98
|
-
body:
|
99
|
-
encoding: UTF-8
|
100
|
-
string: '{"ok":false,"error":"invalid_auth"}'
|
101
|
-
http_version:
|
102
|
-
recorded_at: Tue, 28 Apr 2015 21:41:33 GMT
|
103
|
-
recorded_with: VCR 2.9.3
|
@@ -15,10 +15,13 @@ shared_examples 'a slack ruby bot' do
|
|
15
15
|
before do
|
16
16
|
subject.send(:auth!)
|
17
17
|
end
|
18
|
+
after do
|
19
|
+
subject.send(:reset!)
|
20
|
+
end
|
18
21
|
it 'succeeds auth' do
|
19
22
|
expect(subject.config.url).to eq 'https://rubybot.slack.com/'
|
20
|
-
expect(subject.config.team).to eq '
|
21
|
-
expect(subject.config.user).to eq '
|
23
|
+
expect(subject.config.team).to eq 'team_name'
|
24
|
+
expect(subject.config.user).to eq 'user_name'
|
22
25
|
expect(subject.config.team_id).to eq 'TDEADBEEF'
|
23
26
|
expect(subject.config.user_id).to eq 'UBAADFOOD'
|
24
27
|
end
|
@@ -3,7 +3,6 @@ require 'rspec/expectations'
|
|
3
3
|
RSpec::Matchers.define :respond_with_slack_message do |expected|
|
4
4
|
match do |actual|
|
5
5
|
channel, user, message = parse(actual)
|
6
|
-
SlackRubyBot.config.user ||= 'rubybot'
|
7
6
|
allow(Giphy).to receive(:random)
|
8
7
|
expect(SlackRubyBot::Commands::Base).to receive(:send_message).with(channel, expected)
|
9
8
|
app.send(:message, text: message, channel: channel, user: user)
|
Binary file
|
data/slack-ruby-bot.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_dependency 'slack-api', '~> 1.1.6'
|
19
19
|
s.add_dependency 'activesupport'
|
20
20
|
s.add_dependency 'giphy', '~> 2.0.2'
|
21
|
+
s.add_dependency 'websocket-driver', '~> 0.5.4'
|
21
22
|
s.add_development_dependency 'rake'
|
22
23
|
s.add_development_dependency 'rspec'
|
23
24
|
s.add_development_dependency 'rack-test'
|
@@ -4,13 +4,10 @@ describe SlackRubyBot::Commands::Default do
|
|
4
4
|
def app
|
5
5
|
SlackRubyBot::App.new
|
6
6
|
end
|
7
|
-
|
8
|
-
|
7
|
+
it 'lowercase' do
|
8
|
+
expect(message: SlackRubyBot.config.user).to respond_with_slack_message(SlackRubyBot::ABOUT)
|
9
9
|
end
|
10
|
-
it '
|
11
|
-
expect(message:
|
12
|
-
end
|
13
|
-
it 'Rubybot' do
|
14
|
-
expect(message: 'Rubybot').to respond_with_slack_message(SlackRubyBot::ABOUT)
|
10
|
+
it 'upcase' do
|
11
|
+
expect(message: SlackRubyBot.config.user.upcase).to respond_with_slack_message(SlackRubyBot::ABOUT)
|
15
12
|
end
|
16
13
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SlackRubyBot::Commands do
|
4
|
+
let! :command do
|
5
|
+
Class.new(SlackRubyBot::Commands::Base) do
|
6
|
+
command 'sayhi'
|
7
|
+
command 'saybye'
|
8
|
+
|
9
|
+
def self.call(data, command, arguments)
|
10
|
+
send_message data.channel, "#{command}: #{arguments}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def app
|
15
|
+
SlackRubyBot::App.new
|
16
|
+
end
|
17
|
+
it 'supports multiple commands' do
|
18
|
+
expect(message: "#{SlackRubyBot.config.user} sayhi arg1 arg2").to respond_with_slack_message('sayhi: ["arg1", "arg2"]')
|
19
|
+
expect(message: "#{SlackRubyBot.config.user} saybye arg1 arg2").to respond_with_slack_message('saybye: ["arg1", "arg2"]')
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SlackRubyBot::Commands do
|
4
|
+
let! :command do
|
5
|
+
Class.new(SlackRubyBot::Commands::Base) do
|
6
|
+
command 'test'
|
7
|
+
|
8
|
+
def self.call(data, _command, _arguments)
|
9
|
+
send_message data.channel, nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
def app
|
14
|
+
SlackRubyBot::App.new
|
15
|
+
end
|
16
|
+
it 'sends default text' do
|
17
|
+
allow(Giphy).to receive(:random)
|
18
|
+
expect(SlackRubyBot::Commands::Base).to receive(:send_message_with_gif).with('channel', 'Nothing to see here.', 'nothing')
|
19
|
+
app.send(:message, text: "#{SlackRubyBot.config.user} test", channel: 'channel', user: 'user')
|
20
|
+
end
|
21
|
+
end
|
@@ -4,10 +4,7 @@ describe SlackRubyBot::Commands::Help do
|
|
4
4
|
def app
|
5
5
|
SlackRubyBot::App.new
|
6
6
|
end
|
7
|
-
before do
|
8
|
-
app.config.user = 'rubybot'
|
9
|
-
end
|
10
7
|
it 'help' do
|
11
|
-
expect(message:
|
8
|
+
expect(message: "#{SlackRubyBot.config.user} help").to respond_with_slack_message('See https://github.com/dblock/slack-ruby-bot, please.')
|
12
9
|
end
|
13
10
|
end
|
@@ -4,10 +4,7 @@ describe SlackRubyBot::Commands::Hi do
|
|
4
4
|
def app
|
5
5
|
SlackRubyBot::App.new
|
6
6
|
end
|
7
|
-
before do
|
8
|
-
app.config.user = 'rubybot'
|
9
|
-
end
|
10
7
|
it 'says hi' do
|
11
|
-
expect(message:
|
8
|
+
expect(message: "#{SlackRubyBot.config.user} hi").to respond_with_slack_message('Hi <@user>!')
|
12
9
|
end
|
13
10
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SlackRubyBot::Commands do
|
4
|
+
let! :command do
|
5
|
+
Class.new(SlackRubyBot::Commands::Base) do
|
6
|
+
operator '='
|
7
|
+
operator '-'
|
8
|
+
|
9
|
+
def self.call(data, command, arguments)
|
10
|
+
send_message data.channel, "#{command}: #{arguments}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
def app
|
15
|
+
SlackRubyBot::App.new
|
16
|
+
end
|
17
|
+
it 'supports operators' do
|
18
|
+
expect(message: '=2+2').to respond_with_slack_message('=: ["2+2"]')
|
19
|
+
end
|
20
|
+
end
|
@@ -1,14 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe SlackRubyBot::Commands::Unknown
|
3
|
+
describe SlackRubyBot::Commands::Unknown do
|
4
4
|
def app
|
5
5
|
SlackRubyBot::App.new
|
6
6
|
end
|
7
|
-
before do
|
8
|
-
app.config.user = 'rubybot'
|
9
|
-
end
|
10
7
|
it 'invalid command' do
|
11
|
-
expect(message:
|
8
|
+
expect(message: "#{SlackRubyBot.config.user} foobar").to respond_with_slack_message("Sorry <@user>, I don't understand that command!")
|
12
9
|
end
|
13
10
|
it 'does not respond to sad face' do
|
14
11
|
expect(SlackRubyBot::Commands::Base).to_not receive(:send_message)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RSpec do
|
4
|
+
let! :command do
|
5
|
+
Class.new(SlackRubyBot::Commands::Base) do
|
6
|
+
command 'raise'
|
7
|
+
|
8
|
+
def self.call(_data, command, _arguments)
|
9
|
+
fail ArgumentError, command
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
def app
|
14
|
+
SlackRubyBot::App.new
|
15
|
+
end
|
16
|
+
it 'respond_with_error' do
|
17
|
+
expect(message: "#{SlackRubyBot.config.user} raise").to respond_with_error('raise')
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,139 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: slack-api
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.1.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: giphy
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.0.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.0.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: websocket-driver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.4
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.4
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '>='
|
74
88
|
- !ruby/object:Gem::Version
|
75
89
|
version: '0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '>='
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rspec
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- -
|
101
|
+
- - '>='
|
88
102
|
- !ruby/object:Gem::Version
|
89
103
|
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- -
|
108
|
+
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rack-test
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- -
|
115
|
+
- - '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- -
|
122
|
+
- - '>='
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: vcr
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- -
|
129
|
+
- - '>='
|
116
130
|
- !ruby/object:Gem::Version
|
117
131
|
version: '0'
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- -
|
136
|
+
- - '>='
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: webmock
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- -
|
143
|
+
- - '>='
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '0'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- -
|
150
|
+
- - '>='
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
@@ -156,19 +170,19 @@ executables: []
|
|
156
170
|
extensions: []
|
157
171
|
extra_rdoc_files: []
|
158
172
|
files:
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
173
|
+
- .gitignore
|
174
|
+
- .rspec
|
175
|
+
- .rubocop.yml
|
176
|
+
- .rubocop_todo.yml
|
177
|
+
- .travis.yml
|
164
178
|
- CHANGELOG.md
|
165
179
|
- CONTRIBUTING.md
|
166
180
|
- DEPLOYMENT.md
|
167
181
|
- Gemfile
|
168
|
-
- Gemfile.lock
|
169
182
|
- LICENSE.md
|
170
183
|
- README.md
|
171
184
|
- Rakefile
|
185
|
+
- TUTORIAL.md
|
172
186
|
- examples/minimal/Gemfile
|
173
187
|
- examples/minimal/Gemfile.lock
|
174
188
|
- examples/minimal/pongbot.rb
|
@@ -187,13 +201,11 @@ files:
|
|
187
201
|
- lib/slack-ruby-bot/commands/hi.rb
|
188
202
|
- lib/slack-ruby-bot/commands/unknown.rb
|
189
203
|
- lib/slack-ruby-bot/config.rb
|
190
|
-
- lib/slack-ruby-bot/fixtures/slack/auth_test.yml
|
191
204
|
- lib/slack-ruby-bot/hooks.rb
|
192
205
|
- lib/slack-ruby-bot/hooks/base.rb
|
193
206
|
- lib/slack-ruby-bot/hooks/hello.rb
|
194
207
|
- lib/slack-ruby-bot/hooks/message.rb
|
195
208
|
- lib/slack-ruby-bot/rspec.rb
|
196
|
-
- lib/slack-ruby-bot/rspec/fixtures/slack/auth_test.yml
|
197
209
|
- lib/slack-ruby-bot/rspec/support/fixtures/slack/auth_test.yml
|
198
210
|
- lib/slack-ruby-bot/rspec/support/slack-ruby-bot/it_behaves_like_a_slack_bot.rb
|
199
211
|
- lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_error.rb
|
@@ -203,13 +215,18 @@ files:
|
|
203
215
|
- lib/slack-ruby-bot/rspec/support/vcr.rb
|
204
216
|
- lib/slack-ruby-bot/version.rb
|
205
217
|
- lib/slack_ruby_bot.rb
|
218
|
+
- screenshots/demo.gif
|
206
219
|
- screenshots/register-bot.png
|
207
220
|
- slack-ruby-bot.gemspec
|
208
221
|
- spec/slack-ruby-bot/app_spec.rb
|
209
222
|
- spec/slack-ruby-bot/commands/about_spec.rb
|
223
|
+
- spec/slack-ruby-bot/commands/commands_spec.rb
|
224
|
+
- spec/slack-ruby-bot/commands/empty_text_spec.rb
|
210
225
|
- spec/slack-ruby-bot/commands/help_spec.rb
|
211
226
|
- spec/slack-ruby-bot/commands/hi_spec.rb
|
227
|
+
- spec/slack-ruby-bot/commands/operators_spec.rb
|
212
228
|
- spec/slack-ruby-bot/commands/unknown_spec.rb
|
229
|
+
- spec/slack-ruby-bot/rspec/respond_with_error_spec.rb
|
213
230
|
- spec/slack-ruby-bot/version_spec.rb
|
214
231
|
- spec/spec_helper.rb
|
215
232
|
homepage: http://github.com/dblock/slack-ruby-bot
|
@@ -222,25 +239,29 @@ require_paths:
|
|
222
239
|
- lib
|
223
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
224
241
|
requirements:
|
225
|
-
- -
|
242
|
+
- - '>='
|
226
243
|
- !ruby/object:Gem::Version
|
227
244
|
version: '0'
|
228
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
229
246
|
requirements:
|
230
|
-
- -
|
247
|
+
- - '>='
|
231
248
|
- !ruby/object:Gem::Version
|
232
249
|
version: 1.3.6
|
233
250
|
requirements: []
|
234
251
|
rubyforge_project:
|
235
|
-
rubygems_version: 2.
|
252
|
+
rubygems_version: 2.4.5
|
236
253
|
signing_key:
|
237
254
|
specification_version: 4
|
238
255
|
summary: Generic bot framework written in Ruby.
|
239
256
|
test_files:
|
240
257
|
- spec/slack-ruby-bot/app_spec.rb
|
241
258
|
- spec/slack-ruby-bot/commands/about_spec.rb
|
259
|
+
- spec/slack-ruby-bot/commands/commands_spec.rb
|
260
|
+
- spec/slack-ruby-bot/commands/empty_text_spec.rb
|
242
261
|
- spec/slack-ruby-bot/commands/help_spec.rb
|
243
262
|
- spec/slack-ruby-bot/commands/hi_spec.rb
|
263
|
+
- spec/slack-ruby-bot/commands/operators_spec.rb
|
244
264
|
- spec/slack-ruby-bot/commands/unknown_spec.rb
|
265
|
+
- spec/slack-ruby-bot/rspec/respond_with_error_spec.rb
|
245
266
|
- spec/slack-ruby-bot/version_spec.rb
|
246
267
|
- spec/spec_helper.rb
|
data/Gemfile.lock
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
slack-ruby-bot (0.1.0)
|
5
|
-
activesupport
|
6
|
-
giphy (~> 2.0.2)
|
7
|
-
hashie
|
8
|
-
slack-api (~> 1.1.6)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: http://rubygems.org/
|
12
|
-
specs:
|
13
|
-
activesupport (4.2.3)
|
14
|
-
i18n (~> 0.7)
|
15
|
-
json (~> 1.7, >= 1.7.7)
|
16
|
-
minitest (~> 5.1)
|
17
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
18
|
-
tzinfo (~> 1.1)
|
19
|
-
addressable (2.3.8)
|
20
|
-
ast (2.0.0)
|
21
|
-
astrolabe (1.3.0)
|
22
|
-
parser (>= 2.2.0.pre.3, < 3.0)
|
23
|
-
crack (0.4.2)
|
24
|
-
safe_yaml (~> 1.0.0)
|
25
|
-
diff-lcs (1.2.5)
|
26
|
-
eventmachine (1.0.7)
|
27
|
-
faraday (0.9.1)
|
28
|
-
multipart-post (>= 1.2, < 3)
|
29
|
-
faraday_middleware (0.9.1)
|
30
|
-
faraday (>= 0.7.4, < 0.10)
|
31
|
-
faraday_middleware-parse_oj (0.3.0)
|
32
|
-
faraday (~> 0.9.0)
|
33
|
-
faraday_middleware (~> 0.9.1)
|
34
|
-
oj (~> 2.0)
|
35
|
-
faye-websocket (0.9.2)
|
36
|
-
eventmachine (>= 0.12.0)
|
37
|
-
websocket-driver (>= 0.5.1)
|
38
|
-
giphy (2.0.2)
|
39
|
-
faraday (~> 0.9)
|
40
|
-
faraday_middleware (~> 0.9)
|
41
|
-
faraday_middleware-parse_oj (~> 0.3)
|
42
|
-
launchy (~> 2.4)
|
43
|
-
hashie (3.4.2)
|
44
|
-
i18n (0.7.0)
|
45
|
-
json (1.8.3)
|
46
|
-
launchy (2.4.3)
|
47
|
-
addressable (~> 2.3)
|
48
|
-
minitest (5.7.0)
|
49
|
-
multi_json (1.11.1)
|
50
|
-
multipart-post (2.0.0)
|
51
|
-
oj (2.12.9)
|
52
|
-
parser (2.3.0.pre.2)
|
53
|
-
ast (>= 1.1, < 3.0)
|
54
|
-
powerpack (0.1.1)
|
55
|
-
rack (1.6.4)
|
56
|
-
rack-test (0.6.3)
|
57
|
-
rack (>= 1.0)
|
58
|
-
rainbow (2.0.0)
|
59
|
-
rake (10.4.2)
|
60
|
-
rspec (3.3.0)
|
61
|
-
rspec-core (~> 3.3.0)
|
62
|
-
rspec-expectations (~> 3.3.0)
|
63
|
-
rspec-mocks (~> 3.3.0)
|
64
|
-
rspec-core (3.3.1)
|
65
|
-
rspec-support (~> 3.3.0)
|
66
|
-
rspec-expectations (3.3.0)
|
67
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.3.0)
|
69
|
-
rspec-mocks (3.3.1)
|
70
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.3.0)
|
72
|
-
rspec-support (3.3.0)
|
73
|
-
rubocop (0.32.1)
|
74
|
-
astrolabe (~> 1.3)
|
75
|
-
parser (>= 2.2.2.5, < 3.0)
|
76
|
-
powerpack (~> 0.1)
|
77
|
-
rainbow (>= 1.99.1, < 3.0)
|
78
|
-
ruby-progressbar (~> 1.4)
|
79
|
-
ruby-progressbar (1.7.5)
|
80
|
-
safe_yaml (1.0.4)
|
81
|
-
slack-api (1.1.6)
|
82
|
-
faraday (>= 0.7, < 0.10)
|
83
|
-
faraday_middleware (~> 0.8)
|
84
|
-
faye-websocket (~> 0.9.2)
|
85
|
-
multi_json (~> 1.0, >= 1.0.3)
|
86
|
-
thread_safe (0.3.5)
|
87
|
-
tzinfo (1.2.2)
|
88
|
-
thread_safe (~> 0.1)
|
89
|
-
vcr (2.9.3)
|
90
|
-
webmock (1.21.0)
|
91
|
-
addressable (>= 2.3.6)
|
92
|
-
crack (>= 0.3.2)
|
93
|
-
websocket-driver (0.5.4)
|
94
|
-
websocket-extensions (>= 0.1.0)
|
95
|
-
websocket-extensions (0.1.2)
|
96
|
-
|
97
|
-
PLATFORMS
|
98
|
-
ruby
|
99
|
-
|
100
|
-
DEPENDENCIES
|
101
|
-
rack-test
|
102
|
-
rake
|
103
|
-
rspec
|
104
|
-
rubocop (= 0.32.1)
|
105
|
-
slack-ruby-bot!
|
106
|
-
vcr
|
107
|
-
webmock
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://slack.com/api/auth.test
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: token=test
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/json; charset=utf-8
|
12
|
-
User-Agent:
|
13
|
-
- Slack Ruby Gem 1.1.6
|
14
|
-
Content-Type:
|
15
|
-
- application/x-www-form-urlencoded
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
Access-Control-Allow-Origin:
|
24
|
-
- "*"
|
25
|
-
Content-Type:
|
26
|
-
- application/json; charset=utf-8
|
27
|
-
Date:
|
28
|
-
- Thu, 02 Jul 2015 17:55:20 GMT
|
29
|
-
Server:
|
30
|
-
- Apache
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000; includeSubDomains; preload
|
33
|
-
Vary:
|
34
|
-
- Accept-Encoding
|
35
|
-
X-Content-Type-Options:
|
36
|
-
- nosniff
|
37
|
-
X-Xss-Protection:
|
38
|
-
- '0'
|
39
|
-
Content-Length:
|
40
|
-
- '55'
|
41
|
-
Connection:
|
42
|
-
- keep-alive
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"ok":false,"error":"invalid_auth"}'
|
46
|
-
http_version:
|
47
|
-
recorded_at: Thu, 02 Jul 2015 17:55:48 GMT
|
48
|
-
recorded_with: VCR 2.9.3
|
@@ -1,48 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://slack.com/api/auth.test
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: token=test
|
9
|
-
headers:
|
10
|
-
Accept:
|
11
|
-
- application/json; charset=utf-8
|
12
|
-
User-Agent:
|
13
|
-
- Slack Ruby Gem 1.1.6
|
14
|
-
Content-Type:
|
15
|
-
- application/x-www-form-urlencoded
|
16
|
-
Accept-Encoding:
|
17
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
-
response:
|
19
|
-
status:
|
20
|
-
code: 200
|
21
|
-
message: OK
|
22
|
-
headers:
|
23
|
-
Access-Control-Allow-Origin:
|
24
|
-
- "*"
|
25
|
-
Content-Type:
|
26
|
-
- application/json; charset=utf-8
|
27
|
-
Date:
|
28
|
-
- Thu, 02 Jul 2015 17:48:15 GMT
|
29
|
-
Server:
|
30
|
-
- Apache
|
31
|
-
Strict-Transport-Security:
|
32
|
-
- max-age=31536000; includeSubDomains; preload
|
33
|
-
Vary:
|
34
|
-
- Accept-Encoding
|
35
|
-
X-Content-Type-Options:
|
36
|
-
- nosniff
|
37
|
-
X-Xss-Protection:
|
38
|
-
- '0'
|
39
|
-
Content-Length:
|
40
|
-
- '55'
|
41
|
-
Connection:
|
42
|
-
- keep-alive
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"ok":false,"error":"invalid_auth"}'
|
46
|
-
http_version:
|
47
|
-
recorded_at: Thu, 02 Jul 2015 17:48:42 GMT
|
48
|
-
recorded_with: VCR 2.9.3
|