rocketchat 0.1.21 → 0.1.23

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
  SHA256:
3
- metadata.gz: 0414d925c282330700662c6a617328a2c91610c5969285da247c653a1b512133
4
- data.tar.gz: db1fab6b741dd083488e1a1b60f36fff5130e5cff10ee88ed2847ef4853cee14
3
+ metadata.gz: e905853c710d76e1eef50b102b93632c5523713d142bd3cfe940995b39ae427c
4
+ data.tar.gz: '08ab172483429ae969d957ab0a30a2a0336d701c116719fd061911978b9f1fb7'
5
5
  SHA512:
6
- metadata.gz: 002475521b99ee9dcc766622ed1630c08daf488ba68c0f10dd620b568882b022aace8e79a6f2419b8fa6d8780290ea2df442b1537118d97415ca759cb53254bc
7
- data.tar.gz: 6f896d0c30470e16702567320ed083c63d6cce9325734295bfd553d710f8669bfd11148d79c590a89465ba06f0e7be870c02679ddab01d60858be9af6ab7b9bb
6
+ metadata.gz: ac016a85545fea96d9d7d9acf798a22ead3eaa31215e2a61a31d696aa43606bee50999f4c9e1d3174b6bdcf03d0c45d3006eff105203bf6d078bd1a221aa51e0
7
+ data.tar.gz: 471b76b3a12f47304e26f356218c8d90bc981755ecfc8499724c94d099b40a8f7f34968f3faa912f396dcc108dda20f618cb782a2107f9aef1c305000be0e643
@@ -0,0 +1,34 @@
1
+ name: Test RocketChat Ruby gem
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: true
24
+
25
+ - name: Lint code - Rubocop
26
+ run: bundle exec rubocop
27
+
28
+ - name: Run tests
29
+ run: bundle exec rspec
30
+
31
+ - name: Test & publish code coverage
32
+ uses: paambaati/codeclimate-action@v3.0.0
33
+ env:
34
+ CC_TEST_REPORTER_ID: abf0a371ff8851f13b563671914b195bb46f0997f0f93142e666d9acad08e22f
data/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  ## Unreleased
4
4
  - None
5
5
 
6
+ ## [0.1.23](releases/tag/v0.1.23) - 2022-11-11
7
+ ### Added
8
+ - [#40] Add set_attr options for announcement, custom_fields and default for channels/groups ([@reist][],[@nmagedman][])
9
+
10
+ ## [0.1.22](releases/tag/v0.1.22) - 2022-07-21
11
+ ### Fixed
12
+ - [#38] Fix room (channel/group) online API queries (use `query` instead of `roomId`) ([@abrom][])
13
+
6
14
  ## [0.1.21](releases/tag/v0.1.21) - 2021-08-30
7
15
  ### Added
8
16
  - [#36] Improve support for various REST APIs ([@abrom][])
@@ -118,4 +126,4 @@
118
126
  [@chrisstime]: https://github.com/chrisstime
119
127
  [@christianmoretti]: https://github.com/christianmoretti
120
128
  [@alinavancea]: https://github.com/alinavancea
121
-
129
+ [@nmagedman]: https://github.com/nmagedman
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RocketChat
4
- VERSION = '0.1.21'
4
+ VERSION = '0.1.23'
5
5
  end
@@ -46,19 +46,24 @@ module RocketChat
46
46
  #
47
47
  # channels.online REST API
48
48
  # @param [String] room_id Rocket.Chat room id
49
+ # @param [String] name Rocket.Chat room name
49
50
  # @return [Users[]]
51
+ # @note Must provide either `room_id` or `name` parameter. `room_id` will take precedence if providing both
50
52
  # @raise [HTTPError, StatusError]
51
53
  #
52
54
  def online(room_id: nil, name: nil)
53
55
  response = session.request_json(
54
56
  '/api/v1/channels.online',
55
- body: room_params(room_id, name)
57
+ body: { query: room_query_params(room_id, name) }
56
58
  )
57
59
 
58
60
  response['online'].map { |hash| RocketChat::User.new hash } if response['success']
59
61
  end
60
62
 
61
63
  # Keys for set_attr:
64
+ # * [String] announcement Announcement for the channel
65
+ # * [Hash] custom_fields Custom fields for the channel
66
+ # * [Boolean] default Sets whether the channel is a default channel or not
62
67
  # * [String] description A room's description
63
68
  # * [String] join_code Code to join a channel
64
69
  # * [String] purpose Alias for description
@@ -66,7 +71,7 @@ module RocketChat
66
71
  # * [String] topic A room's topic
67
72
  # * [Strong] type c (channel) or p (private group)
68
73
  def self.settable_attributes
69
- %i[description join_code purpose read_only topic type]
74
+ %i[announcement custom_fields default description join_code purpose read_only topic type]
70
75
  end
71
76
  end
72
77
  end
@@ -77,26 +77,30 @@ module RocketChat
77
77
  #
78
78
  # groups.online REST API
79
79
  # @param [String] room_id Rocket.Chat room id
80
+ # @param [String] name Rocket.Chat room name
80
81
  # @return [Users[]]
82
+ # @note Must provide either `room_id` or `name` parameter. `room_id` will take precedence if providing both
81
83
  # @raise [HTTPError, StatusError]
82
84
  #
83
85
  def online(room_id: nil, name: nil)
84
86
  response = session.request_json(
85
87
  '/api/v1/groups.online',
86
- body: room_params(room_id, name)
88
+ body: { query: room_query_params(room_id, name) }
87
89
  )
88
90
 
89
91
  response['online'].map { |hash| RocketChat::User.new hash } if response['success']
90
92
  end
91
93
 
92
94
  # Keys for set_attr:
95
+ # * [String] announcement Announcement for the channel
96
+ # * [Hash] custom_fields Custom fields for the channel
93
97
  # * [String] description A room's description
94
98
  # * [String] purpose Alias for description
95
99
  # * [Boolean] read_only Read-only status
96
100
  # * [String] topic A room's topic
97
101
  # * [Strong] type c (channel) or p (private group)
98
102
  def self.settable_attributes
99
- %i[description purpose read_only topic type]
103
+ %i[announcement custom_fields description purpose read_only topic type]
100
104
  end
101
105
  end
102
106
  end
@@ -309,7 +309,7 @@ module RocketChat
309
309
  attr_reader :session
310
310
 
311
311
  def room_option_hash(options)
312
- args = [options, :members, :read_only, :custom_fields]
312
+ args = [options, :members, :read_only, :custom_fields, :extra_data]
313
313
 
314
314
  options = Util.slice_hash(*args)
315
315
  return {} if options.empty?
@@ -15,6 +15,16 @@ module RocketChat
15
15
  {}
16
16
  end
17
17
  end
18
+
19
+ def room_query_params(id, name)
20
+ if id
21
+ { _id: id }
22
+ elsif name
23
+ { name: name }
24
+ else
25
+ {}
26
+ end.to_json
27
+ end
18
28
  end
19
29
  end
20
30
  end
data/rocketchat.gemspec CHANGED
@@ -15,7 +15,14 @@ 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
+ spec.required_ruby_version = ['>= 2.5.0', '< 3.2.0']
19
+
20
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
21
+ # delete this section to allow pushing this gem to any host.
22
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
23
+
24
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
25
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
26
 
20
27
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|docs)/}) }
21
28
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -24,11 +31,11 @@ Gem::Specification.new do |spec|
24
31
  spec.add_development_dependency 'bundler', ['>= 1.11', '< 3.0']
25
32
  spec.add_development_dependency 'rake', '>= 12.3.3'
26
33
  spec.add_development_dependency 'rspec', '~> 3.0'
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'
31
- spec.add_development_dependency 'simplecov', '~> 0.16'
34
+ spec.add_development_dependency 'rubocop', '~> 1.28'
35
+ spec.add_development_dependency 'rubocop-performance', '~> 1.13'
36
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
37
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
38
+ spec.add_development_dependency 'simplecov', '~> 0.16', '< 0.18'
32
39
  spec.add_development_dependency 'webmock', '~> 3.12'
33
40
  spec.add_development_dependency 'yard', '~> 0.9.11'
34
41
  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.21
4
+ version: 0.1.23
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: 2021-08-30 00:00:00.000000000 Z
12
+ date: 2022-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -65,56 +65,56 @@ dependencies:
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.12'
68
+ version: '1.28'
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: '1.12'
75
+ version: '1.28'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rubocop-performance
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.10'
82
+ version: '1.13'
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.10'
89
+ version: '1.13'
90
90
  - !ruby/object:Gem::Dependency
91
91
  name: rubocop-rake
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.5'
96
+ version: '0.6'
97
97
  type: :development
98
98
  prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.5'
103
+ version: '0.6'
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: rubocop-rspec
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.2'
110
+ version: '2.10'
111
111
  type: :development
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.2'
117
+ version: '2.10'
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: simplecov
120
120
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,9 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.16'
125
+ - - "<"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.18'
125
128
  type: :development
126
129
  prerelease: false
127
130
  version_requirements: !ruby/object:Gem::Requirement
@@ -129,6 +132,9 @@ dependencies:
129
132
  - - "~>"
130
133
  - !ruby/object:Gem::Version
131
134
  version: '0.16'
135
+ - - "<"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.18'
132
138
  - !ruby/object:Gem::Dependency
133
139
  name: webmock
134
140
  requirement: !ruby/object:Gem::Requirement
@@ -166,9 +172,9 @@ executables:
166
172
  extensions: []
167
173
  extra_rdoc_files: []
168
174
  files:
175
+ - ".github/workflows/test.yml"
169
176
  - ".gitignore"
170
177
  - ".rubocop.yml"
171
- - ".travis.yml"
172
178
  - CHANGELOG.md
173
179
  - Gemfile
174
180
  - LICENSE
@@ -203,8 +209,10 @@ files:
203
209
  homepage: https://github.com/abrom/rocketchat-ruby
204
210
  licenses:
205
211
  - MIT
206
- metadata: {}
207
- post_install_message:
212
+ metadata:
213
+ allowed_push_host: https://rubygems.org
214
+ rubygems_mfa_required: 'true'
215
+ post_install_message:
208
216
  rdoc_options: []
209
217
  require_paths:
210
218
  - lib
@@ -215,15 +223,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
223
  version: 2.5.0
216
224
  - - "<"
217
225
  - !ruby/object:Gem::Version
218
- version: 3.1.0
226
+ version: 3.2.0
219
227
  required_rubygems_version: !ruby/object:Gem::Requirement
220
228
  requirements:
221
229
  - - ">="
222
230
  - !ruby/object:Gem::Version
223
231
  version: '0'
224
232
  requirements: []
225
- rubygems_version: 3.0.6
226
- signing_key:
233
+ rubygems_version: 3.3.7
234
+ signing_key:
227
235
  specification_version: 4
228
236
  summary: Rocket.Chat REST API v1 for Ruby
229
237
  test_files: []
data/.travis.yml DELETED
@@ -1,30 +0,0 @@
1
- env:
2
- global:
3
- - CC_TEST_REPORTER_ID=abf0a371ff8851f13b563671914b195bb46f0997f0f93142e666d9acad08e22f
4
-
5
- language: ruby
6
-
7
- rvm:
8
- - 2.5
9
- - 2.6
10
- - 2.7
11
- - 3.0
12
-
13
- before_install:
14
- - gem update bundler
15
-
16
- install:
17
- - bundle install --jobs=3 --retry=3
18
- - gem install rubocop
19
-
20
- before_script:
21
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
22
- - chmod +x ./cc-test-reporter
23
- - ./cc-test-reporter before-build
24
-
25
- script:
26
- - bundle exec rubocop
27
- - bundle exec rake
28
-
29
- after_script:
30
- - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT