slack-ruby 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/lib/slack/rpc/client.rb +1 -1
- data/lib/slack/rpc/connection.rb +3 -2
- data/lib/slack/version.rb +1 -1
- data/slack.gemspec +1 -0
- data/spec/slack/rpc/client_spec.rb +172 -0
- data/spec/spec_helper.rb +1 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe74aeac6c265b2b03f4092ec7280e51c19bc8b
|
4
|
+
data.tar.gz: d9b5079db15eb44c269efbafa24ccab7643930f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a495de49a92ecd746948894877a2b607eab7563ade275d42937e9e01d37a9b35d7e2283553f5531078135aa2d7f30e8a32b1c702158fc3c04d047c31a66d7e97
|
7
|
+
data.tar.gz: 2c74ba124217f00143318e31cdbe9bd2e18302827b0c43bbe6b806fbd3a569190a13c417833a365bab118626d91e8796b6e618f958f4dde25e1a93dbb990eb8d
|
data/.rspec
ADDED
data/lib/slack/rpc/client.rb
CHANGED
@@ -12,7 +12,7 @@ module Slack
|
|
12
12
|
# ### Slack::RPC::Client.new(token)
|
13
13
|
# Creates a new instance of `Slack::RPC::Client` class
|
14
14
|
#
|
15
|
-
def initialize(token)
|
15
|
+
def initialize(token = nil)
|
16
16
|
conn = Connection.new(token)
|
17
17
|
define_command(conn, "api", %w{test})
|
18
18
|
define_command(conn, "auth", %w{test})
|
data/lib/slack/rpc/connection.rb
CHANGED
@@ -26,7 +26,7 @@ module Slack
|
|
26
26
|
# ### Slack::RPC::Connection.new(token)
|
27
27
|
# Creates a new instance of `Slack::RPC::Connection` class
|
28
28
|
#
|
29
|
-
def initialize(token)
|
29
|
+
def initialize(token = nil)
|
30
30
|
@token = token
|
31
31
|
end
|
32
32
|
|
@@ -34,7 +34,8 @@ module Slack
|
|
34
34
|
# Call Slack RPC-Style command
|
35
35
|
#
|
36
36
|
def call(command, sub_command, params, &block)
|
37
|
-
|
37
|
+
params = params.clone.merge({:token => @token}) if @token
|
38
|
+
faraday_response = connection.get("#{command}.#{sub_command}", params)
|
38
39
|
response = Response.new(faraday_response)
|
39
40
|
if block then
|
40
41
|
yield response
|
data/lib/slack/version.rb
CHANGED
data/slack.gemspec
CHANGED
@@ -0,0 +1,172 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Slack::RPC::Client do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = Slack::RPC::Client.new("")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have each command objects" do
|
10
|
+
expect(@client).to respond_to(*%w{
|
11
|
+
api
|
12
|
+
auth
|
13
|
+
channels
|
14
|
+
chat
|
15
|
+
emoji
|
16
|
+
files
|
17
|
+
groups
|
18
|
+
im
|
19
|
+
oauth
|
20
|
+
rtm
|
21
|
+
search
|
22
|
+
stars
|
23
|
+
users
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "api" do
|
28
|
+
it "should respond to sub-commands" do
|
29
|
+
expect(@client.api).to respond_to(*%w{
|
30
|
+
test
|
31
|
+
})
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "auth" do
|
36
|
+
it "should respond to sub-commands" do
|
37
|
+
expect(@client.auth).to respond_to(*%w{
|
38
|
+
test
|
39
|
+
})
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "channels" do
|
44
|
+
it "should respond to sub-commands" do
|
45
|
+
expect(@client.channels).to respond_to(*%w{
|
46
|
+
archive
|
47
|
+
create
|
48
|
+
history
|
49
|
+
info
|
50
|
+
invite
|
51
|
+
join
|
52
|
+
kick
|
53
|
+
leave
|
54
|
+
list
|
55
|
+
mark
|
56
|
+
rename
|
57
|
+
setPurpose
|
58
|
+
setTopic
|
59
|
+
unarchive
|
60
|
+
})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "chat" do
|
65
|
+
it "should respond to sub-commands" do
|
66
|
+
expect(@client.chat).to respond_to(*%w{
|
67
|
+
delete
|
68
|
+
postMessage
|
69
|
+
update
|
70
|
+
})
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "emoji" do
|
75
|
+
it "should respond to sub-commands" do
|
76
|
+
expect(@client.emoji).to respond_to(*%w{
|
77
|
+
list
|
78
|
+
})
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "files" do
|
83
|
+
it "should respond to sub-commands" do
|
84
|
+
expect(@client.files).to respond_to(*%w{
|
85
|
+
info
|
86
|
+
list
|
87
|
+
upload
|
88
|
+
})
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "groups" do
|
93
|
+
it "should respond to sub-commands" do
|
94
|
+
expect(@client.groups).to respond_to(*%w{
|
95
|
+
archive
|
96
|
+
close
|
97
|
+
create
|
98
|
+
createChild
|
99
|
+
history
|
100
|
+
invite
|
101
|
+
kick
|
102
|
+
leave
|
103
|
+
list
|
104
|
+
mark
|
105
|
+
open
|
106
|
+
rename
|
107
|
+
setPurpose
|
108
|
+
setTopic
|
109
|
+
unarchive
|
110
|
+
})
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "im" do
|
115
|
+
it "should respond to sub-commands" do
|
116
|
+
expect(@client.im).to respond_to(*%w{
|
117
|
+
close
|
118
|
+
history
|
119
|
+
list
|
120
|
+
mark
|
121
|
+
open
|
122
|
+
})
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "oauth" do
|
127
|
+
it "should respond to sub-commands" do
|
128
|
+
expect(@client.oauth).to respond_to(*%w{
|
129
|
+
access
|
130
|
+
})
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
describe "rtm" do
|
135
|
+
it "should respond to sub-commands" do
|
136
|
+
expect(@client.rtm).to respond_to(*%w{
|
137
|
+
start
|
138
|
+
})
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "search" do
|
143
|
+
it "should respond to sub-commands" do
|
144
|
+
expect(@client.search).to respond_to(*%w{
|
145
|
+
all
|
146
|
+
files
|
147
|
+
messages
|
148
|
+
})
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "stars" do
|
153
|
+
it "should respond to sub-commands" do
|
154
|
+
expect(@client.stars).to respond_to(*%w{
|
155
|
+
list
|
156
|
+
})
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe "users" do
|
161
|
+
it "should respond to sub-commands" do
|
162
|
+
expect(@client.users).to respond_to(*%w{
|
163
|
+
getPresence
|
164
|
+
info
|
165
|
+
list
|
166
|
+
setActive
|
167
|
+
setPresence
|
168
|
+
})
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "slack"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- morou
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
69
83
|
description: A Ruby interface to Slack API
|
70
84
|
email:
|
71
85
|
- kazuhiro.nakae@gmail.com
|
@@ -74,6 +88,7 @@ extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
90
|
- ".gitignore"
|
91
|
+
- ".rspec"
|
77
92
|
- Gemfile
|
78
93
|
- LICENSE.txt
|
79
94
|
- README.md
|
@@ -85,6 +100,8 @@ files:
|
|
85
100
|
- lib/slack/rpc/response.rb
|
86
101
|
- lib/slack/version.rb
|
87
102
|
- slack.gemspec
|
103
|
+
- spec/slack/rpc/client_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
88
105
|
homepage: https://github.com/morou/slack-ruby-gem
|
89
106
|
licenses:
|
90
107
|
- MIT
|
@@ -109,4 +126,6 @@ rubygems_version: 2.2.2
|
|
109
126
|
signing_key:
|
110
127
|
specification_version: 4
|
111
128
|
summary: A Ruby interface to Slack API
|
112
|
-
test_files:
|
129
|
+
test_files:
|
130
|
+
- spec/slack/rpc/client_spec.rb
|
131
|
+
- spec/spec_helper.rb
|