rabbitmq_http_api_client 2.0.0 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d150e442727e74f41f77d8683053124770d6f5aff55962d6a7a50ae27cfae5ab
4
- data.tar.gz: 79b440a0f074cb4a30802a4f7b92473b49aa90bc94a1abe530b04395f86fdd0a
3
+ metadata.gz: b27e07a1d996952430cd53fa4c8eb1fc942a0c9126274bbd4436db5274a69764
4
+ data.tar.gz: a4d4b7429098509a8d971c8ed994555d24e99eb827e87179113cb50bf009a4bf
5
5
  SHA512:
6
- metadata.gz: b992aa3b4b3a6d24f6008d165235358cdc2141e9f1fd710d8d76a03064ec553c948d38d7cfa76d22b31ffd740a4696cd85fd411514123fa4157fbf7f1d4c41cf
7
- data.tar.gz: ac715cfaac81c870b7898e5025253773bb7e8e51ceab96b35d50d2d3e43d0c2155297809907c18e0939a39aa9cd6c928b7901665b57b165002dc1f3bc375783f
6
+ metadata.gz: 85efb6fca0ae57d98876a8db4124852f1c4c7911f428c92aac4d5607c3c93e5466dd04d81f2df27d77a59929581d477469c5605e15e287e8cd73f51ae78a5fb0
7
+ data.tar.gz: a185c9007cc1f45e1f0d0f9d25d3ad4adf91f1ebfb72469a1eeec70448ef25a5502c383e319ccf218a72b005738782f1bfdc909ca6bc4ecb3ecc90c0a51ac143
data/ChangeLog.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## Changes Between 2.1.0 and 2.2.0 (in development)
2
+
3
+ No changes yet.
4
+
5
+
6
+ ## Changes Between 2.0.0 and 2.1.0 (February 12, 2022)
7
+
8
+ ### Handle Responses that Do Not Contain a Body
9
+
10
+ GitHub issue: [#52](https://github.com/ruby-amqp/rabbitmq_http_api_client/issues/52)
11
+
12
+ ### Support for Management of Topic Permissions
13
+
14
+ Contributed by @bagedevimo.
15
+
16
+ GitHub issue: [#57](https://github.com/ruby-amqp/rabbitmq_http_api_client/issues/57)
17
+
18
+ ### Upgraded Faraday Middleware
19
+
20
+ Faraday (a dependency) has been upgraded to `1.2.x` to eliminate some deprecation warnings.
21
+
22
+
1
23
  ## Changes Between 1.15.0 and 2.0.0 (May 21, 2021)
2
24
 
3
25
  ### Health Check Endpoint Changes
@@ -36,7 +58,7 @@ methods are now arrays of strings instead of comma-separated strings.
36
58
  Internally the method encodes both command-separated strings and JSON arrays in API responses
37
59
  to support response types from RabbitMQ 3.9 and earlier versions.
38
60
 
39
- See https://github.com/rabbitmq/rabbitmq-server/pull/2676 for details.
61
+ See [rabbitmq/rabbitmq-server#2676](https://github.com/rabbitmq/rabbitmq-server/pull/2676) for details.
40
62
 
41
63
  ## Changes Between 1.14.0 and 1.15.0 (February 16th, 2021)
42
64
  ### Content Length Detection Changes
@@ -48,6 +70,7 @@ Contributed by Ryan @rquant Quant.
48
70
 
49
71
  GitHub issue: [#49](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/49)
50
72
 
73
+
51
74
  ## Changes Between 1.13.0 and 1.14.0 (July 8th, 2020)
52
75
 
53
76
  ### URI.escape is No Longer Used
data/README.md CHANGED
@@ -23,7 +23,7 @@ and will support more HTTP API features in the future
23
23
 
24
24
  ## Supported RabbitMQ Versions
25
25
 
26
- * RabbitMQ 3.x
26
+ All [supported RabbitMQ release series](https://www.rabbitmq.com/versions.html).
27
27
 
28
28
  All versions require [RabbitMQ Management UI plugin](http://www.rabbitmq.com/management.html) to be installed and enabled.
29
29
 
@@ -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', '>= 1.15.0'
35
+ gem 'rabbitmq_http_api_client', '>= 2.0.0'
36
36
  ```
37
37
 
38
38
  And then execute:
@@ -13,7 +13,7 @@ module RabbitMQ
13
13
  end
14
14
 
15
15
  def decode_resource(response)
16
- if response.body.empty?
16
+ if response.nil? || response.body.empty?
17
17
  Hashie::Mash.new
18
18
  else
19
19
  decode_response_body(response.body)
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -299,7 +299,29 @@ module RabbitMQ
299
299
  decode_resource(@connection.delete("permissions/#{encode_uri_path_segment(vhost)}/#{encode_uri_path_segment(user)}"))
300
300
  end
301
301
 
302
+ def list_topic_permissions(vhost = nil, query = {})
303
+ path = if vhost
304
+ "vhosts/#{encode_uri_path_segment(vhost)}/topic-permissions"
305
+ else
306
+ "topic-permissions"
307
+ end
308
+
309
+ decode_resource_collection(@connection.get(path, query))
310
+ end
311
+
312
+ def list_topic_permissions_of(vhost, user)
313
+ path = "topic-permissions/#{encode_uri_path_segment(vhost)}/#{encode_uri_path_segment(user)}"
314
+ decode_resource_collection(@connection.get(path))
315
+ end
302
316
 
317
+ def update_topic_permissions_of(vhost, user, attributes)
318
+ response = @connection.put("topic-permissions/#{encode_uri_path_segment(vhost)}/#{encode_uri_path_segment(user)}") do |req|
319
+ req.headers['Content-Type'] = "application/json"
320
+ req.body = MultiJson.dump(attributes)
321
+ end
322
+
323
+ nil
324
+ end
303
325
 
304
326
  def list_users(query = {})
305
327
  results = decode_resource_collection(@connection.get("users", query))
@@ -420,7 +442,8 @@ module RabbitMQ
420
442
  adapter = options.delete(:adapter) || Faraday.default_adapter
421
443
 
422
444
  @connection = Faraday.new(options) do |conn|
423
- conn.basic_auth user, password
445
+ conn.request :basic_auth, user, password
446
+
424
447
  conn.use FaradayMiddleware::FollowRedirects, :limit => 3
425
448
  conn.use Faraday::Response::RaiseError
426
449
  conn.response :json, :content_type => /\bjson$/
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.0.0
4
+ version: 2.1.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: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2022-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '1.2'
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.0'
82
+ version: '1.2'
83
83
  description: RabbitMQ HTTP API client for Ruby
84
84
  email:
85
85
  - michael@clojurewerkz.org