Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Test RocketChat Ruby gem

env:
CC_TEST_REPORTER_ID: abf0a371ff8851f13b563671914b195bb46f0997f0f93142e666d9acad08e22f

on:
push:
branches: [main]
Expand Down Expand Up @@ -30,5 +33,3 @@ jobs:

- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v3.0.0
env:
CC_TEST_REPORTER_ID: abf0a371ff8851f13b563671914b195bb46f0997f0f93142e666d9acad08e22f
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ gem 'rubocop', '~> 1.70'
gem 'rubocop-performance', '~> 1.23'
gem 'rubocop-rake', '~> 0.6'
gem 'rubocop-rspec', '~> 3.3'
gem 'simplecov', '~> 0.16', '< 0.18'
gem 'simplecov', '~> 0.22'
gem 'webmock', '~> 3.24'
gem 'yard', '~> 0.9.11'
2 changes: 1 addition & 1 deletion lib/rocket_chat/messages/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def list(offset: nil, count: nil, sort: nil, fields: nil, query: nil)
def online(room_id: nil, name: nil)
response = session.request_json(
'/api/v1/channels.online',
body: { query: room_query_params(room_id, name) }
body: room_query_params(room_id, name)
)

response['online'].map { |hash| RocketChat::User.new hash } if response['success']
Expand Down
2 changes: 1 addition & 1 deletion lib/rocket_chat/messages/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def list_all(offset: nil, count: nil, sort: nil, fields: nil, query: nil)
def online(room_id: nil, name: nil)
response = session.request_json(
'/api/v1/groups.online',
body: { query: room_query_params(room_id, name) }
body: room_query_params(room_id, name)
)

response['online'].map { |hash| RocketChat::User.new hash } if response['success']
Expand Down
5 changes: 3 additions & 2 deletions lib/rocket_chat/messages/room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ def room_option_hash(options)
end

def validate_attribute(attribute)
raise ArgumentError, "Unsettable attribute: #{attribute || 'nil'}" unless \
self.class.settable_attributes.include?(attribute)
return if self.class.settable_attributes.include?(attribute)

raise ArgumentError, "Unsettable attribute: #{attribute || 'nil'}"
end

def file_upload_array(**params)
Expand Down
4 changes: 2 additions & 2 deletions lib/rocket_chat/messages/room_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def room_query_params(id, name)
if id
{ _id: id }
elsif name
{ name: name }
{ query: { name: name }.to_json }
else
{}
end.to_json
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rocket_chat/messages/channel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
stub_authed_request(:get, described_class.api_path('online?query=%7B%22name%22:%22room-one%22%7D'))
.to_return(online_users_response)

stub_authed_request(:get, described_class.api_path('online?query=%7B%22_id%22:%22TZtANZwQt369rR4UR%22%7D'))
stub_authed_request(:get, described_class.api_path('online?_id=TZtANZwQt369rR4UR'))
.to_return(online_users_response)

stub_authed_request(:get, described_class.api_path('online?query=%7B%22name%22:%22empty-room%22%7D'))
Expand Down
2 changes: 1 addition & 1 deletion spec/rocket_chat/messages/group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
stub_authed_request(:get, described_class.api_path('online?query=%7B%22name%22:%22room-one%22%7D'))
.to_return(online_users_response)

stub_authed_request(:get, described_class.api_path('online?query=%7B%22_id%22:%22TZtANZwQt369rR4UR%22%7D'))
stub_authed_request(:get, described_class.api_path('online?_id=TZtANZwQt369rR4UR'))
.to_return(online_users_response)

stub_authed_request(:get, described_class.api_path('online?query=%7B%22name%22:%22empty-room%22%7D'))
Expand Down
6 changes: 4 additions & 2 deletions spec/shared/room_behaviors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
}
end
let(:invalid_room_message) do
%(The required "roomId" or "roomName" param provided does not match any #{described_class.field} ) \
'[error-room-not-found]'
<<~ERROR.delete("\n")
The required "roomId" or "roomName" param provided does not match any #{described_class.field}
[error-room-not-found]
ERROR
end
let(:invalid_room_body) do
{
Expand Down