rabbitmq_http_api_client 2.2.0 → 3.1.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 +4 -4
- data/ChangeLog.md +41 -1
- data/README.md +40 -18
- data/lib/rabbitmq/http/client/health_checks.rb +1 -1
- data/lib/rabbitmq/http/client/request_helper.rb +1 -1
- data/lib/rabbitmq/http/client/response_helper.rb +9 -3
- data/lib/rabbitmq/http/client/version.rb +1 -1
- data/lib/rabbitmq/http/client.rb +10 -6
- metadata +14 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 112665308e0fdad4c85aac225f8cfb3628a87361eec6636fd66d228fd3f217b2
|
|
4
|
+
data.tar.gz: 85d90413b2a24161eab37b3c6a66024743f0e49965ae49d853705838df086f95
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91fc2fa48278d2e272a09b685ed158be459e10e5da145fb66cca7ce276ba7027481a8a123b37920d766de9bebe001eb7b3fa79d0c68cee0a7ca87a613e9db2f3
|
|
7
|
+
data.tar.gz: b98f7a71da163fea31407b4f8fef74966d782ec6faacdf4fc63eef9960177d9d04b5b87281d437246c94d3a30fb6d372fc4bf322e47843e0f48969de4b9a08b4
|
data/ChangeLog.md
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
|
-
## Changes Between
|
|
1
|
+
## Changes Between 3.1.0 and 3.2.0 (in development)
|
|
2
2
|
|
|
3
3
|
No changes yet.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## Changes Between 3.0.0 and 3.1.0 (Nov 4, 2025)
|
|
7
|
+
|
|
8
|
+
### Dependency Updates
|
|
9
|
+
|
|
10
|
+
* `addressable` to `2.8`
|
|
11
|
+
* `faraday` to `2.14`
|
|
12
|
+
* `faraday-follow_redirects` to `0.4`
|
|
13
|
+
* `hashie` to `5.0`
|
|
14
|
+
* `multi_json` to `1.17`
|
|
15
|
+
|
|
16
|
+
Contributed by @fretb.
|
|
17
|
+
|
|
18
|
+
GitHub issue: [#67](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/67)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Changes Between 2.2.0 and 3.0.0 (July 20, 2024)
|
|
22
|
+
|
|
23
|
+
### Why the Major Version Bump?
|
|
24
|
+
|
|
25
|
+
This release adopts a new major version of Faraday and targets
|
|
26
|
+
only [community supported RabbitMQ versions](https://www.rabbitmq.com/release-information),
|
|
27
|
+
which at this time means `3.13.x`.
|
|
28
|
+
|
|
29
|
+
While there are no major breaking changes in the library itself,
|
|
30
|
+
these two changes and more than two years that have passed since 2.0.0
|
|
31
|
+
warrant a major version bump.
|
|
32
|
+
|
|
33
|
+
### Support for Faraday 2.x
|
|
34
|
+
|
|
35
|
+
Contributed by @shashankmehra.
|
|
36
|
+
|
|
37
|
+
GitHub issue: [#63](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/63)
|
|
38
|
+
|
|
39
|
+
### Queue Deletion: Support for if-unused and if-empty
|
|
40
|
+
|
|
41
|
+
Contributed by @shashankmehra.
|
|
42
|
+
|
|
43
|
+
GitHub issue: [#62](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/62)
|
|
44
|
+
|
|
45
|
+
|
|
6
46
|
## Changes Between 2.1.0 and 2.2.0 (May 19, 2022)
|
|
7
47
|
|
|
8
48
|
Test suite and CI automation changes.
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RabbitMQ HTTP API Client for Ruby
|
|
2
2
|
|
|
3
|
-
This gem is a [RabbitMQ HTTP API](
|
|
3
|
+
This gem is a [RabbitMQ HTTP API](https://www.rabbitmq.com/docs/http-api-reference) client for Ruby. It supports
|
|
4
4
|
|
|
5
5
|
* Getting cluster overview information
|
|
6
6
|
* Getting cluster nodes status (# file descriptors used, RAM consumption and so on)
|
|
@@ -18,30 +18,44 @@ and will support more HTTP API features in the future
|
|
|
18
18
|
|
|
19
19
|
## Supported Ruby Versions
|
|
20
20
|
|
|
21
|
-
* CRuby 2.
|
|
21
|
+
* CRuby 2.7 through 3.x
|
|
22
22
|
* JRuby 9K
|
|
23
23
|
|
|
24
24
|
## Supported RabbitMQ Versions
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
This library targets [RabbitMQ release series covered by community support](https://www.rabbitmq.com/release-information).
|
|
27
27
|
|
|
28
|
-
All versions require [
|
|
28
|
+
All versions require the [Management UI plugin](https://www.rabbitmq.com/docs/management/) to be enabled.
|
|
29
29
|
|
|
30
30
|
## Installation
|
|
31
31
|
|
|
32
|
-
Add this line to your application's Gemfile
|
|
32
|
+
Add this line to your application's Gemfile to
|
|
33
|
+
use the latest version of this library:
|
|
33
34
|
|
|
34
35
|
``` ruby
|
|
35
|
-
|
|
36
|
+
# Depends on Faraday 2.x
|
|
37
|
+
gem 'rabbitmq_http_api_client', '>= 3.1.0'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If you **absolutely must** use Faraday 1.x, use the 2.x series:
|
|
41
|
+
|
|
42
|
+
``` ruby
|
|
43
|
+
# Depends on Faraday 1.x.
|
|
44
|
+
# Consider using 3.0.0 and later versions.
|
|
45
|
+
gem 'rabbitmq_http_api_client', '~> 2.2.0'
|
|
36
46
|
```
|
|
37
47
|
|
|
38
48
|
And then execute:
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
``` shell
|
|
51
|
+
bundle install
|
|
52
|
+
```
|
|
41
53
|
|
|
42
|
-
Or install it
|
|
54
|
+
Or install it manually with:
|
|
43
55
|
|
|
44
|
-
|
|
56
|
+
``` shell
|
|
57
|
+
gem install rabbitmq_http_api_client
|
|
58
|
+
```
|
|
45
59
|
|
|
46
60
|
## Usage
|
|
47
61
|
|
|
@@ -116,7 +130,6 @@ h = client.overview
|
|
|
116
130
|
# List cluster nodes with detailed status info for each one of them
|
|
117
131
|
nodes = client.list_nodes
|
|
118
132
|
n = nodes.first
|
|
119
|
-
puts n.sockets_used
|
|
120
133
|
puts n.mem_used
|
|
121
134
|
puts n.run_queue
|
|
122
135
|
|
|
@@ -347,15 +360,24 @@ ps = client.clear_permissions_of("/", "guest")
|
|
|
347
360
|
|
|
348
361
|
## Running Tests
|
|
349
362
|
|
|
350
|
-
|
|
351
|
-
bundle exec rspec -cfd spec
|
|
363
|
+
Before running the test suites, run a script that will set up the local node:
|
|
352
364
|
|
|
353
|
-
|
|
354
|
-
|
|
365
|
+
``` shell
|
|
366
|
+
export RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL="/path/to/sbin/rabbitmqctl"
|
|
367
|
+
export RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQ_PLUGINS="/path/to/sbin/rabbitmq-plugins"
|
|
368
|
+
|
|
369
|
+
./bin/ci/before_build.sh
|
|
370
|
+
```
|
|
355
371
|
|
|
356
|
-
|
|
372
|
+
To run all specs:
|
|
357
373
|
|
|
358
|
-
|
|
374
|
+
``` shell
|
|
375
|
+
bundle install
|
|
376
|
+
bundle exec rspec -cfd spec
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
The test suite assumes that RabbitMQ is running locally with stock settings
|
|
380
|
+
and rabbitmq-management plugin enabled.
|
|
359
381
|
|
|
360
382
|
|
|
361
383
|
## Contributing
|
|
@@ -369,6 +391,6 @@ and rabbitmq-management plugin enabled.
|
|
|
369
391
|
|
|
370
392
|
## License & Copyright
|
|
371
393
|
|
|
372
|
-
Double-licensed under the MIT and Mozilla Public License (same as RabbitMQ).
|
|
394
|
+
Double-licensed under the MIT and the Mozilla Public License 2.0 ([same as RabbitMQ](https://github.com/rabbitmq/rabbitmq-server/blob/main/LICENSE)).
|
|
373
395
|
|
|
374
|
-
(c) Michael S. Klishin, 2012-
|
|
396
|
+
(c) Michael S. Klishin, 2012-2024.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "hashie"
|
|
2
2
|
require "faraday"
|
|
3
|
-
require "
|
|
3
|
+
require "faraday/follow_redirects"
|
|
4
4
|
require "multi_json"
|
|
5
5
|
require "uri"
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ module RabbitMQ
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def decode_resource(response)
|
|
16
|
-
if response.nil? || response.body.empty?
|
|
16
|
+
if response.nil? || response.body.nil? || response.body.empty?
|
|
17
17
|
Hashie::Mash.new
|
|
18
18
|
else
|
|
19
19
|
decode_response_body(response.body)
|
|
@@ -31,7 +31,13 @@ module RabbitMQ
|
|
|
31
31
|
def decode_resource_collection(response)
|
|
32
32
|
collection = response.body.is_a?(Array) ? response.body : response.body.fetch('items')
|
|
33
33
|
|
|
34
|
-
collection.map
|
|
34
|
+
collection.map do |i|
|
|
35
|
+
if i == []
|
|
36
|
+
Hashie::Mash.new()
|
|
37
|
+
else
|
|
38
|
+
Hashie::Mash.new(i)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
35
41
|
end
|
|
36
42
|
end
|
|
37
43
|
end
|
data/lib/rabbitmq/http/client.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "addressable/uri"
|
|
2
2
|
require "hashie"
|
|
3
3
|
require "faraday"
|
|
4
|
-
require "
|
|
4
|
+
require "faraday/follow_redirects"
|
|
5
5
|
require "multi_json"
|
|
6
6
|
require "uri"
|
|
7
7
|
|
|
@@ -177,8 +177,12 @@ module RabbitMQ
|
|
|
177
177
|
decode_resource(response)
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
-
def delete_queue(vhost, name)
|
|
181
|
-
|
|
180
|
+
def delete_queue(vhost, name, if_unused = false, if_empty = false)
|
|
181
|
+
response = @connection.delete("queues/#{encode_uri_path_segment(vhost)}/#{encode_uri_path_segment(name)}") do |req|
|
|
182
|
+
req.params["if-unused"] = true if if_unused
|
|
183
|
+
req.params["if-empty"] = true if if_empty
|
|
184
|
+
end
|
|
185
|
+
decode_resource(response)
|
|
182
186
|
end
|
|
183
187
|
|
|
184
188
|
def list_queue_bindings(vhost, queue, query = {})
|
|
@@ -443,12 +447,12 @@ module RabbitMQ
|
|
|
443
447
|
user = uri.user || options.delete(:username) || "guest"
|
|
444
448
|
password = uri.password || options.delete(:password) || "guest"
|
|
445
449
|
options = options.merge(:url => uri.to_s)
|
|
446
|
-
adapter = options.delete(:adapter) || Faraday.default_adapter
|
|
450
|
+
adapter = options.delete(:adapter) || Faraday.default_adapter || :httpclient
|
|
447
451
|
|
|
448
452
|
@connection = Faraday.new(options) do |conn|
|
|
449
|
-
conn.request :
|
|
453
|
+
conn.request :authorization, :basic, user, password
|
|
450
454
|
|
|
451
|
-
conn.use
|
|
455
|
+
conn.use Faraday::FollowRedirects::Middleware, :limit => 3
|
|
452
456
|
conn.use Faraday::Response::RaiseError
|
|
453
457
|
conn.response :json, :content_type => /\bjson$/
|
|
454
458
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rabbitmq_http_api_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Klishin
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: addressable
|
|
@@ -16,70 +15,70 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.
|
|
18
|
+
version: '2.8'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '2.
|
|
25
|
+
version: '2.8'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: hashie
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
30
|
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
32
|
+
version: '5.0'
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
39
|
+
version: '5.0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: multi_json
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
44
|
- - "~>"
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.
|
|
46
|
+
version: '1.17'
|
|
48
47
|
type: :runtime
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
51
|
- - "~>"
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.
|
|
53
|
+
version: '1.17'
|
|
55
54
|
- !ruby/object:Gem::Dependency
|
|
56
55
|
name: faraday
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
58
|
- - "~>"
|
|
60
59
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
60
|
+
version: '2.14'
|
|
62
61
|
type: :runtime
|
|
63
62
|
prerelease: false
|
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
64
|
requirements:
|
|
66
65
|
- - "~>"
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
67
|
+
version: '2.14'
|
|
69
68
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
69
|
+
name: faraday-follow_redirects
|
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
|
73
72
|
- - "~>"
|
|
74
73
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
74
|
+
version: '0.4'
|
|
76
75
|
type: :runtime
|
|
77
76
|
prerelease: false
|
|
78
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
78
|
requirements:
|
|
80
79
|
- - "~>"
|
|
81
80
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
81
|
+
version: '0.4'
|
|
83
82
|
description: RabbitMQ HTTP API client for Ruby
|
|
84
83
|
email:
|
|
85
84
|
- michael@clojurewerkz.org
|
|
@@ -100,7 +99,6 @@ licenses:
|
|
|
100
99
|
- MIT
|
|
101
100
|
- MPL-2.0
|
|
102
101
|
metadata: {}
|
|
103
|
-
post_install_message:
|
|
104
102
|
rdoc_options: []
|
|
105
103
|
require_paths:
|
|
106
104
|
- lib
|
|
@@ -115,8 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
115
113
|
- !ruby/object:Gem::Version
|
|
116
114
|
version: '0'
|
|
117
115
|
requirements: []
|
|
118
|
-
rubygems_version: 3.
|
|
119
|
-
signing_key:
|
|
116
|
+
rubygems_version: 3.6.7
|
|
120
117
|
specification_version: 4
|
|
121
118
|
summary: RabbitMQ HTTP API client for Ruby
|
|
122
119
|
test_files: []
|