rocketchat 0.1.15 → 0.1.16
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/.gitignore +1 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +16 -3
- data/README.md +9 -7
- data/lib/rocket_chat/gem_version.rb +1 -1
- data/lib/rocket_chat/messages/channel.rb +16 -0
- data/lib/rocket_chat/request_helper.rb +2 -0
- data/lib/rocket_chat/user.rb +5 -0
- data/lib/rocket_chat/util.rb +2 -3
- data/rocketchat.gemspec +4 -2
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7b2e20c323221a0e410ea186e2466ccbd3bf872
|
4
|
+
data.tar.gz: eada6fbe56c8ebd89e5a4960920049173ff942c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a72512542f1684211a8b4b8fb392e89a4b2e5b7f3fa2cc81b168940432a5dc894b1d7165a2a606a3ebca77e89788ed8a35456048d2677015151cc325f918491
|
7
|
+
data.tar.gz: 65b113408b366c5f31e14bd4a04a9eeded34cbb6dcf4d31568f054b56eb7e383f7140e8f4df31974c5733ffb87ba67f0a0a73f2d5a8384944119ea648e408e8e
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
1
3
|
Metrics/BlockLength:
|
2
4
|
Exclude:
|
3
5
|
- "**/*_spec.rb"
|
@@ -14,3 +16,9 @@ Metrics/MethodLength:
|
|
14
16
|
Style/NumericLiterals:
|
15
17
|
Exclude:
|
16
18
|
- "**/*_spec.rb"
|
19
|
+
|
20
|
+
RSpec/ExampleLength:
|
21
|
+
Max: 10
|
22
|
+
|
23
|
+
RSpec/MultipleExpectations:
|
24
|
+
Max: 5
|
data/.travis.yml
CHANGED
@@ -1,18 +1,31 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=abf0a371ff8851f13b563671914b195bb46f0997f0f93142e666d9acad08e22f
|
4
|
+
|
1
5
|
language: ruby
|
6
|
+
|
2
7
|
rvm:
|
3
|
-
- 2.0
|
4
8
|
- 2.1
|
5
9
|
- 2.2
|
6
10
|
- 2.3
|
7
11
|
- 2.4
|
12
|
+
- 2.5
|
8
13
|
|
9
14
|
before_install:
|
10
15
|
- gem update bundler
|
11
16
|
|
12
17
|
install:
|
13
18
|
- bundle install --jobs=3 --retry=3
|
14
|
-
- gem install rubocop
|
19
|
+
- if [[ ! `ruby --version` =~ ^ruby\ 2\.1 ]]; then gem install rubocop; fi
|
20
|
+
|
21
|
+
before_script:
|
22
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
23
|
+
- chmod +x ./cc-test-reporter
|
24
|
+
- ./cc-test-reporter before-build
|
15
25
|
|
16
26
|
script:
|
17
|
-
- rubocop
|
27
|
+
- if [[ ! `ruby --version` =~ ^ruby\ 2\.1 ]]; then rubocop; fi
|
18
28
|
- bundle exec rake
|
29
|
+
|
30
|
+
after_script:
|
31
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://travis-ci.org/abrom/rocketchat-ruby)
|
2
|
-
[](https://codeclimate.com/github/abrom/rocketchat-ruby/maintainability)
|
3
|
+
[](https://codeclimate.com/github/abrom/rocketchat-ruby/test_coverage)
|
3
4
|
[](#)
|
4
5
|
|
5
6
|
# Rocket.Chat REST API for Ruby
|
@@ -31,15 +32,15 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
|
|
31
32
|
* [/api/v1/info](#info)
|
32
33
|
|
33
34
|
#### Authentication
|
34
|
-
* [/api/v1/login](#
|
35
|
-
* [/api/v1/logout](#
|
35
|
+
* [/api/v1/login](docs/authentication.md#login)
|
36
|
+
* [/api/v1/logout](docs/authentication.md#logout)
|
36
37
|
* /api/v1/me
|
37
38
|
|
38
39
|
#### Chat
|
39
|
-
* /api/v1/chat.delete
|
40
|
-
* /api/v1/chat.getMessage
|
41
|
-
* /api/v1/chat.postMessage
|
42
|
-
* /api/v1/chat.update
|
40
|
+
* [/api/v1/chat.delete](docs/chat.md#delete)
|
41
|
+
* [/api/v1/chat.getMessage](docs/chat.md#getmessage)
|
42
|
+
* [/api/v1/chat.postMessage](docs/chat.md#postmessage)
|
43
|
+
* [/api/v1/chat.update](docs/chat.md#update)
|
43
44
|
|
44
45
|
#### Channels
|
45
46
|
* /api/v1/channels.archive
|
@@ -62,6 +63,7 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
|
|
62
63
|
* [/api/v1/channels.setReadOnly](docs/channels.md#channelsset_attr)
|
63
64
|
* [/api/v1/channels.setTopic](docs/channels.md#channelsset_attr)
|
64
65
|
* [/api/v1/channels.setType](docs/channels.md#channelsset_attr)
|
66
|
+
* [/api/v1/channels.online](docs/channels.md#channelsonline)
|
65
67
|
* /api/v1/channels.unarchive
|
66
68
|
|
67
69
|
#### Groups
|
@@ -5,6 +5,7 @@ module RocketChat
|
|
5
5
|
#
|
6
6
|
class Channel < Room
|
7
7
|
include ListSupport
|
8
|
+
include UserSupport
|
8
9
|
|
9
10
|
#
|
10
11
|
# channels.join REST API
|
@@ -40,6 +41,21 @@ module RocketChat
|
|
40
41
|
response['channels'].map { |hash| RocketChat::Room.new hash } if response['success']
|
41
42
|
end
|
42
43
|
|
44
|
+
#
|
45
|
+
# channels.online REST API
|
46
|
+
# @param [String] room_id Rocket.Chat room id
|
47
|
+
# @return [Users[]]
|
48
|
+
# @raise [HTTPError, StatusError]
|
49
|
+
#
|
50
|
+
def online(room_id: nil, name: nil)
|
51
|
+
response = session.request_json(
|
52
|
+
'/api/v1/channels.online',
|
53
|
+
body: room_params(room_id, name)
|
54
|
+
)
|
55
|
+
|
56
|
+
response['online'].map { |hash| RocketChat::User.new hash } if response['success']
|
57
|
+
end
|
58
|
+
|
43
59
|
# Keys for set_attr:
|
44
60
|
# * [String] description A room's description
|
45
61
|
# * [String] join_code Code to join a channel
|
@@ -56,6 +56,7 @@ module RocketChat
|
|
56
56
|
|
57
57
|
def check_response(response, fail_unless_ok)
|
58
58
|
return if response.is_a?(Net::HTTPOK) || !(fail_unless_ok || response.is_a?(Net::HTTPServerError))
|
59
|
+
|
59
60
|
raise RocketChat::HTTPError, "Invalid http response code: #{response.code}"
|
60
61
|
end
|
61
62
|
|
@@ -81,6 +82,7 @@ module RocketChat
|
|
81
82
|
end
|
82
83
|
|
83
84
|
return unless headers
|
85
|
+
|
84
86
|
headers = Util.stringify_hash_keys headers
|
85
87
|
headers.delete_if { |key, value| key.nil? || value.nil? }
|
86
88
|
end
|
data/lib/rocket_chat/user.rb
CHANGED
data/lib/rocket_chat/util.rb
CHANGED
@@ -3,6 +3,8 @@ module RocketChat
|
|
3
3
|
# Rocket.Chat generic utility functions
|
4
4
|
#
|
5
5
|
module Util
|
6
|
+
module_function
|
7
|
+
|
6
8
|
#
|
7
9
|
# Stringify symbolized hash keys
|
8
10
|
# @param [Hash] hash A string/symbol keyed hash
|
@@ -20,7 +22,6 @@ module RocketChat
|
|
20
22
|
end
|
21
23
|
new_hash
|
22
24
|
end
|
23
|
-
module_function :stringify_hash_keys
|
24
25
|
|
25
26
|
#
|
26
27
|
# Slice keys from hash
|
@@ -37,7 +38,6 @@ module RocketChat
|
|
37
38
|
end
|
38
39
|
new_hash
|
39
40
|
end
|
40
|
-
module_function :slice_hash
|
41
41
|
|
42
42
|
#
|
43
43
|
# Camelize a string or symbol
|
@@ -47,6 +47,5 @@ module RocketChat
|
|
47
47
|
def camelize(string)
|
48
48
|
string.to_s.gsub(/_([a-z])/) { Regexp.last_match(1).upcase }
|
49
49
|
end
|
50
|
-
module_function :camelize
|
51
50
|
end
|
52
51
|
end
|
data/rocketchat.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path('
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
require 'rocket_chat/gem_version'
|
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
22
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
24
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 0.57'
|
25
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.27'
|
26
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
25
27
|
spec.add_development_dependency 'webmock', '~> 2.3'
|
26
28
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
27
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketchat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- int512
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,14 +59,42 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
62
|
+
version: '0.57'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0.
|
69
|
+
version: '0.57'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop-rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.27'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.27'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: simplecov
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.16'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0.16'
|
70
98
|
- !ruby/object:Gem::Dependency
|
71
99
|
name: webmock
|
72
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
183
|
version: '0'
|
156
184
|
requirements: []
|
157
185
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.6.
|
186
|
+
rubygems_version: 2.6.14.1
|
159
187
|
signing_key:
|
160
188
|
specification_version: 4
|
161
189
|
summary: Rocket.Chat REST API v1 for Ruby
|