rocketchat 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +57 -8
- data/.travis.yml +3 -4
- data/CHANGELOG.md +30 -14
- data/README.md +2 -0
- data/lib/rocket_chat/error.rb +4 -0
- data/lib/rocket_chat/gem_version.rb +1 -1
- data/lib/rocket_chat/im_summary.rb +1 -1
- data/lib/rocket_chat/messages/room.rb +22 -1
- data/lib/rocket_chat/messages/user.rb +2 -2
- data/lib/rocket_chat/request_helper.rb +1 -1
- data/rocketchat.gemspec +6 -3
- metadata +44 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5f446da6cb7e901ef27edc15d4294fdb1db3a7c6386c35aeec2acbf513a2246
|
4
|
+
data.tar.gz: 19bda5415f803dd4a7cf7bc05ec2ec1fcf925d364e55068f0d7630d28e5da190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9c94588357cbeb32f18afe79b3439bded7fc8191b31627a440288642842d971119591cdf47e981836c7ea8b3d4ff76ed36040701b6c0fb24d33e9e7a349ef1a
|
7
|
+
data.tar.gz: b14f92c34a2b9a6f17d4da573b793268b3c8f83590326b5faca1e1d6b0b4ebba5bbdea73c1ea5bcc406aa5a729988ac6eb230359f1fbbb8de23b2694b60bc652
|
data/.rubocop.yml
CHANGED
@@ -1,24 +1,73 @@
|
|
1
|
-
require:
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-rspec
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
NewCops: enable
|
8
|
+
TargetRubyVersion: 2.5
|
9
|
+
|
10
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 120
|
15
|
+
|
16
|
+
Layout/SpaceAroundMethodCallOperator:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
Lint/DeprecatedOpenSSLConstant:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
Lint/MixedRegexpCaptureTypes:
|
23
|
+
Enabled: true
|
24
|
+
|
25
|
+
Lint/RaiseException:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Lint/StructNewOverride:
|
29
|
+
Enabled: true
|
2
30
|
|
3
31
|
Metrics/BlockLength:
|
4
32
|
Exclude:
|
5
33
|
- "**/*_spec.rb"
|
6
34
|
- "spec/shared/*.rb"
|
7
35
|
|
8
|
-
Metrics/LineLength:
|
9
|
-
Max: 120
|
10
|
-
|
11
36
|
Metrics/MethodLength:
|
12
37
|
Max: 15
|
13
38
|
Exclude:
|
14
39
|
- "**/*_spec.rb"
|
15
40
|
|
16
|
-
Style/NumericLiterals:
|
17
|
-
Exclude:
|
18
|
-
- "**/*_spec.rb"
|
19
|
-
|
20
41
|
RSpec/ExampleLength:
|
21
42
|
Max: 10
|
22
43
|
|
23
44
|
RSpec/MultipleExpectations:
|
24
45
|
Max: 5
|
46
|
+
|
47
|
+
RSpec/MultipleMemoizedHelpers:
|
48
|
+
Max: 15
|
49
|
+
|
50
|
+
Style/ExponentialNotation:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Style/HashEachMethods:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
Style/HashTransformKeys:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Style/HashTransformValues:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
Style/NumericLiterals:
|
63
|
+
Exclude:
|
64
|
+
- "**/*_spec.rb"
|
65
|
+
|
66
|
+
Style/RedundantRegexpCharacterClass:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Style/RedundantRegexpEscape:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/SlicingWithRange:
|
73
|
+
Enabled: true
|
data/.travis.yml
CHANGED
@@ -5,11 +5,10 @@ env:
|
|
5
5
|
language: ruby
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.2
|
9
|
-
- 2.3
|
10
|
-
- 2.4
|
11
8
|
- 2.5
|
12
9
|
- 2.6
|
10
|
+
- 2.7
|
11
|
+
- 3.0
|
13
12
|
|
14
13
|
before_install:
|
15
14
|
- gem update bundler
|
@@ -24,7 +23,7 @@ before_script:
|
|
24
23
|
- ./cc-test-reporter before-build
|
25
24
|
|
26
25
|
script:
|
27
|
-
- rubocop
|
26
|
+
- bundle exec rubocop
|
28
27
|
- bundle exec rake
|
29
28
|
|
30
29
|
after_script:
|
data/CHANGELOG.md
CHANGED
@@ -3,9 +3,16 @@
|
|
3
3
|
## Unreleased
|
4
4
|
- None
|
5
5
|
|
6
|
+
## [0.1.20](releases/tag/v0.1.20) - 2021-03-29
|
7
|
+
### Added
|
8
|
+
- [#34] Support for channels.members and groups.members ([@alinavancea][])
|
9
|
+
|
10
|
+
### Deprecation
|
11
|
+
- [#35] Drop Ruby 2.3 and 2.4 support ([@abrom][])
|
12
|
+
|
6
13
|
## [0.1.19](releases/tag/v0.1.19) - 2019-03-01
|
7
14
|
### Fixed
|
8
|
-
- Address CVE-2020-8130 - `rake` OS command injection vulnerability
|
15
|
+
- Address CVE-2020-8130 - `rake` OS command injection vulnerability ([@abrom][])
|
9
16
|
|
10
17
|
## [0.1.18](releases/tag/v0.1.18) - 2018-01-05
|
11
18
|
### Added
|
@@ -13,19 +20,19 @@
|
|
13
20
|
|
14
21
|
## [0.1.17](releases/tag/v0.1.17) - 2019-01-05
|
15
22
|
### Deprecation
|
16
|
-
- Drop Ruby 2.1 from build matrix
|
23
|
+
- Drop Ruby 2.1 from build matrix ([@abrom][])
|
17
24
|
|
18
25
|
## [0.1.16](releases/tag/v0.1.16) - 2018-10-3
|
19
26
|
### Deprecation
|
20
|
-
- Drop Ruby 2.0 from build matrix
|
27
|
+
- Drop Ruby 2.0 from build matrix ([@abrom][])
|
21
28
|
|
22
29
|
### Added
|
23
30
|
- [#27] Support for channels.online ([@chrisstime][])
|
24
|
-
- `rubocop-rspec` dependency and fixed new lints
|
31
|
+
- [#28] `rubocop-rspec` dependency and fixed new lints ([@abrom][])
|
25
32
|
|
26
33
|
## [0.1.15](releases/tag/v0.1.15) - 2017-12-21
|
27
34
|
### Fixed
|
28
|
-
- Updated yard to resolve potential security vulnerability
|
35
|
+
- Updated yard to resolve potential security vulnerability ([@abrom][])
|
29
36
|
|
30
37
|
## [0.1.14](releases/tag/v0.1.14) - 2017-10-9
|
31
38
|
### Added
|
@@ -33,16 +40,16 @@
|
|
33
40
|
|
34
41
|
## [0.1.13](releases/tag/v0.1.13) - 2017-10-9
|
35
42
|
### Added
|
36
|
-
- Support for channel/group addAll endpoint
|
43
|
+
- Support for channel/group addAll endpoint ([@abrom][])
|
37
44
|
|
38
45
|
## [0.1.12](releases/tag/v0.1.12) - 2017-08-28
|
39
46
|
### Fixed
|
40
|
-
- GET request parameter encoding
|
47
|
+
- GET request parameter encoding ([@abrom][])
|
41
48
|
|
42
49
|
## [0.1.11](releases/tag/v0.1.11) - 2017-08-22
|
43
50
|
### Fixed
|
44
51
|
- [#15] Response parser improvements ([@reist][],[@danischreiber][])
|
45
|
-
- [#17] Fixed a missing dependency issue with `net/http`
|
52
|
+
- [#17] Fixed a missing dependency issue with `net/http` ([@abrom][])
|
46
53
|
|
47
54
|
### Added
|
48
55
|
- [#14] Add/remove moderator from room ([@danischreiber][])
|
@@ -53,11 +60,11 @@
|
|
53
60
|
|
54
61
|
## [0.1.9](releases/tag/v0.1.9) - 2017-07-16
|
55
62
|
### Fixed
|
56
|
-
- Update chat message handlers to support Ruby 2.0
|
63
|
+
- Update chat message handlers to support Ruby 2.0 ([@abrom][])
|
57
64
|
|
58
65
|
## [0.1.8](releases/tag/v0.1.8) - 2017-07-16
|
59
66
|
### Added
|
60
|
-
- Messages chat API support
|
67
|
+
- Messages chat API support ([@abrom][])
|
61
68
|
|
62
69
|
## [0.1.7](releases/tag/v0.1.7) - 2017-07-16
|
63
70
|
### Added
|
@@ -74,7 +81,7 @@
|
|
74
81
|
|
75
82
|
## [0.1.4](releases/tag/v0.1.4) - 2017-07-9
|
76
83
|
### Fixed
|
77
|
-
- Fixed a missing dependency issue with `uri`
|
84
|
+
- Fixed a missing dependency issue with `uri` ([@abrom][])
|
78
85
|
|
79
86
|
## [0.1.2](releases/tag/v0.1.2) - 2017-05-24
|
80
87
|
### Added
|
@@ -82,15 +89,15 @@
|
|
82
89
|
|
83
90
|
## [0.1.1](releases/tag/v0.1.1) - 2017-05-1
|
84
91
|
### Added
|
85
|
-
- Support for settings get/set endpoints
|
92
|
+
- Support for settings get/set endpoints ([@abrom][])
|
86
93
|
|
87
94
|
## [0.0.8](releases/tag/v0.0.8) - 2017-04-30
|
88
95
|
### Added
|
89
|
-
- Support for Users `getPresence` endpoint
|
96
|
+
- Support for Users `getPresence` endpoint ([@abrom][])
|
90
97
|
|
91
98
|
## [0.0.7](releases/tag/v0.0.7) - 2017-04-30
|
92
99
|
### Added
|
93
|
-
- Support for Users `list` endpoint
|
100
|
+
- Support for Users `list` endpoint ([@abrom][])
|
94
101
|
|
95
102
|
## [0.0.6](releases/tag/v0.0.6) - 2017-04-25
|
96
103
|
### Fixed
|
@@ -99,3 +106,12 @@
|
|
99
106
|
## [0.0.5](releases/tag/v0.0.5) - 2017-04-25
|
100
107
|
### Added
|
101
108
|
- [#1] Added Users `info` and `delete` endpoints ([@reist][])
|
109
|
+
|
110
|
+
[@abrom]: https://github.com/abrom
|
111
|
+
[@reist]: https://github.com/reist
|
112
|
+
[@danischreiber]: https://github.com/danischreiber
|
113
|
+
[@hardik127]: https://github.com/hardik127
|
114
|
+
[@chrisstime]: https://github.com/chrisstime
|
115
|
+
[@christianmoretti]: https://github.com/christianmoretti
|
116
|
+
[@alinavancea]: https://github.com/alinavancea
|
117
|
+
|
data/README.md
CHANGED
@@ -68,6 +68,7 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
|
|
68
68
|
* [/api/v1/channels.setTopic](docs/channels.md#channelsset_attr)
|
69
69
|
* [/api/v1/channels.setType](docs/channels.md#channelsset_attr)
|
70
70
|
* [/api/v1/channels.online](docs/channels.md#channelsonline)
|
71
|
+
* [/api/v1/channels.members](docs/channels.md#channelsmembers)
|
71
72
|
* /api/v1/channels.unarchive
|
72
73
|
|
73
74
|
#### Groups
|
@@ -89,6 +90,7 @@ This gem supports the following Rocket.Chat APIs (Tested against Rocket.Chat v0.
|
|
89
90
|
* /api/v1/groups.setReadOnly
|
90
91
|
* /api/v1/groups.setTopic
|
91
92
|
* /api/v1/groups.setType
|
93
|
+
* [/api/v1/groups.members](docs/groups.md#groupsmembers)
|
92
94
|
* /api/v1/groups.unarchive
|
93
95
|
|
94
96
|
#### Users
|
data/lib/rocket_chat/error.rb
CHANGED
@@ -11,9 +11,11 @@ module RocketChat
|
|
11
11
|
|
12
12
|
def self.inherited(subclass)
|
13
13
|
field = subclass.name.split('::')[-1].downcase
|
14
|
-
collection = field
|
14
|
+
collection = "#{field}s"
|
15
15
|
subclass.send(:define_singleton_method, :field) { field }
|
16
16
|
subclass.send(:define_singleton_method, :collection) { collection }
|
17
|
+
|
18
|
+
super
|
17
19
|
end
|
18
20
|
|
19
21
|
#
|
@@ -283,6 +285,25 @@ module RocketChat
|
|
283
285
|
)['success']
|
284
286
|
end
|
285
287
|
|
288
|
+
#
|
289
|
+
# *.members* REST API
|
290
|
+
# @param [String] room_id Rocket.Chat room id
|
291
|
+
# @param [String] name Rocket.Chat room name
|
292
|
+
# @param [Integer] offset Query offset
|
293
|
+
# @param [Integer] count Query count/limit
|
294
|
+
# @param [Hash] sort Query field sort hash. eg `{ msgs: 1, name: -1 }`
|
295
|
+
# @return [Users[]]
|
296
|
+
# @raise [HTTPError, StatusError]
|
297
|
+
#
|
298
|
+
def members(room_id: nil, name: nil, offset: nil, count: nil, sort: nil)
|
299
|
+
response = session.request_json(
|
300
|
+
self.class.api_path('members'),
|
301
|
+
body: room_params(room_id, name).merge(build_list_body(offset, count, sort, nil, nil))
|
302
|
+
)
|
303
|
+
|
304
|
+
response['members'].map { |hash| RocketChat::User.new hash } if response['success']
|
305
|
+
end
|
306
|
+
|
286
307
|
private
|
287
308
|
|
288
309
|
attr_reader :session
|
@@ -69,7 +69,7 @@ module RocketChat
|
|
69
69
|
method: :post,
|
70
70
|
body: {
|
71
71
|
userId: id,
|
72
|
-
data: user_option_hash(options, true)
|
72
|
+
data: user_option_hash(options, include_personal_fields: true)
|
73
73
|
}
|
74
74
|
)
|
75
75
|
RocketChat::User.new response['user']
|
@@ -179,7 +179,7 @@ module RocketChat
|
|
179
179
|
|
180
180
|
attr_reader :session
|
181
181
|
|
182
|
-
def user_option_hash(options, include_personal_fields
|
182
|
+
def user_option_hash(options, include_personal_fields: false)
|
183
183
|
args = [options, :active, :roles, :join_default_channels, :require_password_change,
|
184
184
|
:send_welcome_email, :verified, :custom_fields]
|
185
185
|
args += %i[username email name password] if include_personal_fields
|
@@ -111,7 +111,7 @@ module RocketChat
|
|
111
111
|
add_body(req, body) if body
|
112
112
|
else
|
113
113
|
uri = path
|
114
|
-
uri +=
|
114
|
+
uri += "?#{body.map { |k, v| "#{k}=#{v}" }.join('&')}" if body
|
115
115
|
req = Net::HTTP::Get.new(uri, headers)
|
116
116
|
end
|
117
117
|
|
data/rocketchat.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.description = 'Rocket.Chat REST API v1 for Ruby'
|
16
16
|
spec.homepage = 'https://github.com/abrom/rocketchat-ruby'
|
17
17
|
spec.license = 'MIT'
|
18
|
+
spec.required_ruby_version = ['>= 2.5.0', '< 3.1.0']
|
18
19
|
|
19
20
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|docs)/}) }
|
20
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -23,9 +24,11 @@ Gem::Specification.new do |spec|
|
|
23
24
|
spec.add_development_dependency 'bundler', ['>= 1.11', '< 3.0']
|
24
25
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
25
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
-
spec.add_development_dependency 'rubocop', '~>
|
27
|
-
spec.add_development_dependency 'rubocop-
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 1.12'
|
28
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.10'
|
29
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5'
|
30
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
|
28
31
|
spec.add_development_dependency 'simplecov', '~> 0.16'
|
29
|
-
spec.add_development_dependency 'webmock', '~>
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.12'
|
30
33
|
spec.add_development_dependency 'yard', '~> 0.9.11'
|
31
34
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
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.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- int512
|
8
8
|
- abrom
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -65,28 +65,56 @@ dependencies:
|
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.12'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.12'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: rubocop-performance
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.10'
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.10'
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: rubocop-rake
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.5'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.5'
|
76
104
|
- !ruby/object:Gem::Dependency
|
77
105
|
name: rubocop-rspec
|
78
106
|
requirement: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
108
|
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
110
|
+
version: '2.2'
|
83
111
|
type: :development
|
84
112
|
prerelease: false
|
85
113
|
version_requirements: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
115
|
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
117
|
+
version: '2.2'
|
90
118
|
- !ruby/object:Gem::Dependency
|
91
119
|
name: simplecov
|
92
120
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,14 +135,14 @@ dependencies:
|
|
107
135
|
requirements:
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
138
|
+
version: '3.12'
|
111
139
|
type: :development
|
112
140
|
prerelease: false
|
113
141
|
version_requirements: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
143
|
- - "~>"
|
116
144
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
145
|
+
version: '3.12'
|
118
146
|
- !ruby/object:Gem::Dependency
|
119
147
|
name: yard
|
120
148
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +204,7 @@ homepage: https://github.com/abrom/rocketchat-ruby
|
|
176
204
|
licenses:
|
177
205
|
- MIT
|
178
206
|
metadata: {}
|
179
|
-
post_install_message:
|
207
|
+
post_install_message:
|
180
208
|
rdoc_options: []
|
181
209
|
require_paths:
|
182
210
|
- lib
|
@@ -184,15 +212,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
212
|
requirements:
|
185
213
|
- - ">="
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
215
|
+
version: 2.5.0
|
216
|
+
- - "<"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 3.1.0
|
188
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
220
|
requirements:
|
190
221
|
- - ">="
|
191
222
|
- !ruby/object:Gem::Version
|
192
223
|
version: '0'
|
193
224
|
requirements: []
|
194
|
-
rubygems_version: 3.
|
195
|
-
signing_key:
|
225
|
+
rubygems_version: 3.2.3
|
226
|
+
signing_key:
|
196
227
|
specification_version: 4
|
197
228
|
summary: Rocket.Chat REST API v1 for Ruby
|
198
229
|
test_files: []
|