cent 2.2.0 → 4.0.0

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: b533a1550e369ce3cafb34965c09d01a66691249d58424306f1dddae06feb170
4
- data.tar.gz: 861d3619f6110bdea4892bd8c09be01e22466d6f951007a5a2d05e2d0ffb092f
3
+ metadata.gz: f449834c3edc1adb0db5f29e528a679b72068fcf0d68740afd236d7bc988452f
4
+ data.tar.gz: 671dc83face9f06c846a60de599b71fa73801a7b2626da5d22c96da1fa2a0b21
5
5
  SHA512:
6
- metadata.gz: d827bcc6f421a1f9ab5a70f3cb17025bd2986247112888dfc3d53af494f88930deb8caca2556ceda27696d5da9979867d2bea32a3f598597dccc96c0d3b8d812
7
- data.tar.gz: a7064d71efc537467ac5337182abe168e1d67a5e77365dac9a35d391f5d32a1e0094ca1176fed6940683f56643d073225a0ba5a6258cab6bb9578543d118437c
6
+ metadata.gz: a50ca9b8b2e0bdcecbc48a105d662f52c3085429bc6d20aa1d930e4ea8a399a0cc0d2ee1613f5fe4b8791b247d52bba4a4d6f7bc6a6afc7d735331720ce54233
7
+ data.tar.gz: 34d65c5a21618d19901352fa08c833e91746107cf00c79a874716f51acf964dfd0ebeab205cf07a09bb464830aff28a589736592eeed8211948887529637a2b6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 3.0.0
2
+ =====
3
+
4
+ Not using changelog anymore. See [Github releases](https://github.com/centrifugal/rubycent/releases) now.
5
+
1
6
  2.2.0
2
7
  =====
3
8
 
data/Gemfile CHANGED
@@ -5,13 +5,11 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in cent.gemspec
6
6
  gemspec
7
7
 
8
- gem 'rake', '~> 13.0'
9
-
10
- gem 'rspec', '~> 3.0'
11
- gem 'webmock', '~> 3.7.5'
12
-
13
- gem 'rubocop', '~> 1.7'
14
- gem 'rubocop-rake'
15
- gem 'rubocop-rspec'
16
-
8
+ gem 'appraisal', '~> 2.5'
17
9
  gem 'pry'
10
+ gem 'rake', '~> 13.0'
11
+ gem 'rspec', '~> 3.12'
12
+ gem 'rubocop', '~> 1.60'
13
+ gem 'rubocop-rake', '~> 0.6'
14
+ gem 'rubocop-rspec', '~> 3.0'
15
+ gem 'webmock', '~> 3.19'
data/README.md CHANGED
@@ -1,281 +1,260 @@
1
- [![Code Climate](https://codeclimate.com/github/centrifugal/centrifuge-ruby/badges/gpa.svg)](https://codeclimate.com/github/centrifugal/centrifuge-ruby)
1
+ # cent
2
+
2
3
  ![Build Status](https://github.com/centrifugal/rubycent/actions/workflows/main.yml/badge.svg)
3
4
 
4
- [Centrifugo HTTP API](https://centrifugal.dev/docs/server/server_api) client in Ruby.
5
+ Ruby client for the [Centrifugo](https://centrifugal.dev) server HTTP API.
5
6
 
6
- ## Installation
7
+ - `Cent::Client` — call server API methods (publish, broadcast, presence, history, …).
8
+ - `Cent::Notary` — issue connection and subscription JWTs.
7
9
 
8
- Add this line to your application's Gemfile:
10
+ Works with Centrifugo **v4 and newer** (tested against v6.7.1). Ruby 3.0+.
11
+
12
+ ## Installation
9
13
 
10
14
  ```ruby
11
- gem 'cent'
15
+ gem 'cent', '~> 4.0'
12
16
  ```
13
17
 
14
- And then execute:
15
-
16
- $ bundle
17
-
18
- Or install it yourself as:
18
+ ```sh
19
+ $ bundle install
20
+ ```
19
21
 
20
- $ gem install cent
22
+ ## API client
21
23
 
22
- ## Usage
24
+ ```ruby
25
+ client = Cent::Client.new(api_key: 'your-api-key')
26
+ # Or pointing at a remote Centrifugo:
27
+ client = Cent::Client.new(
28
+ api_key: 'your-api-key',
29
+ endpoint: 'https://centrifugo.example.com/api',
30
+ timeout: 5
31
+ )
32
+ ```
23
33
 
24
- Functionality is split between two classes:
25
- - `Cent::Client` to call API methods
26
- - `Cent::Notary` to generate tokens
34
+ Every method returns the parsed response body from Centrifugo:
27
35
 
28
- ### Token Generation
36
+ - On success the body has a `"result"` key: `{ "result" => { ... } }`.
37
+ - On an API-level failure (e.g. unknown channel, namespace not found) `Cent::ResponseError` is raised with Centrifugo's numeric `code` and `message`.
38
+ - On a transport problem (network failure, timeout, non-2xx HTTP, malformed JSON) a `Cent::Error` subclass is raised.
29
39
 
30
- ```ruby
31
- notary = Cent::Notary.new(secret: 'secret')
32
- ```
40
+ `batch` and `broadcast` are different — see their sections below.
33
41
 
34
- By default it uses HS256 to generate tokens, but you can set it to one of the HMAC, RSA or ECDSA family.
42
+ ### Customizing the connection
35
43
 
36
- #### RSA
44
+ The initializer yields the underlying [`Faraday::Connection`](https://lostisland.github.io/faraday/) so you can adjust headers, timeouts, adapter, etc.
37
45
 
38
46
  ```ruby
39
- secret = OpenSSL::PKey::RSA.new(File.read('./rsa_secret.pem'))
40
- notary = Cent::Notary.new(secret: secret, algorithm: 'RS256')
47
+ Cent::Client.new(api_key: 'k') do |conn|
48
+ conn.headers['User-Agent'] = 'my-app/1.0'
49
+ conn.options.open_timeout = 3
50
+ conn.options.timeout = 7
51
+ conn.adapter :typhoeus
52
+ end
41
53
  ```
42
54
 
43
- #### ECDSA
55
+ ### Publishing
44
56
 
45
57
  ```ruby
46
- secret = OpenSSL::PKey::EC.new(File.read('./ecdsa_secret.pem'))
47
- notary = Cent::Notary.new(secret: secret, algorithm: 'ES256')
58
+ client.publish(channel: 'chat', data: { text: 'hello' })
59
+ # => {"result" => {"offset" => 1, "epoch" => "xyz"}}
60
+
61
+ client.publish(
62
+ channel: 'chat',
63
+ data: { text: 'hello' },
64
+ skip_history: false,
65
+ tags: { 'author' => '42' },
66
+ idempotency_key: 'my-idempotency-key',
67
+ delta: true
68
+ )
48
69
  ```
49
70
 
50
- #### Connection token
71
+ See [publish](https://centrifugal.dev/docs/server/server_api#publish).
51
72
 
52
- When connecting to Centrifugo client [must provide connection JWT token](https://centrifugal.github.io/centrifugo/server/authentication/) with several predefined credential claims.
73
+ ### Broadcast
53
74
 
54
75
  ```ruby
55
- notary.issue_connection_token(sub: '42')
56
-
57
- #=> "eyJhbGciOiJIUzI1NiJ9..."
76
+ response = client.broadcast(channels: %w[chat:1 chat:2], data: { text: 'hi' })
77
+ # response => { "result" => { "responses" => [ {"result" => {...}}, {"result" => {...}} ] } }
58
78
  ```
59
79
 
60
- `info` and `exp` are supported as well:
80
+ The outer call only raises `Cent::ResponseError` if the whole broadcast is rejected (e.g. malformed request). Per-channel failures are delivered as individual entries in `response["result"]["responses"]`, each of which may contain an `"error"` key — **these are not raised**. Walk the array to check them:
61
81
 
62
82
  ```ruby
63
- notary.issue_connection_token(sub: '42', info: { scope: 'admin' }, exp: 1629050099)
64
-
65
- #=> "eyJhbGciOiJIUzI1NiJ9..."
83
+ response['result']['responses'].each_with_index do |r, i|
84
+ warn "channel #{i} failed: #{r['error']['message']}" if r['error']
85
+ end
66
86
  ```
67
87
 
68
- ### Private channel token
69
-
70
- All channels starting with $ considered private and require a **channel token** to subscribe.
71
- Private channel subscription token is also JWT([see the claims](https://centrifugal.github.io/centrifugo/server/private_channels/))
88
+ ### Subscribe / Unsubscribe
72
89
 
73
90
  ```ruby
74
- notary.issue_channel_token(client: 'client', channel: 'channel', exp: 1629050099, info: { scope: 'admin' })
75
-
76
- #=> "eyJhbGciOiJIUzI1NiJ9..."
91
+ client.subscribe(user: '42', channel: 'chat')
92
+ client.unsubscribe(user: '42', channel: 'chat')
77
93
  ```
78
-
79
- ### API Client
80
94
 
81
- A client requires your Centrifugo API key to execute all requests.
95
+ ### Disconnect / Refresh
82
96
 
83
97
  ```ruby
84
- client = Cent::Client.new(api_key: 'key')
98
+ client.disconnect(user: '42')
99
+ client.disconnect(user: '42', whitelist: %w[keep-this-client-id])
100
+
101
+ client.refresh(user: '42', expired: true)
85
102
  ```
86
103
 
87
- you can customize your connection as you wish, just remember it's a [Faraday::Connection](https://lostisland.github.io/faraday/usage/#customizing-faradayconnection) instance:
104
+ ### Presence / Presence stats
88
105
 
89
106
  ```ruby
90
- client = Cent::Client.new(api_key: 'key', endpoint: 'https://centrifu.go/api') do |connection|
91
- connection.headers['User-Agent'] = 'Centrifugo Ruby Client'
92
- connection.options.open_timeout = 3
93
- connection.options.timeout = 7
94
- connection.adapter :typhoeus
95
- end
107
+ client.presence(channel: 'chat')
108
+ client.presence_stats(channel: 'chat')
96
109
  ```
97
110
 
98
- #### Publish
99
-
100
- Send data to the channel.
101
-
102
- [publish](https://centrifugal.dev/docs/server/server_api#publish)
111
+ ### History
103
112
 
104
113
  ```ruby
105
- client.publish(channel: 'chat', data: 'hello') # => {}
114
+ client.history(channel: 'chat', limit: 10)
115
+ client.history(channel: 'chat', limit: 10, reverse: true)
116
+ client.history(channel: 'chat', limit: 10, since: { 'offset' => 5, 'epoch' => 'xyz' })
117
+ client.history_remove(channel: 'chat')
106
118
  ```
107
119
 
108
- #### Broadcast
109
-
110
- Sends data to multiple channels.
111
-
112
- [broadcast](https://centrifugal.dev/docs/server/server_api#broadcast)
120
+ ### Channels
113
121
 
114
122
  ```ruby
115
- client.broadcast(channels: ["clients", "staff"], data: 'hello') # => {}
123
+ client.channels
124
+ client.channels(pattern: 'chat:*')
116
125
  ```
117
126
 
118
- #### Unsubscribe
119
-
120
- Unsubscribe user from channel. Receives to arguments: channel and user (user ID you want to unsubscribe)
121
-
122
- [unsubscribe](https://centrifugal.dev/docs/server/server_api#unsubscribe)
127
+ ### Info
123
128
 
124
129
  ```ruby
125
- client.unsubscribe(channel: 'chat', user: '1') # => {}
130
+ client.info
126
131
  ```
127
132
 
128
- #### Disconnect
129
-
130
- Allows to disconnect user by it's ID. Receives user ID as an argument.
133
+ ### Batch
131
134
 
132
- [disconnect](https://centrifugal.dev/docs/server/server_api#disconnect)
135
+ Send many commands in one HTTP request — Centrifugo processes them sequentially (or in parallel with `parallel: true`) and returns one reply per command in the same order.
133
136
 
134
137
  ```ruby
135
- # Disconnect user with `id = 1`
136
- #
137
- client.disconnect(user: '1') # => {}
138
+ response = client.batch(commands: [
139
+ { 'publish' => { 'channel' => 'a', 'data' => { 'x' => 1 } } },
140
+ { 'publish' => { 'channel' => 'b', 'data' => { 'x' => 2 } } },
141
+ { 'presence_stats' => { 'channel' => 'a' } }
142
+ ])
143
+ # => { "replies" => [ {"publish" => {...}}, {"publish" => {...}}, {"presence_stats" => {...}} ] }
138
144
  ```
139
145
 
140
- #### Presence
146
+ Two things about batch are different from every other method:
141
147
 
142
- Get channel presence information(all clients currently subscribed on this channel).
148
+ 1. **No `result` wrapper.** The response is `{ "replies" => [...] }` at the top level. This matches Centrifugo's wire format.
149
+ 2. **Per-command errors are not raised.** Each entry in `replies` may instead be `{ "error" => { "code" => ..., "message" => ... } }`. Raising on the first would make partial-success responses impossible to inspect — so the caller is expected to walk the array:
143
150
 
144
- [presence](https://centrifugal.dev/docs/server/server_api#presence)
151
+ ```ruby
152
+ response['replies'].each_with_index do |reply, i|
153
+ if reply['error']
154
+ warn "command #{i} failed: #{reply['error']['code']} #{reply['error']['message']}"
155
+ end
156
+ end
157
+ ```
145
158
 
146
- ```ruby
147
- client.presence(channel: 'chat')
148
-
149
- # {
150
- # 'result' => {
151
- # 'presence' => {
152
- # 'c54313b2-0442-499a-a70c-051f8588020f' => {
153
- # 'client' => 'c54313b2-0442-499a-a70c-051f8588020f',
154
- # 'user' => '42'
155
- # },
156
- # 'adad13b1-0442-499a-a70c-051f858802da' => {
157
- # 'client' => 'adad13b1-0442-499a-a70c-051f858802da',
158
- # 'user' => '42'
159
- # }
160
- # }
161
- # }
162
- # }
163
- ```
164
-
165
- #### Presence stats
166
-
167
- Get short channel presence information.
168
-
169
- [presence_stats](https://centrifugal.dev/docs/server/server_api#presence_stats)
159
+ `Cent::ResponseError` is still raised if Centrifugo rejects the batch request as a whole (e.g. malformed top-level body).
170
160
 
171
- ```ruby
172
- client.presence_stats(channel: 'chat')
161
+ ### Error handling
173
162
 
174
- # {
175
- # "result" => {
176
- # "num_clients" => 0,
177
- # "num_users" => 0
178
- # }
179
- # }
163
+ ```ruby
164
+ begin
165
+ response = client.publish(channel: 'chat', data: 'hi')
166
+ rescue Cent::ResponseError => e
167
+ # Centrifugo rejected the request (e.g. unknown channel, namespace not found).
168
+ puts "Centrifugo error #{e.code}: #{e.message}"
169
+ rescue Cent::TimeoutError
170
+ # request timed out
171
+ rescue Cent::NetworkError
172
+ # connection refused / DNS failure / etc.
173
+ rescue Cent::UnauthorizedError => e
174
+ # HTTP 401 — API key is wrong
175
+ rescue Cent::TransportError => e
176
+ # other 4xx/5xx — e.status has the HTTP code
177
+ rescue Cent::DecodeError
178
+ # response body wasn't valid JSON
179
+ end
180
180
  ```
181
181
 
182
- #### History
182
+ All of the above inherit from `Cent::Error`, so you can rescue that single class if you don't need to discriminate.
183
183
 
184
- Get channel history information (list of last messages published into channel).
185
-
186
- [history](https://centrifugal.dev/docs/server/server_api#history)
184
+ ## Token generation
187
185
 
188
186
  ```ruby
189
- client.history(channel: 'chat')
190
-
191
- # {
192
- # 'result' => {
193
- # 'publications' => [
194
- # {
195
- # 'data' => {
196
- # 'text' => 'hello'
197
- # }
198
- # },
199
- # {
200
- # 'data' => {
201
- # 'text' => 'hi!'
202
- # }
203
- # }
204
- # ]
205
- # }
206
- # }
187
+ notary = Cent::Notary.new(secret: 'hmac-secret') # HS256
188
+ notary = Cent::Notary.new(secret: rsa_private_key, algorithm: 'RS256') # RSA
189
+ notary = Cent::Notary.new(secret: ec_private_key, algorithm: 'ES256') # ECDSA
207
190
  ```
208
191
 
209
- #### Channels
210
-
211
- Get list of active(with one or more subscribers) channels.
192
+ ### Connection token
212
193
 
213
- [channels](https://centrifugal.dev/docs/server/server_api#channels)
194
+ Used by clients to establish a real-time connection. See [authentication](https://centrifugal.dev/docs/server/authentication).
214
195
 
215
196
  ```ruby
216
- client.channels
217
-
218
- # {
219
- # 'result' => {
220
- # 'channels' => [
221
- # 'chat'
222
- # ]
223
- # }
224
- # }
197
+ notary.issue_connection_token(sub: '42')
198
+ notary.issue_connection_token(sub: '42', exp: Time.now.to_i + 600, info: { name: 'Alex' })
199
+
200
+ # With any of the standard/Centrifugo claims:
201
+ notary.issue_connection_token(
202
+ sub: '42', exp: 1735689600, iat: 1735686000, jti: SecureRandom.uuid,
203
+ aud: 'centrifugo', iss: 'my-app',
204
+ info: { role: 'admin' }, meta: { tenant: 'acme' },
205
+ channels: %w[user:42 news],
206
+ subs: { 'room:1' => { 'data' => { 'welcome' => true } } }
207
+ )
225
208
  ```
226
209
 
227
- #### Info
228
-
229
- Get running Centrifugo nodes information.
210
+ ### Subscription token
230
211
 
231
- [info](https://centrifugal.dev/docs/server/server_api#info)
212
+ Used by clients to subscribe to a channel that requires token authorization. See [channel token auth](https://centrifugal.dev/docs/server/channel_token_auth).
232
213
 
233
214
  ```ruby
234
- client.info
235
-
236
- # {
237
- # 'result' => {
238
- # 'nodes' => [
239
- # {
240
- # 'name' => 'Alexanders-MacBook-Pro.local_8000',
241
- # 'num_channels' => 0,
242
- # 'num_clients' => 0,
243
- # 'num_users' => 0,
244
- # 'uid' => 'f844a2ed-5edf-4815-b83c-271974003db9',
245
- # 'uptime' => 0,
246
- # 'version' => ''
247
- # }
248
- # ]
249
- # }
250
- # }
215
+ notary.issue_channel_token(sub: '42', channel: 'private-chat', exp: 1735689600)
216
+ notary.issue_channel_token(
217
+ sub: '42', channel: 'private-chat',
218
+ info: { role: 'writer' },
219
+ override: { 'presence' => { 'value' => true } }
220
+ )
251
221
  ```
252
222
 
253
- ### Errors
223
+ ## Migrating from v3
254
224
 
255
- Network errors are not wrapped and will raise `Faraday::ClientError`.
225
+ v4 changes some aspects of the library. We expect smooth migration for happy path though.
256
226
 
257
- In cases when Centrifugo returns 200 with `error` key in the body we wrap it and return custom error:
227
+ - **Centrifugo v5+ is required.** v3 of this gem spoke the legacy `POST /api` JSON-RPC-style protocol; v4 uses the current per-method endpoints (`POST /api/publish`, `POST /api/broadcast`, …) and sends the API key as `X-API-Key` instead of `Authorization: apikey <key>`.
228
+ - **Error handling is unchanged for the common case.** `Cent::ResponseError` still exists and is still raised when Centrifugo returns a top-level API error. Existing `rescue Cent::ResponseError => e` blocks using `e.code` / `e.message` keep working. The new additions are typed transport errors — `Cent::TimeoutError`, `Cent::NetworkError`, `Cent::TransportError`, `Cent::UnauthorizedError`, `Cent::DecodeError` — all subclassed under `Cent::Error`.
229
+ - **Keyword arg rename**: `Cent::Notary#issue_channel_token(client:)` → `issue_channel_token(sub:)` to match Centrifugo's standard `sub` JWT claim.
230
+ - **Ruby 3.0+** is required (was 2.5+).
231
+ - **New methods** added for common Centrifugo operations: `subscribe`, `refresh`, `history_remove`, `batch`.
232
+ - **Richer kwargs** on existing methods (e.g. `publish` now accepts `tags`, `skip_history`, `idempotency_key`, `delta`, `version`, `version_epoch`, `b64data`; `history` accepts `limit`, `since`, `reverse`; `channels` accepts `pattern`).
258
233
 
259
- ```ruby
260
- # Raised when response from Centrifugo contains any error as result of API command execution.
261
- #
262
- begin
263
- client.publish(channel: 'channel', data: { foo: :bar })
264
- rescue Cent::ResponseError => ex
265
- ex.message # => "Invalid format"
266
- end
234
+ ## Development
235
+
236
+ ```sh
237
+ $ bin/setup # install dependencies
238
+ $ bundle exec rspec # run unit tests
239
+ $ bundle exec rubocop # lint
267
240
  ```
268
241
 
269
- ## Development
242
+ ### Running integration tests
270
243
 
271
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
244
+ Integration tests under `spec/integration/` exercise a real Centrifugo server. They're skipped unless `CENTRIFUGO_API_URL` is set.
272
245
 
273
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
246
+ ```sh
247
+ $ docker compose up -d
248
+ $ CENTRIFUGO_API_URL=http://localhost:8000/api CENTRIFUGO_API_KEY=api_key bundle exec rspec spec/integration
249
+ ```
274
250
 
275
- ## Contributing
251
+ ### Testing across Faraday / JWT versions
276
252
 
277
- Bug reports and pull requests are welcome on GitHub at https://github.com/centrifugal/rubycent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
253
+ ```sh
254
+ $ bundle exec appraisal install # generate gemfiles/*.gemfile.lock
255
+ $ bundle exec appraisal rspec # run the full matrix locally
256
+ ```
278
257
 
279
258
  ## License
280
259
 
281
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
260
+ MIT see [LICENSE.txt](LICENSE.txt).
data/cent.gemspec CHANGED
@@ -5,33 +5,32 @@ require_relative 'lib/cent/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'cent'
7
7
  spec.version = Cent::VERSION
8
- spec.authors = ['Sergey Prikhodko']
8
+ spec.authors = ['Sergey Prikhodko', 'Centrifugal Labs']
9
9
  spec.email = ['prikha@gmail.com']
10
10
 
11
- spec.summary = 'Centrifugo API V2 Ruby Client'
11
+ spec.summary = 'Centrifugo server API client for Ruby'
12
12
  spec.description = <<~DESC
13
- Provides helper classes Cent::Client and Cent::Notary.
14
-
15
- `Cent::Client` is made to communicate to the server API
16
- `Client::Notary` is a simple JWT wrapper to generate authorization tokens for the frontend
13
+ Ruby client for Centrifugo server HTTP API. Provides Cent::Client to call
14
+ Centrifugo server methods (publish, broadcast, subscribe, presence, history, ...)
15
+ and Cent::Notary to issue JWT connection and subscription tokens.
17
16
  DESC
18
17
  spec.homepage = 'https://github.com/centrifugal/rubycent'
19
18
  spec.license = 'MIT'
20
- spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
19
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.0')
21
20
 
22
- spec.metadata['homepage_uri'] = spec.homepage
23
21
  spec.metadata['source_code_uri'] = 'https://github.com/centrifugal/rubycent'
22
+ spec.metadata['changelog_uri'] = 'https://github.com/centrifugal/rubycent/releases'
23
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/centrifugal/rubycent/issues'
24
24
 
25
- # Specify which files should be added to the gem when it is released.
26
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
25
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:spec|Gemfile)/}) }
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{\A(?:spec|benchmarks|gemfiles|\.github)/}) ||
28
+ f.match(/\A(?:docker-compose\.yml|Appraisals|\.rubocop\.yml|\.rspec|\.gitignore)\z/)
29
+ end
29
30
  end
30
31
 
31
32
  spec.require_paths = ['lib']
32
33
 
33
- spec.add_dependency 'faraday', '<3.0.0', '> 1.0.0'
34
- # NOTE: Remove `faraday_middleware` after changing `faraday`'s minimum version to `2.0.0`.
35
- spec.add_dependency 'faraday_middleware', '<2.0.0', '~> 1.0'
36
- spec.add_dependency 'jwt', '~> 2.2'
34
+ spec.add_dependency 'faraday', '>= 2.0', '< 4'
35
+ spec.add_dependency 'jwt', '>= 2.2', '< 4'
37
36
  end