rocketchat 0.1.23 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e905853c710d76e1eef50b102b93632c5523713d142bd3cfe940995b39ae427c
4
- data.tar.gz: '08ab172483429ae969d957ab0a30a2a0336d701c116719fd061911978b9f1fb7'
3
+ metadata.gz: 4a6c0288c4420a286b0444dc84749e572fa40806874616673a360a509dfa90f8
4
+ data.tar.gz: e6d74695c8e75fa49c51f4de0e6db86476b965351a9a7231d9f57b5a59d70bd1
5
5
  SHA512:
6
- metadata.gz: ac016a85545fea96d9d7d9acf798a22ead3eaa31215e2a61a31d696aa43606bee50999f4c9e1d3174b6bdcf03d0c45d3006eff105203bf6d078bd1a221aa51e0
7
- data.tar.gz: 471b76b3a12f47304e26f356218c8d90bc981755ecfc8499724c94d099b40a8f7f34968f3faa912f396dcc108dda20f618cb782a2107f9aef1c305000be0e643
6
+ metadata.gz: bbecd274cd60768eb7fcc19a95cd9652d474405bb80047aa16e51a700b2468b1057cdfe907ab093471e4227a6870924b05c89cb41a2be8742c7a5ddb4e6a6248
7
+ data.tar.gz: f6e927d6dca42397da5ea9517033e9549f9ebc238e1f994aee63ef5f33644d497330a4dfd74426f3564f71223af257a79678ac346bce5dc4610d5e95423977ba
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
14
+ ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2']
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -41,6 +41,9 @@ Metrics/MethodLength:
41
41
  RSpec/ExampleLength:
42
42
  Max: 10
43
43
 
44
+ RSpec/IndexedLet:
45
+ Max: 2
46
+
44
47
  RSpec/MultipleExpectations:
45
48
  Max: 5
46
49
 
data/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  ## Unreleased
4
4
  - None
5
5
 
6
+ ## [0.2.2](releases/tag/v0.2.2) - 2023-04-21
7
+ ### Added
8
+ - [#43] Add Ruby 3.2 support ([@MrRTI][])
9
+ - [#44] Add support for thread messages ([@MrRTI][])
10
+
11
+ ### Fixed
12
+ - [#45] Fixed some rubocop lints ([@abrom][])
13
+
14
+
15
+ ## [0.2.1](releases/tag/v0.2.1) - 2022-12-19
16
+ ### Fixed
17
+ - [#41] URL-encode param values in GET query strings ([@nmagedman][])
18
+
6
19
  ## [0.1.23](releases/tag/v0.1.23) - 2022-11-11
7
20
  ### Added
8
21
  - [#40] Add set_attr options for announcement, custom_fields and default for channels/groups ([@reist][],[@nmagedman][])
@@ -127,3 +140,4 @@
127
140
  [@christianmoretti]: https://github.com/christianmoretti
128
141
  [@alinavancea]: https://github.com/alinavancea
129
142
  [@nmagedman]: https://github.com/nmagedman
143
+ [@MrRTI]: https://github.com/MrRTi
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RocketChat
4
- VERSION = '0.1.23'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -20,6 +20,11 @@ module RocketChat
20
20
  data['_id']
21
21
  end
22
22
 
23
+ # Message thread id
24
+ def tmid
25
+ data['tmid']
26
+ end
27
+
23
28
  # Timestamp
24
29
  def timestamp
25
30
  Time.parse data['ts']
@@ -67,7 +72,8 @@ module RocketChat
67
72
  object_id: object_id,
68
73
  id: id,
69
74
  room_id: room_id,
70
- message: message
75
+ message: message,
76
+ tmid: tmid
71
77
  )
72
78
  end
73
79
  end
@@ -55,7 +55,7 @@ module RocketChat
55
55
  # @param [String] room_id Rocket.Chat room id
56
56
  # @param [String] name Rocket.Chat room name (coming soon)
57
57
  # @param [String] channel Rocket.Chat channel name
58
- # @param [Hash] params Optional params (text, alias, emoji, avatar & attachments)
58
+ # @param [Hash] params Optional params (text, alias, emoji, tmid, avatar & attachments)
59
59
  # @return [RocketChat::Message]
60
60
  # @raise [HTTPError, StatusError]
61
61
  #
@@ -65,7 +65,7 @@ module RocketChat
65
65
  method: :post,
66
66
  body: room_params(room_id, name)
67
67
  .merge(channel: channel)
68
- .merge(Util.slice_hash(params, :text, :alias, :emoji, :avatar, :attachments))
68
+ .merge(Util.slice_hash(params, :text, :alias, :tmid, :emoji, :avatar, :attachments))
69
69
  )
70
70
  RocketChat::Message.new response['message'] if response['success']
71
71
  end
@@ -78,16 +78,16 @@ module RocketChat
78
78
  #
79
79
  # im.counters REST API
80
80
  # @param [String] room_id Rocket.Chat roomId
81
- # @param [String] username Rocket.Chat username
81
+ # @param [String] user_id Rocket.Chat userId [optional]
82
82
  # @return [RocketChat::ImSummary]
83
83
  # @raise [HTTPError, StatusError]
84
84
  #
85
- def counters(room_id:, username: nil)
85
+ def counters(room_id:, user_id: nil)
86
86
  response = session.request_json(
87
87
  '/api/v1/im.counters',
88
88
  body: {
89
89
  roomId: room_id,
90
- username: username
90
+ userId: user_id
91
91
  }
92
92
  )
93
93
  RocketChat::ImSummary.new response
@@ -104,14 +104,14 @@ module RocketChat
104
104
 
105
105
  def create_request(path, options)
106
106
  headers = get_headers(options)
107
- body = options[:body]
107
+ body = options[:body]&.reject { |_key, value| value.nil? }
108
108
 
109
109
  if options[:method] == :post
110
110
  req = Net::HTTP::Post.new(path, headers)
111
111
  add_body(req, body) if body
112
112
  else
113
113
  uri = path
114
- uri += "?#{body.map { |k, v| "#{k}=#{v}" }.join('&')}" if body
114
+ uri += "?#{URI.encode_www_form(body)}" if body
115
115
  req = Net::HTTP::Get.new(uri, headers)
116
116
  end
117
117
 
@@ -32,7 +32,7 @@ module RocketChat
32
32
  # @return Hash filtered by keys
33
33
  #
34
34
  def slice_hash(hash, *keys)
35
- return {} if keys.length.zero?
35
+ return {} if keys.empty?
36
36
 
37
37
  new_hash = {}
38
38
  hash.each do |key, value|
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 = ['>= 2.5.0', '< 3.2.0']
18
+ spec.required_ruby_version = ['>= 2.5.0', '< 3.3.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.1.23
4
+ version: 0.2.2
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: 2022-11-11 00:00:00.000000000 Z
12
+ date: 2023-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -223,14 +223,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
223
  version: 2.5.0
224
224
  - - "<"
225
225
  - !ruby/object:Gem::Version
226
- version: 3.2.0
226
+ version: 3.3.0
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  requirements:
229
229
  - - ">="
230
230
  - !ruby/object:Gem::Version
231
231
  version: '0'
232
232
  requirements: []
233
- rubygems_version: 3.3.7
233
+ rubygems_version: 3.4.1
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: Rocket.Chat REST API v1 for Ruby