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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e60b4a069475e70084d527b4fc639722098feb45
4
- data.tar.gz: 6fe152cba9112ec1820626e590d107434582987b
3
+ metadata.gz: 4fe74aeac6c265b2b03f4092ec7280e51c19bc8b
4
+ data.tar.gz: d9b5079db15eb44c269efbafa24ccab7643930f3
5
5
  SHA512:
6
- metadata.gz: 264d032c486c84e5801498a4f8cc823ec3f996c458bf64f74ade690ce01b1c264d48abe6d030140e6de49e7ddef586e4d312806cc587dc976a6b5fb79fa314ea
7
- data.tar.gz: f32e56131297c3c19acaf3af5ec00b187e7833924f637c514baffe919601c1d01ec7ca280e2c0647b30dc53ba70523aabbb347add98f20209465af7829f7ac80
6
+ metadata.gz: a495de49a92ecd746948894877a2b607eab7563ade275d42937e9e01d37a9b35d7e2283553f5531078135aa2d7f30e8a32b1c702158fc3c04d047c31a66d7e97
7
+ data.tar.gz: 2c74ba124217f00143318e31cdbe9bd2e18302827b0c43bbe6b806fbd3a569190a13c417833a365bab118626d91e8796b6e618f958f4dde25e1a93dbb990eb8d
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format=documentation
@@ -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})
@@ -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
- faraday_response = connection.get("#{command}.#{sub_command}", params.clone.merge({:token => @token}))
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
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/slack.gemspec CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.1"
26
27
  end
@@ -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
@@ -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: 0.1.0
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