slack-web-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +6 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +13 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +33 -0
  10. data/Rakefile +13 -0
  11. data/examples/basic.rb +35 -0
  12. data/lib/faraday/raise_http_exception.rb +51 -0
  13. data/lib/slack.rb +27 -0
  14. data/lib/slack/api.rb +24 -0
  15. data/lib/slack/client.rb +4 -0
  16. data/lib/slack/configuration.rb +76 -0
  17. data/lib/slack/connection.rb +29 -0
  18. data/lib/slack/endpoint.rb +43 -0
  19. data/lib/slack/endpoint/api.rb +23 -0
  20. data/lib/slack/endpoint/auth.rb +19 -0
  21. data/lib/slack/endpoint/channels.rb +236 -0
  22. data/lib/slack/endpoint/chat.rb +86 -0
  23. data/lib/slack/endpoint/emoji.rb +19 -0
  24. data/lib/slack/endpoint/files.rb +100 -0
  25. data/lib/slack/endpoint/groups.rb +262 -0
  26. data/lib/slack/endpoint/im.rb +90 -0
  27. data/lib/slack/endpoint/mpim.rb +90 -0
  28. data/lib/slack/endpoint/oauth.rb +31 -0
  29. data/lib/slack/endpoint/pins.rb +64 -0
  30. data/lib/slack/endpoint/presence.rb +22 -0
  31. data/lib/slack/endpoint/reactions.rb +94 -0
  32. data/lib/slack/endpoint/search.rb +80 -0
  33. data/lib/slack/endpoint/stars.rb +65 -0
  34. data/lib/slack/endpoint/team.rb +57 -0
  35. data/lib/slack/endpoint/usergroups.rb +122 -0
  36. data/lib/slack/endpoint/users.rb +78 -0
  37. data/lib/slack/error.rb +19 -0
  38. data/lib/slack/request.rb +41 -0
  39. data/lib/slack/version.rb +3 -0
  40. data/slack.gemspec +38 -0
  41. data/spec/api_spec.rb +23 -0
  42. data/spec/auth_spec.rb +22 -0
  43. data/spec/channels_spec.rb +247 -0
  44. data/spec/spec_helper.rb +86 -0
  45. metadata +313 -0
@@ -0,0 +1,86 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ #SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
5
+ # SimpleCov::Formatter::HTMLFormatter,
6
+ # Coveralls::SimpleCov::Formatter
7
+ #]
8
+ #SimpleCov.start do
9
+ # add_filter '.bundle/'
10
+ #end
11
+
12
+ require 'slack'
13
+ require 'webmock/rspec'
14
+ require 'vcr'
15
+ WebMock.disable_net_connect!(allow_localhost: true)
16
+
17
+ # this helper is not good
18
+ module Helpers
19
+ def valid_token
20
+ $stderr.puts "Please set valid_token to ENV['TOKEN']" if ENV['TOKEN'].nil?
21
+ @token ||= ENV['TOKEN'] || (print "Token: "; gets.strip)
22
+ end
23
+
24
+ def valid_client
25
+ @valid_client ||= Slack::Client.new(token: valid_token)
26
+ end
27
+
28
+ def invalid_token
29
+ "dummy_token"
30
+ end
31
+
32
+ def invalid_client
33
+ @invalid_client ||= Slack::Client.new(token: invalid_token)
34
+ end
35
+
36
+ def test_user_id
37
+ @test_user_id ||= valid_client.auth_test["user_id"]
38
+ end
39
+
40
+ def test_user_name
41
+ @test_user_name ||= valid_client.auth_test["user"]
42
+ end
43
+
44
+ def another_user_name
45
+ @another_user_name ||= "aki017"
46
+ end
47
+
48
+
49
+ def another_user_id
50
+ @another_user_id ||= "U0399SL90" #valid_client.
51
+ end
52
+
53
+ def test_channel_name
54
+ @ntest_channel_name ||= "gem_testroom"
55
+ end
56
+
57
+ def test_channel_id
58
+ @test_channel_id ||= "C04NL1FKT"
59
+ end
60
+
61
+ def another_channel_name
62
+ @another_channel_name ||= "gem_testroom2"
63
+ end
64
+
65
+ def valid_response
66
+ include({ "ok" => true })
67
+ end
68
+ end
69
+
70
+ include Helpers
71
+ RSpec.configure do |config|
72
+ config.run_all_when_everything_filtered = true
73
+ config.treat_symbols_as_metadata_keys_with_true_values = true
74
+
75
+ config.order = 'random'
76
+ config.include Helpers
77
+ end
78
+
79
+ VCR.configure do |c|
80
+ c.cassette_library_dir = 'spec/vcr'
81
+ c.hook_into :webmock
82
+ c.allow_http_connections_when_no_cassette = true
83
+ c.default_cassette_options = { :record => :new_episodes }
84
+ c.configure_rspec_metadata!
85
+ c.filter_sensitive_data("<TOKEN>") { valid_token }
86
+ end
metadata ADDED
@@ -0,0 +1,313 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slack-web-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - keydunov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: simplecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: vcr
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'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: erubis
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 2.7.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 2.7.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: json-schema
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: pry
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: faraday
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0.7'
188
+ - - "<"
189
+ - !ruby/object:Gem::Version
190
+ version: '0.10'
191
+ type: :runtime
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0.7'
198
+ - - "<"
199
+ - !ruby/object:Gem::Version
200
+ version: '0.10'
201
+ - !ruby/object:Gem::Dependency
202
+ name: faraday_middleware
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '0.8'
208
+ type: :runtime
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '0.8'
215
+ - !ruby/object:Gem::Dependency
216
+ name: multi_json
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: 1.0.3
222
+ - - "~>"
223
+ - !ruby/object:Gem::Version
224
+ version: '1.0'
225
+ type: :runtime
226
+ prerelease: false
227
+ version_requirements: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: 1.0.3
232
+ - - "~>"
233
+ - !ruby/object:Gem::Version
234
+ version: '1.0'
235
+ description: A Ruby wrapper for the Slack Web API
236
+ email:
237
+ - artyom.keydunov@gmail.com
238
+ executables: []
239
+ extensions: []
240
+ extra_rdoc_files: []
241
+ files:
242
+ - ".gitignore"
243
+ - ".gitmodules"
244
+ - ".rspec"
245
+ - ".travis.yml"
246
+ - Gemfile
247
+ - Guardfile
248
+ - LICENSE.txt
249
+ - README.md
250
+ - Rakefile
251
+ - examples/basic.rb
252
+ - lib/faraday/raise_http_exception.rb
253
+ - lib/slack.rb
254
+ - lib/slack/api.rb
255
+ - lib/slack/client.rb
256
+ - lib/slack/configuration.rb
257
+ - lib/slack/connection.rb
258
+ - lib/slack/endpoint.rb
259
+ - lib/slack/endpoint/api.rb
260
+ - lib/slack/endpoint/auth.rb
261
+ - lib/slack/endpoint/channels.rb
262
+ - lib/slack/endpoint/chat.rb
263
+ - lib/slack/endpoint/emoji.rb
264
+ - lib/slack/endpoint/files.rb
265
+ - lib/slack/endpoint/groups.rb
266
+ - lib/slack/endpoint/im.rb
267
+ - lib/slack/endpoint/mpim.rb
268
+ - lib/slack/endpoint/oauth.rb
269
+ - lib/slack/endpoint/pins.rb
270
+ - lib/slack/endpoint/presence.rb
271
+ - lib/slack/endpoint/reactions.rb
272
+ - lib/slack/endpoint/search.rb
273
+ - lib/slack/endpoint/stars.rb
274
+ - lib/slack/endpoint/team.rb
275
+ - lib/slack/endpoint/usergroups.rb
276
+ - lib/slack/endpoint/users.rb
277
+ - lib/slack/error.rb
278
+ - lib/slack/request.rb
279
+ - lib/slack/version.rb
280
+ - slack.gemspec
281
+ - spec/api_spec.rb
282
+ - spec/auth_spec.rb
283
+ - spec/channels_spec.rb
284
+ - spec/spec_helper.rb
285
+ homepage: https://github.com/keydunov/slack-web-api
286
+ licenses:
287
+ - MIT
288
+ metadata: {}
289
+ post_install_message:
290
+ rdoc_options: []
291
+ require_paths:
292
+ - lib
293
+ required_ruby_version: !ruby/object:Gem::Requirement
294
+ requirements:
295
+ - - ">="
296
+ - !ruby/object:Gem::Version
297
+ version: '0'
298
+ required_rubygems_version: !ruby/object:Gem::Requirement
299
+ requirements:
300
+ - - ">="
301
+ - !ruby/object:Gem::Version
302
+ version: '0'
303
+ requirements: []
304
+ rubyforge_project:
305
+ rubygems_version: 2.4.5
306
+ signing_key:
307
+ specification_version: 4
308
+ summary: A Ruby wrapper for the Slack Web API
309
+ test_files:
310
+ - spec/api_spec.rb
311
+ - spec/auth_spec.rb
312
+ - spec/channels_spec.rb
313
+ - spec/spec_helper.rb