slack-ruby 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/slack/version.rb +1 -1
- data/slack.gemspec +2 -0
- data/spec/slack/rpc/client_spec.rb +29 -155
- data/spec/slack/rpc/response_spec.rb +30 -0
- data/spec/spec_helper.rb +1 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e2d2c794344e0225257317b6520e25ec5b3027d
|
4
|
+
data.tar.gz: 4d63a311f0f5d246f08e48f2ebe7de55fcc86ef3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 656caa9c0032003915f002e9c99db9628a4bd8bfb923206a28b473d717d9a82696395248a780da1c468f41bef7c9f15a4c917cbfa035f5ebe4cf72444d112590
|
7
|
+
data.tar.gz: d2738249859b0bb30dea6a4658e29bdab89bae01667bfe9eea8236b75657fe89a55e72f48bbf7bed8e14c481660a95f82726fa61a2d61fd4ce74c0cce2573321
|
data/lib/slack/version.rb
CHANGED
data/slack.gemspec
CHANGED
@@ -2,170 +2,44 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Slack::RPC::Client do
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
it "should have requested with Accept header" do
|
6
|
+
stub = stub_request(:get, "https://slack.com/api/api.test")
|
7
|
+
client = Slack::RPC::Client.new()
|
8
|
+
client.api.test()
|
9
|
+
expect(stub.
|
10
|
+
with(:headers => {"Accept" => "application/json"})).to have_been_made
|
7
11
|
end
|
8
12
|
|
9
|
-
it "should have
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
emoji
|
16
|
-
files
|
17
|
-
groups
|
18
|
-
im
|
19
|
-
oauth
|
20
|
-
rtm
|
21
|
-
search
|
22
|
-
stars
|
23
|
-
users
|
24
|
-
})
|
13
|
+
it "should have requested with User-Agent header" do
|
14
|
+
stub = stub_request(:get, "https://slack.com/api/api.test")
|
15
|
+
client = Slack::RPC::Client.new()
|
16
|
+
client.api.test()
|
17
|
+
expect(stub.
|
18
|
+
with(:headers => {"User-Agent" => "Slack Ruby Gem #{Slack::VERSION}"})).to have_been_made
|
25
19
|
end
|
26
20
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
21
|
+
it "should have requested with URL-encoded query parameter" do
|
22
|
+
stub = stub_request(:get, "https://slack.com/api/api.test?foo=this+is+test")
|
23
|
+
client = Slack::RPC::Client.new()
|
24
|
+
client.api.test(:foo => "this is test")
|
25
|
+
expect(stub).to have_been_made
|
150
26
|
end
|
151
27
|
|
152
|
-
|
153
|
-
it "should
|
154
|
-
|
155
|
-
|
156
|
-
|
28
|
+
context "with token" do
|
29
|
+
it "should have requested with token" do
|
30
|
+
stub = stub_request(:get, "https://slack.com/api/api.test?token=0123456789")
|
31
|
+
client = Slack::RPC::Client.new("0123456789")
|
32
|
+
client.api.test()
|
33
|
+
expect(stub).to have_been_made
|
157
34
|
end
|
158
35
|
end
|
159
36
|
|
160
|
-
|
161
|
-
it "should
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
setActive
|
167
|
-
setPresence
|
168
|
-
})
|
37
|
+
context "without token" do
|
38
|
+
it "should have requested without token" do
|
39
|
+
stub = stub_request(:get, "https://slack.com/api/api.test")
|
40
|
+
client = Slack::RPC::Client.new()
|
41
|
+
client.api.test()
|
42
|
+
expect(stub).to have_been_made
|
169
43
|
end
|
170
44
|
end
|
171
45
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Slack::RPC::Response do
|
4
|
+
|
5
|
+
before do
|
6
|
+
stub_request(:get, "https://slack.com/api/api.test").to_return(:body => '{"foo": "bar"}', :status => 200, :headers => {"baz" => "qux"})
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have 'status' as integer" do
|
10
|
+
client = Slack::RPC::Client.new()
|
11
|
+
response = client.api.test()
|
12
|
+
expect(response.status).to be_kind_of(Integer)
|
13
|
+
expect(response.status).to eq(200)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have 'headers' as Hash" do
|
17
|
+
client = Slack::RPC::Client.new()
|
18
|
+
response = client.api.test()
|
19
|
+
expect(response.headers).to be_kind_of(Hash)
|
20
|
+
expect(response.headers).to include("baz" => "qux")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have 'body' as Hash" do
|
24
|
+
client = Slack::RPC::Client.new()
|
25
|
+
response = client.api.test()
|
26
|
+
expect(response.body).to be_kind_of(Hash)
|
27
|
+
expect(response.body).to include("foo" => "bar")
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- morou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: A Ruby interface to Slack API
|
84
98
|
email:
|
85
99
|
- kazuhiro.nakae@gmail.com
|
@@ -101,6 +115,7 @@ files:
|
|
101
115
|
- lib/slack/version.rb
|
102
116
|
- slack.gemspec
|
103
117
|
- spec/slack/rpc/client_spec.rb
|
118
|
+
- spec/slack/rpc/response_spec.rb
|
104
119
|
- spec/spec_helper.rb
|
105
120
|
homepage: https://github.com/morou/slack-ruby-gem
|
106
121
|
licenses:
|
@@ -128,4 +143,5 @@ specification_version: 4
|
|
128
143
|
summary: A Ruby interface to Slack API
|
129
144
|
test_files:
|
130
145
|
- spec/slack/rpc/client_spec.rb
|
146
|
+
- spec/slack/rpc/response_spec.rb
|
131
147
|
- spec/spec_helper.rb
|