rocketchat 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/rocket_chat/gem_version.rb +1 -1
- data/lib/rocket_chat/messages/room.rb +11 -3
- data/lib/rocket_chat/request_helper.rb +2 -3
- data/rocketchat.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f267ba8c635df9da09f97e9da8ba7b4cae0d1ca214aaee49e8ea172abb87af
|
4
|
+
data.tar.gz: f6f3bf71b1dbc67e1218c8767bcc99051979085de1bb1869cb34c50cc622261c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a205e48ec4a51c13a607364850f3febf6be3b2153af570f44b497650e1065740f33fe5a1d044cfb1d2946094aed790c3374947f7bb9bd7ceac6b329efb9c1b6
|
7
|
+
data.tar.gz: f47d747b5bba43b6e10339c63313a64326704f9f2c27b2259ccb308cdc3bea51edb94bdb23a5df7b3a94473050ec57758b6660e01baee04078b7ad5f5a7559ca
|
data/.github/workflows/test.yml
CHANGED
@@ -11,10 +11,10 @@ jobs:
|
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby-version: ['
|
14
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3']
|
15
15
|
|
16
16
|
steps:
|
17
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v4
|
18
18
|
|
19
19
|
- name: Set up Ruby
|
20
20
|
uses: ruby/setup-ruby@v1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
## Unreleased
|
4
4
|
- None
|
5
5
|
|
6
|
+
## [0.2.4](releases/tag/v0.2.4) - 2023-12-22
|
7
|
+
### Added
|
8
|
+
- [#47] Add content-type and filename params for file upload ([@MrRTI][])
|
9
|
+
|
6
10
|
## [0.2.3](releases/tag/v0.2.3) - 2023-08-22
|
7
11
|
### Added
|
8
12
|
- [#46] Add file upload support using rooms.upload endpoint ([@MrRTI][])
|
@@ -319,7 +319,7 @@ module RocketChat
|
|
319
319
|
response = session.request_json(
|
320
320
|
"#{API_PREFIX}/rooms.upload/#{room_id}",
|
321
321
|
method: :post,
|
322
|
-
form_data:
|
322
|
+
form_data: file_upload_array(file: file, **rest_params)
|
323
323
|
)
|
324
324
|
|
325
325
|
RocketChat::Message.new response['message'] if response['success']
|
@@ -345,9 +345,17 @@ module RocketChat
|
|
345
345
|
self.class.settable_attributes.include?(attribute)
|
346
346
|
end
|
347
347
|
|
348
|
-
def
|
348
|
+
def file_upload_array(**params)
|
349
349
|
permited_keys_for_file_upload = %i[file msg description tmid]
|
350
|
-
Util.slice_hash(params, *permited_keys_for_file_upload)
|
350
|
+
hash = Util.slice_hash(params, *permited_keys_for_file_upload).compact
|
351
|
+
|
352
|
+
# NOTE: https://docs.ruby-lang.org/en/master/Net/HTTPHeader.html#method-i-set_form
|
353
|
+
file_options = params.slice(:filename, :content_type).compact
|
354
|
+
hash.map do |key, value|
|
355
|
+
next [key.to_s, value, file_options] if key == :file && file_options.keys.any?
|
356
|
+
|
357
|
+
[key.to_s, value]
|
358
|
+
end
|
351
359
|
end
|
352
360
|
end
|
353
361
|
end
|
@@ -110,7 +110,7 @@ module RocketChat
|
|
110
110
|
req = Net::HTTP::Post.new(path, headers)
|
111
111
|
add_body(req, body) if body
|
112
112
|
|
113
|
-
form_data =
|
113
|
+
form_data = options[:form_data]
|
114
114
|
add_form_data(req, form_data) if form_data
|
115
115
|
else
|
116
116
|
uri = path
|
@@ -131,12 +131,11 @@ module RocketChat
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def add_form_data(request, form_data)
|
134
|
-
form_data = form_data.transform_keys(&:to_s) if form_data.is_a? Hash
|
135
134
|
request.set_form(form_data, 'multipart/form-data')
|
136
135
|
end
|
137
136
|
|
138
137
|
def reject_nils(data)
|
139
|
-
data&.
|
138
|
+
data&.compact
|
140
139
|
end
|
141
140
|
end
|
142
141
|
end
|
data/rocketchat.gemspec
CHANGED
@@ -15,7 +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 = ['>=
|
18
|
+
spec.required_ruby_version = ['>= 3.0.0', '< 3.4.0']
|
19
19
|
|
20
20
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
21
21
|
# delete this section to allow pushing this gem to any host.
|
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.2.
|
4
|
+
version: 0.2.5
|
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: 2024-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Rocket.Chat REST API v1 for Ruby
|
15
15
|
email:
|
@@ -68,10 +68,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
71
|
+
version: 3.0.0
|
72
72
|
- - "<"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 3.
|
74
|
+
version: 3.4.0
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - ">="
|