laziness 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -3
- data/README.md +42 -1
- data/laziness.gemspec +3 -1
- data/lib/laziness/api/rtm.rb +13 -0
- data/lib/laziness/api.rb +1 -0
- data/lib/laziness/client.rb +4 -0
- data/lib/laziness/message.rb +41 -0
- data/lib/laziness/observer.rb +24 -0
- data/lib/laziness/real_time.rb +67 -0
- data/lib/laziness/registry.rb +25 -0
- data/lib/laziness/session.rb +4 -0
- data/lib/laziness/version.rb +1 -1
- data/lib/laziness.rb +5 -0
- data/spec/laziness/api/rtm_spec.rb +12 -0
- data/spec/laziness/message_spec.rb +25 -0
- data/spec/laziness/observer_spec.rb +77 -0
- data/spec/laziness/real_time_spec.rb +70 -0
- data/spec/laziness/registry_spec.rb +34 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/support/fixtures/rtm_start.json +4 -0
- metadata +49 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353b8c42facc5a505560e6b414990779a3f323cc
|
4
|
+
data.tar.gz: c3f63565b0e52a3f6795cf8e0795888ba5cb453a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d958f1c1afd12cd0a172e7d44b67c60ad8d35282d029950a301c48ea189ee34099a92f55ca2c1e50e0fc947ef95a48a71bbb8cbe3b153c186a23ce0005a69c50
|
7
|
+
data.tar.gz: 8e6f9f9e7f6f03605864daad3dcaf7cd41a9ab045555ef8271b556aa10b2efef8244bc4363952ceafe489657d15265ad9f2e2421a45a6cab32f726782917e583
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
laziness (0.1.
|
4
|
+
laziness (0.1.6)
|
5
|
+
eventmachine
|
6
|
+
faye-websocket (>= 0.8.0)
|
5
7
|
hashie
|
6
8
|
httparty
|
7
9
|
|
@@ -12,8 +14,12 @@ GEM
|
|
12
14
|
crack (0.4.2)
|
13
15
|
safe_yaml (~> 1.0.0)
|
14
16
|
diff-lcs (1.2.5)
|
15
|
-
|
16
|
-
|
17
|
+
eventmachine (1.0.8)
|
18
|
+
faye-websocket (0.10.0)
|
19
|
+
eventmachine (>= 0.12.0)
|
20
|
+
websocket-driver (>= 0.5.1)
|
21
|
+
hashie (3.4.3)
|
22
|
+
httparty (0.13.7)
|
17
23
|
json (~> 1.8)
|
18
24
|
multi_xml (>= 0.5.2)
|
19
25
|
json (1.8.3)
|
@@ -35,6 +41,9 @@ GEM
|
|
35
41
|
webmock (1.18.0)
|
36
42
|
addressable (>= 2.3.6)
|
37
43
|
crack (>= 0.3.2)
|
44
|
+
websocket-driver (0.6.2)
|
45
|
+
websocket-extensions (>= 0.1.0)
|
46
|
+
websocket-extensions (0.1.2)
|
38
47
|
|
39
48
|
PLATFORMS
|
40
49
|
ruby
|
data/README.md
CHANGED
@@ -25,7 +25,11 @@ Or install it yourself:
|
|
25
25
|
gem install laziness
|
26
26
|
```
|
27
27
|
|
28
|
-
## USAGE
|
28
|
+
## WEB API USAGE
|
29
|
+
|
30
|
+
The [Slack Web API](https://api.slack.com/web) is made up of HTTP RPC-style methods that allow you to communicate with Slack as yourself via an access token.
|
31
|
+
|
32
|
+
You start by creating a `Client` with the access token you want to use. You can make calls to each [type](https://api.slack.com/types) using the [methods](https://api.slack.com/methods).
|
29
33
|
|
30
34
|
```
|
31
35
|
client = Slack.client(access_token: "your-access-token")
|
@@ -104,6 +108,12 @@ client.oauth.access(client_id, client_secret, code, redirect_uri) # exchange api
|
|
104
108
|
|
105
109
|
### Presence
|
106
110
|
|
111
|
+
### RTM
|
112
|
+
|
113
|
+
```
|
114
|
+
client.rtm.start # get an rtm session back with a url for connecting
|
115
|
+
```
|
116
|
+
|
107
117
|
### Search
|
108
118
|
|
109
119
|
### Stars
|
@@ -116,6 +126,37 @@ client.users.find(user_id) # get info about a specific user
|
|
116
126
|
client.users.set_active # sets the current user (defined by the access_token) as active
|
117
127
|
```
|
118
128
|
|
129
|
+
## REAL TIME API USAGE
|
130
|
+
|
131
|
+
The [Slack Real Time Messaging API](https://api.slack.com/rtm) is made up of Websocket events that allow you to communicate with Slack as a bot (or yourself) with an access token.
|
132
|
+
|
133
|
+
You start by creating a `Client` with the access token you want to use (bot or otherwise) and call the `rtm.start` method which will return the websocket url to use. You can make wait for [events](https://api.slack.com/events) and respond to those directly.
|
134
|
+
|
135
|
+
```
|
136
|
+
client = Slack::Client.new bot_access_token
|
137
|
+
session = client.rtm.start
|
138
|
+
|
139
|
+
# Create a websocket for the session
|
140
|
+
ws = Slack::RealTime.new(session)
|
141
|
+
|
142
|
+
# Respond to open, close, and error events
|
143
|
+
ws.on(:error) { |event| print "ERROR OCCURRED (@ #{Time.now}): #{event.inspect}\n" }
|
144
|
+
ws.on(:close) { |event| print "CLOSED! (@ #{Time.now}): #{event.inspect}\n" }
|
145
|
+
|
146
|
+
# Respond to Slack events
|
147
|
+
ws.on(:message) do |data|
|
148
|
+
print "RECEIVED MESSAGE (@ #{Time.now}): #{data.inspect}\n"
|
149
|
+
# Message was placed in the Slack channel
|
150
|
+
end
|
151
|
+
ws.on(:channel_left) do |data|
|
152
|
+
print "SOMEONE LEFT (@ #{Time.now}): #{data.inspect}\n"
|
153
|
+
end
|
154
|
+
#...
|
155
|
+
|
156
|
+
# Run the websocket as a client
|
157
|
+
ws.run
|
158
|
+
```
|
159
|
+
|
119
160
|
## CONTRIBUTING
|
120
161
|
|
121
162
|
1. Clone the repository `git clone https://github.com/brilliantfantastic/laziness`
|
data/laziness.gemspec
CHANGED
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_runtime_dependency('
|
23
|
+
spec.add_runtime_dependency('eventmachine')
|
24
|
+
spec.add_runtime_dependency('faye-websocket', '>= 0.8.0')
|
24
25
|
spec.add_runtime_dependency('hashie')
|
26
|
+
spec.add_runtime_dependency('httparty')
|
25
27
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Slack
|
2
|
+
module API
|
3
|
+
class RTM < Base
|
4
|
+
def start(simple_latest=false, no_unreads=false)
|
5
|
+
parameters = {}
|
6
|
+
parameters[:simple_latest] = simple_latest if simple_latest
|
7
|
+
parameters[:no_unreads] = no_unreads if no_unreads
|
8
|
+
response = request :get, 'rtm.start', parameters
|
9
|
+
Slack::Session.parse response
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/laziness/api.rb
CHANGED
data/lib/laziness/client.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
require "securerandom"
|
2
|
+
|
3
|
+
module Slack
|
4
|
+
class Message < Base
|
5
|
+
def initialize(attributes)
|
6
|
+
super
|
7
|
+
symbolize_type attributes[:type]
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def generate(attributes)
|
12
|
+
id = attributes.delete(:id) || generate_id
|
13
|
+
new({ id: id, type: :message }.merge attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def generate_id
|
17
|
+
SecureRandom.random_number(9999999).to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse(message)
|
21
|
+
request = Request.new message
|
22
|
+
base = Base.parse request
|
23
|
+
new base
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def symbolize_type(type)
|
30
|
+
self.type = type.to_sym if type
|
31
|
+
end
|
32
|
+
|
33
|
+
class Request
|
34
|
+
attr_reader :body
|
35
|
+
|
36
|
+
def initialize(body)
|
37
|
+
@body = body
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Slack
|
2
|
+
class Observer
|
3
|
+
attr_accessor :topic
|
4
|
+
attr_reader :observer, :func, :blk
|
5
|
+
|
6
|
+
def initialize(topic=nil, observer=nil, func=:update, &blk)
|
7
|
+
@topic = topic
|
8
|
+
@observer = observer
|
9
|
+
@func = func
|
10
|
+
@blk = blk
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute(*args)
|
14
|
+
blk.call(*args) if blk
|
15
|
+
observer.send func, *args if observer && observer.respond_to?(func)
|
16
|
+
end
|
17
|
+
|
18
|
+
def ==(other)
|
19
|
+
return false if other.nil?
|
20
|
+
self.topic == other.topic && self.blk == other.blk &&
|
21
|
+
self.observer == other.observer && self.func == other.func
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'eventmachine'
|
2
|
+
require 'faye/websocket'
|
3
|
+
|
4
|
+
module Slack
|
5
|
+
class RealTime
|
6
|
+
attr_reader :session
|
7
|
+
|
8
|
+
def initialize(session)
|
9
|
+
@session = session
|
10
|
+
@events = Registry.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def broadcast(channel, message, options={})
|
14
|
+
attributes = { channel: channel, text: message }.merge(options)
|
15
|
+
connection.send Message.generate(attributes).to_json
|
16
|
+
end
|
17
|
+
|
18
|
+
def run(queue=nil, options={})
|
19
|
+
EM.run do
|
20
|
+
connect(options)
|
21
|
+
|
22
|
+
connection.on(:open) { |event| EM.defer { @events.notify(:open, event) }}
|
23
|
+
connection.on(:message) { |event| send_message(event) }
|
24
|
+
connection.on(:close) do |event|
|
25
|
+
EM.defer { @events.notify(:close, event) }
|
26
|
+
shutdown
|
27
|
+
end
|
28
|
+
connection.on(:error) { |event| EM.defer { @events.notify(:error, event) }}
|
29
|
+
|
30
|
+
queue << connection if queue
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def on(event=nil, handler=nil, func=:update, &blk)
|
35
|
+
@events.register event, handler, func, &blk
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def off(event=nil, handler=nil, func=:update, &blk)
|
40
|
+
@events.unregister event, handler, func, &blk
|
41
|
+
end
|
42
|
+
|
43
|
+
def shutdown
|
44
|
+
connection.close if connection
|
45
|
+
EM.stop if EM.reactor_running?
|
46
|
+
@events.clear
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
attr_reader :connection
|
52
|
+
|
53
|
+
def connect(options={})
|
54
|
+
@connection ||=
|
55
|
+
Faye::WebSocket::Client.new(session.url, nil, default_options.merge(options))
|
56
|
+
end
|
57
|
+
|
58
|
+
def default_options
|
59
|
+
{ ping: 10 }
|
60
|
+
end
|
61
|
+
|
62
|
+
def send_message(event)
|
63
|
+
message = Message.parse event.data
|
64
|
+
EM.defer { @events.notify(message.type, message) }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Slack
|
2
|
+
class Registry
|
3
|
+
attr_reader :observers
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@observers = []
|
7
|
+
end
|
8
|
+
|
9
|
+
def clear
|
10
|
+
observers.clear
|
11
|
+
end
|
12
|
+
|
13
|
+
def notify(topic, *args)
|
14
|
+
observers.select { |o| o.topic == topic }.map { |o| o.execute(*args) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def register(topic=nil, observer=nil, func=:update, &blk)
|
18
|
+
observers << Observer.new(topic, observer, func, &blk)
|
19
|
+
end
|
20
|
+
|
21
|
+
def unregister(topic=nil, observer=nil, func=:update, &blk)
|
22
|
+
observers.delete Observer.new(topic, observer, func, &blk)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/laziness/version.rb
CHANGED
data/lib/laziness.rb
CHANGED
@@ -6,7 +6,12 @@ require 'laziness/channel'
|
|
6
6
|
require 'laziness/client'
|
7
7
|
require 'laziness/errors'
|
8
8
|
require 'laziness/group'
|
9
|
+
require 'laziness/message'
|
9
10
|
require 'laziness/oauth'
|
11
|
+
require 'laziness/observer'
|
12
|
+
require 'laziness/real_time'
|
13
|
+
require 'laziness/registry'
|
14
|
+
require 'laziness/session'
|
10
15
|
require 'laziness/user'
|
11
16
|
|
12
17
|
module Slack
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe Slack::API::RTM do
|
2
|
+
let(:access_token) { "12345" }
|
3
|
+
subject { Slack::API::RTM.new access_token }
|
4
|
+
|
5
|
+
describe '.start' do
|
6
|
+
it 'returns the rtm session' do
|
7
|
+
stub_slack_request :get, "rtm.start?token=#{access_token}", 'rtm_start.json'
|
8
|
+
session = subject.start
|
9
|
+
expect(session.url).to eq 'wss://example.com'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe Slack::Message do
|
2
|
+
describe "#parse" do
|
3
|
+
it "initializes a new message with a JSON string" do
|
4
|
+
message = Slack::Message.parse '{ "id": "1234", "type": "blah" }'
|
5
|
+
expect(message).to be_a Slack::Message
|
6
|
+
expect(message.id).to eq "1234"
|
7
|
+
expect(message.type).to eq :blah
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#generate" do
|
12
|
+
it "generates a new message with a random id and type" do
|
13
|
+
message = Slack::Message.generate text: "This is a test"
|
14
|
+
expect(message.id).to_not be_empty
|
15
|
+
expect(message.type).to eq :message
|
16
|
+
expect(message.text).to eq "This is a test"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "can have an id specified" do
|
20
|
+
expect(Slack::Message).to_not receive(:generate_id)
|
21
|
+
message = Slack::Message.generate id: 12345
|
22
|
+
expect(message.id).to eq 12345
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
describe Slack::Observer do
|
2
|
+
describe "#execute" do
|
3
|
+
it "calls the block" do
|
4
|
+
executed = false
|
5
|
+
observer = Slack::Observer.new do
|
6
|
+
executed = true
|
7
|
+
end.execute
|
8
|
+
expect(executed).to be_truthy
|
9
|
+
end
|
10
|
+
|
11
|
+
it "calls the method on the observer" do
|
12
|
+
@executed = false
|
13
|
+
def blah
|
14
|
+
@executed = true
|
15
|
+
end
|
16
|
+
observer = Slack::Observer.new nil, self, :blah
|
17
|
+
observer.execute
|
18
|
+
expect(@executed).to be_truthy
|
19
|
+
end
|
20
|
+
|
21
|
+
context "with arguments" do
|
22
|
+
it "calls the block" do
|
23
|
+
arguments = nil
|
24
|
+
observer = Slack::Observer.new do |argument1, argument2|
|
25
|
+
arguments = [argument1, argument2]
|
26
|
+
end.execute(:blah, :bleh)
|
27
|
+
expect(arguments).to eq [:blah, :bleh]
|
28
|
+
end
|
29
|
+
|
30
|
+
it "calls the method on the observer" do
|
31
|
+
@arguments = nil
|
32
|
+
def blah(argument)
|
33
|
+
@arguments = argument
|
34
|
+
end
|
35
|
+
observer = Slack::Observer.new nil, self, :blah
|
36
|
+
observer.execute :blah
|
37
|
+
expect(@arguments).to eq :blah
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#==" do
|
43
|
+
let(:blk) { -> { puts "blah" } }
|
44
|
+
let(:topic) { :topic }
|
45
|
+
|
46
|
+
it "is equal if the objects have the same topic and blocks" do
|
47
|
+
left = Slack::Observer.new topic, &blk
|
48
|
+
right = Slack::Observer.new topic, &blk
|
49
|
+
expect(left).to eq right
|
50
|
+
end
|
51
|
+
|
52
|
+
it "is equal if the objects have the same topic and observers" do
|
53
|
+
left = Slack::Observer.new topic, self
|
54
|
+
right = Slack::Observer.new topic, self
|
55
|
+
expect(left).to eq right
|
56
|
+
end
|
57
|
+
|
58
|
+
it "is not equal if the topics are different" do
|
59
|
+
left = Slack::Observer.new topic, &blk
|
60
|
+
right = Slack::Observer.new :blah, &blk
|
61
|
+
expect(left).to_not eq right
|
62
|
+
end
|
63
|
+
|
64
|
+
it "is not equal if the blocks are different" do
|
65
|
+
other_blk = -> { puts "blah" }
|
66
|
+
left = Slack::Observer.new topic, &blk
|
67
|
+
right = Slack::Observer.new topic, &other_blk
|
68
|
+
expect(left).to_not eq right
|
69
|
+
end
|
70
|
+
|
71
|
+
it "is not equal if the observer methods are different" do
|
72
|
+
left = Slack::Observer.new topic, self, :blah
|
73
|
+
right = Slack::Observer.new topic, self, :bleh
|
74
|
+
expect(left).to_not eq right
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
describe Slack::RealTime do
|
2
|
+
let(:session) { double(:session, url: "wss://example.com") }
|
3
|
+
let(:queue) { Queue.new }
|
4
|
+
subject { Slack::RealTime.new(session) }
|
5
|
+
|
6
|
+
def with_websocket(subject, queue)
|
7
|
+
thread = Thread.new { subject.run(queue, ping: nil) }
|
8
|
+
thread.abort_on_exception = true
|
9
|
+
yield queue.pop if block_given?
|
10
|
+
subject.shutdown
|
11
|
+
thread.join
|
12
|
+
end
|
13
|
+
|
14
|
+
it "accepts a session" do
|
15
|
+
session = double(:session)
|
16
|
+
expect(Slack::RealTime.new(session).session).to eq session
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#run" do
|
20
|
+
it "creates the websocket on the queue" do
|
21
|
+
with_websocket(subject, queue) do |ws|
|
22
|
+
expect(ws).to be_an_instance_of Faye::WebSocket::Client
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#on" do
|
28
|
+
it "registers an event handler" do
|
29
|
+
expect_any_instance_of(Slack::Registry).to \
|
30
|
+
receive(:register).with(:message, nil, :update).and_call_original
|
31
|
+
subject.on :message
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#off" do
|
36
|
+
it "unregisters an event" do
|
37
|
+
expect_any_instance_of(Slack::Registry).to \
|
38
|
+
receive(:unregister).with(:open, nil, :update).and_call_original
|
39
|
+
subject.off :open
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#broadcast" do
|
44
|
+
before do
|
45
|
+
allow(EM).to receive(:defer).and_yield
|
46
|
+
allow(SecureRandom).to receive(:random_number).and_return 123
|
47
|
+
end
|
48
|
+
|
49
|
+
it "sends a message to a channel" do
|
50
|
+
channel = "C12345"
|
51
|
+
payload = { id: "123", type: :message, channel: channel,
|
52
|
+
text: "Would you like to play a game?" }
|
53
|
+
json = JSON.generate payload
|
54
|
+
|
55
|
+
with_websocket(subject, queue) do |ws|
|
56
|
+
expect(ws).to receive(:send).with json
|
57
|
+
subject.broadcast channel, "Would you like to play a game?"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "#shutdown" do
|
63
|
+
it "stops the event loop" do
|
64
|
+
expect(EM).to receive(:stop).at_least(:once).and_call_original
|
65
|
+
with_websocket(subject, queue) do
|
66
|
+
subject.shutdown
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
describe Slack::Registry do
|
2
|
+
describe "#register" do
|
3
|
+
it "registers the handler with a block" do
|
4
|
+
expect { subject.register :topic do end }.to \
|
5
|
+
change { subject.observers.count }.by 1
|
6
|
+
end
|
7
|
+
|
8
|
+
it "registers the handler with an object and method" do
|
9
|
+
expect { subject.register :topic, self, :blah }.to \
|
10
|
+
change { subject.observers.count }.by 1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#unregister" do
|
15
|
+
it "unregisters the handler with the same block signature" do
|
16
|
+
blk = -> { }
|
17
|
+
subject.register blk
|
18
|
+
expect { subject.unregister blk }.to \
|
19
|
+
change { subject.observers.count }.by -1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#notify" do
|
24
|
+
it "calls the observers that match the topics" do
|
25
|
+
topic1_called = false
|
26
|
+
topic2_called = false
|
27
|
+
subject.register :topic1 do topic1_called = true end
|
28
|
+
subject.register :topic2 do topic2_called = true end
|
29
|
+
subject.notify :topic1
|
30
|
+
expect(topic1_called).to be_truthy
|
31
|
+
expect(topic2_called).to be_falsey
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: laziness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: eventmachine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faye-websocket
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.8.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.8.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: hashie
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
41
69
|
description: Laziness wraps the Slack API in a Ruby gem so Ruby programs can easily
|
42
70
|
communicate with the Slack API (http://api.slack.com).
|
43
71
|
email:
|
@@ -62,6 +90,7 @@ files:
|
|
62
90
|
- lib/laziness/api/channels.rb
|
63
91
|
- lib/laziness/api/groups.rb
|
64
92
|
- lib/laziness/api/oauth.rb
|
93
|
+
- lib/laziness/api/rtm.rb
|
65
94
|
- lib/laziness/api/users.rb
|
66
95
|
- lib/laziness/auth.rb
|
67
96
|
- lib/laziness/base.rb
|
@@ -69,16 +98,26 @@ files:
|
|
69
98
|
- lib/laziness/client.rb
|
70
99
|
- lib/laziness/errors.rb
|
71
100
|
- lib/laziness/group.rb
|
101
|
+
- lib/laziness/message.rb
|
72
102
|
- lib/laziness/oauth.rb
|
103
|
+
- lib/laziness/observer.rb
|
104
|
+
- lib/laziness/real_time.rb
|
105
|
+
- lib/laziness/registry.rb
|
106
|
+
- lib/laziness/session.rb
|
73
107
|
- lib/laziness/user.rb
|
74
108
|
- lib/laziness/version.rb
|
75
109
|
- spec/laziness/api/auth_spec.rb
|
76
110
|
- spec/laziness/api/channels_spec.rb
|
77
111
|
- spec/laziness/api/groups_spec.rb
|
78
112
|
- spec/laziness/api/oauth_spec.rb
|
113
|
+
- spec/laziness/api/rtm_spec.rb
|
79
114
|
- spec/laziness/api/users_spec.rb
|
80
115
|
- spec/laziness/client_spec.rb
|
81
116
|
- spec/laziness/errors_spec.rb
|
117
|
+
- spec/laziness/message_spec.rb
|
118
|
+
- spec/laziness/observer_spec.rb
|
119
|
+
- spec/laziness/real_time_spec.rb
|
120
|
+
- spec/laziness/registry_spec.rb
|
82
121
|
- spec/spec_helper.rb
|
83
122
|
- spec/support/fixtures/auth_test.json
|
84
123
|
- spec/support/fixtures/channels_info.json
|
@@ -86,6 +125,7 @@ files:
|
|
86
125
|
- spec/support/fixtures/groups_info.json
|
87
126
|
- spec/support/fixtures/groups_list.json
|
88
127
|
- spec/support/fixtures/oauth_access.json
|
128
|
+
- spec/support/fixtures/rtm_start.json
|
89
129
|
- spec/support/fixtures/successful_response.json
|
90
130
|
- spec/support/fixtures/users_info.json
|
91
131
|
- spec/support/fixtures/users_list.json
|
@@ -119,9 +159,14 @@ test_files:
|
|
119
159
|
- spec/laziness/api/channels_spec.rb
|
120
160
|
- spec/laziness/api/groups_spec.rb
|
121
161
|
- spec/laziness/api/oauth_spec.rb
|
162
|
+
- spec/laziness/api/rtm_spec.rb
|
122
163
|
- spec/laziness/api/users_spec.rb
|
123
164
|
- spec/laziness/client_spec.rb
|
124
165
|
- spec/laziness/errors_spec.rb
|
166
|
+
- spec/laziness/message_spec.rb
|
167
|
+
- spec/laziness/observer_spec.rb
|
168
|
+
- spec/laziness/real_time_spec.rb
|
169
|
+
- spec/laziness/registry_spec.rb
|
125
170
|
- spec/spec_helper.rb
|
126
171
|
- spec/support/fixtures/auth_test.json
|
127
172
|
- spec/support/fixtures/channels_info.json
|
@@ -129,6 +174,7 @@ test_files:
|
|
129
174
|
- spec/support/fixtures/groups_info.json
|
130
175
|
- spec/support/fixtures/groups_list.json
|
131
176
|
- spec/support/fixtures/oauth_access.json
|
177
|
+
- spec/support/fixtures/rtm_start.json
|
132
178
|
- spec/support/fixtures/successful_response.json
|
133
179
|
- spec/support/fixtures/users_info.json
|
134
180
|
- spec/support/fixtures/users_list.json
|