rabbitmq_http_api_client 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a39be0a10b8f98fecdccfa407bf150811498cf8739ed6edef8cbf1b88b11bb2
4
- data.tar.gz: d5898d4b21ceed5c53abffcd251277cfdfd72c90665e4a0ed5f3f72c57578ffd
3
+ metadata.gz: b9fe9cd3da39f8ad9d88cab48895b67278e5df0e5df8f5a397660bc6c73af671
4
+ data.tar.gz: cd233d873f713a5ec50a751a8a58992920f3f03761c8f18b313207febf57acb3
5
5
  SHA512:
6
- metadata.gz: 2684a342bd54fc6fe432772e707f10562696b33b344eff100a2c3c1c0c017088e24eb59b31133e9020dd27698c22bb3f2c15619af411a95d5943eebc6946d9b1
7
- data.tar.gz: afd8403234f005f8b6f133dcaf8cf203b8bf94fe9c94f6d66f020965a088eae05067f89cbb7c04f02ccaa607d95dc692e9bad82788b378366019e22a9240a389
6
+ metadata.gz: a72745520c25dfbc6f5133dc6978b2ff4739ec3f8f56c4e344497a75f9716f7930d1c17fbf93f07a4e544818567d987f5d795ec2ede94e191a030627b2cb835a
7
+ data.tar.gz: 53c18efe60eec7b84f3e0738e6d7e04b76a796cdf6a15746fb9574cbf7becb5a379891fff9a9a8d88475df3e2bf619aa7d227ec6de872e37a5acaa66ba00152a
data/ChangeLog.md CHANGED
@@ -1,6 +1,26 @@
1
- ## Changes Between 2.2.0 and 2.3.0 (unreleased)
1
+ ## Changes Between 2.2.0 and 3.0.0 (July 20, 2024)
2
2
 
3
- No changes yet.
3
+ ### Why the Major Version Bump?
4
+
5
+ This release adopts a new major version of Faraday and targets
6
+ only [community supported RabbitMQ versions](https://www.rabbitmq.com/release-information),
7
+ which at this time means `3.13.x`.
8
+
9
+ While there are no major breaking changes in the library itself,
10
+ these two changes and more than two years that have passed since 2.0.0
11
+ warrant a major version bump.
12
+
13
+ ### Support for Faraday 2.x
14
+
15
+ Contributed by @shashankmehra.
16
+
17
+ GitHub issue: [#63](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/63)
18
+
19
+ ### Queue Deletion: Support for if-unused and if-empty
20
+
21
+ Contributed by @shashankmehra.
22
+
23
+ GitHub issue: [#62](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/62)
4
24
 
5
25
 
6
26
  ## Changes Between 2.1.0 and 2.2.0 (May 19, 2022)
data/README.md CHANGED
@@ -18,7 +18,7 @@ and will support more HTTP API features in the future
18
18
 
19
19
  ## Supported Ruby Versions
20
20
 
21
- * CRuby 2.2 through 2.7.x
21
+ * CRuby 2.5 through 3.x
22
22
  * JRuby 9K
23
23
 
24
24
  ## Supported RabbitMQ Versions
@@ -32,7 +32,7 @@ All versions require [RabbitMQ Management UI plugin](http://www.rabbitmq.com/man
32
32
  Add this line to your application's Gemfile:
33
33
 
34
34
  ``` ruby
35
- gem 'rabbitmq_http_api_client', '>= 2.0.0'
35
+ gem 'rabbitmq_http_api_client', '>= 2.2.0'
36
36
  ```
37
37
 
38
38
  And then execute:
@@ -116,7 +116,6 @@ h = client.overview
116
116
  # List cluster nodes with detailed status info for each one of them
117
117
  nodes = client.list_nodes
118
118
  n = nodes.first
119
- puts n.sockets_used
120
119
  puts n.mem_used
121
120
  puts n.run_queue
122
121
 
@@ -347,8 +346,21 @@ ps = client.clear_permissions_of("/", "guest")
347
346
 
348
347
  ## Running Tests
349
348
 
350
- bundle install
351
- bundle exec rspec -cfd spec
349
+ Before running the test suites, run a script that will set up the local node:
350
+
351
+ ``` shell
352
+ export RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL="rabbitmqctl"
353
+ export RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQ_PLUGINS="rabbitmq-plugins"
354
+
355
+ ./bin/ci/before_build.sh
356
+ ```
357
+
358
+ To run all specs:
359
+
360
+ ``` shell
361
+ bundle install
362
+ bundle exec rspec -cfd spec
363
+ ```
352
364
 
353
365
  The test suite assumes that RabbitMQ is running locally with stock settings
354
366
  and rabbitmq-management plugin enabled.
@@ -1,6 +1,6 @@
1
1
  require "hashie"
2
2
  require "faraday"
3
- require "faraday_middleware"
3
+ require "faraday/follow_redirects"
4
4
  require "multi_json"
5
5
  require "uri"
6
6
 
@@ -1,6 +1,6 @@
1
1
  require "hashie"
2
2
  require "faraday"
3
- require "faraday_middleware"
3
+ require "faraday/follow_redirects"
4
4
  require "multi_json"
5
5
  require "uri"
6
6
 
@@ -1,6 +1,6 @@
1
1
  require "hashie"
2
2
  require "faraday"
3
- require "faraday_middleware"
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 { |i| Hashie::Mash.new(i) }
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
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "2.2.0"
4
+ VERSION = "3.0.0"
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require "addressable/uri"
2
2
  require "hashie"
3
3
  require "faraday"
4
- require "faraday_middleware"
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
- decode_resource(@connection.delete("queues/#{encode_uri_path_segment(vhost)}/#{encode_uri_path_segment(name)}"))
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 :basic_auth, user, password
453
+ conn.request :authorization, :basic, user, password
450
454
 
451
- conn.use FaradayMiddleware::FollowRedirects, :limit => 3
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,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitmq_http_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klishin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-19 00:00:00.000000000 Z
11
+ date: 2024-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '2.9'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '2.9'
69
69
  - !ruby/object:Gem::Dependency
70
- name: faraday_middleware
70
+ name: faraday-follow_redirects
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.2'
75
+ version: '0.3'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.2'
82
+ version: '0.3'
83
83
  description: RabbitMQ HTTP API client for Ruby
84
84
  email:
85
85
  - michael@clojurewerkz.org
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.1.4
118
+ rubygems_version: 3.5.9
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: RabbitMQ HTTP API client for Ruby