rabbitmq_http_api_client 1.12.0 → 1.13.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: 4bb6d6b0972f2f811e0a010aa2c41b8fbf64d7d056b380e513848970290f9593
4
- data.tar.gz: 2ed34cedaf2289ec3c1d63ec10abedd91ce748e68996495867373db1f5e2a133
3
+ metadata.gz: d0b9cc95320a9b5267b3ca4e0c0afc635bc07d4b1a06d4a684568dc887f8538e
4
+ data.tar.gz: 6a99738452b35246c258b11e76b92b9d58be9ea184611600d677681677becc73
5
5
  SHA512:
6
- metadata.gz: 0d8e6de34019754d1b032b9cee0709504a6104bf9210031314b9535229ec2c85f129cce436c520947290ea58e6ba620bfd1c0fff6b805275833cad20d6f892e6
7
- data.tar.gz: 6e12a66d286621b511a2d20ea148cb90812c196222be39eed12d9d8c2ce42160fd2f893e3dbc2c521182c569cfb77caca9fca88e2492aec1da56da02b206d040
6
+ metadata.gz: 288d82241e7bcbf7ba6ec4fff269b0ad2f9bbdb4c6c51317675a3a29504926d793e8211489ab521f79237977770c96a49b1e1061f38c9af42b039c7185249edb
7
+ data.tar.gz: 2b2ecfc8fb8fe35522571bc836d77324ba20991afaacc4f151cece7efb856d537e0a7c3d0474a3b79fe695760e44073e4692ef0a9d3a73eb54f63ecf028869bd
@@ -1,7 +1,21 @@
1
- ## Changes Between 1.12.0 and 1.13.0 (unreleased)
1
+ ## Changes Between 1.12.0 and 1.13.0 (March 5th, 2020)
2
2
 
3
3
  No changes yet.
4
4
 
5
+ ## Changes Between 1.12.0 and 1.13.0 (March 5th, 2020)
6
+
7
+ ### Pagination Support
8
+
9
+ GitHub issue: [#43](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/43)
10
+
11
+ Contributed by Rustam Sharshenov.
12
+
13
+ ### Dependency Updates
14
+
15
+ GitHub issue: [#42](https://github.com/ruby-amqp/rabbitmq_http_api_client/pull/42)
16
+
17
+ Contributed by @hatch-carl.
18
+
5
19
 
6
20
  ## Changes Between 1.11.0 and 1.12.0 (March 12th, 2019)
7
21
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2017 Michael Klishin
1
+ Copyright (c) 2012-2019 Michael Klishin
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -20,7 +20,7 @@ and will support more HTTP API features in the future
20
20
 
21
21
  * CRuby 2.0 through 2.4.x
22
22
  * JRuby 9K
23
-
23
+
24
24
  ## Supported RabbitMQ Versions
25
25
 
26
26
  * RabbitMQ 3.x
@@ -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.11.0'
35
+ gem 'rabbitmq_http_api_client', '>= 1.12.0'
36
36
  ```
37
37
 
38
38
  And then execute:
@@ -127,7 +127,7 @@ puts n.proc_used
127
127
  puts n.fd_total
128
128
 
129
129
  # Get Management Plugin extension list
130
- xs = client.list_extensions
130
+ xs = client.list_extensions
131
131
 
132
132
  # List all the entities (vhosts, queues, exchanges, bindings, users, etc)
133
133
  defs = client.list_definitions
@@ -259,7 +259,7 @@ puts b.vhost
259
259
  # List all bindings in a vhost
260
260
  bs = client.list_bindings("/")
261
261
 
262
- # List all binsings between an exchange and a queue
262
+ # List all bindings between an exchange and a queue
263
263
  bs = client.list_bindings_between_queue_and_exchange("/", "collector1.megacorp.local", "log.events")
264
264
  ```
265
265
 
@@ -371,5 +371,4 @@ and rabbitmq-management plugin enabled.
371
371
 
372
372
  Double-licensed under the MIT and Mozilla Public License (same as RabbitMQ).
373
373
 
374
- (c) Michael S. Klishin, 2012-2017.
375
-
374
+ (c) Michael S. Klishin, 2012-2019.
@@ -57,16 +57,16 @@ module RabbitMQ
57
57
  reduce(Hash.new) { |acc, lnr| acc[lnr.protocol] = lnr.port; acc }
58
58
  end
59
59
 
60
- def list_nodes
61
- decode_resource_collection(@connection.get("nodes"))
60
+ def list_nodes(query = {})
61
+ decode_resource_collection(@connection.get("nodes", query))
62
62
  end
63
63
 
64
64
  def node_info(name)
65
65
  decode_resource(@connection.get("nodes/#{uri_encode(name)}"))
66
66
  end
67
67
 
68
- def list_extensions
69
- decode_resource_collection(@connection.get("extensions"))
68
+ def list_extensions(query = {})
69
+ decode_resource_collection(@connection.get("extensions", query))
70
70
  end
71
71
 
72
72
  def list_definitions
@@ -81,8 +81,8 @@ module RabbitMQ
81
81
  response.success?
82
82
  end
83
83
 
84
- def list_connections
85
- decode_resource_collection(@connection.get("connections"))
84
+ def list_connections(query = {})
85
+ decode_resource_collection(@connection.get("connections", query))
86
86
  end
87
87
 
88
88
  def connection_info(name)
@@ -93,22 +93,22 @@ module RabbitMQ
93
93
  decode_resource(@connection.delete("connections/#{uri_encode(name)}"))
94
94
  end
95
95
 
96
- def list_channels
97
- decode_resource_collection(@connection.get("channels"))
96
+ def list_channels(query = {})
97
+ decode_resource_collection(@connection.get("channels", query))
98
98
  end
99
99
 
100
100
  def channel_info(name)
101
101
  decode_resource(@connection.get("channels/#{uri_encode(name)}"))
102
102
  end
103
103
 
104
- def list_exchanges(vhost = nil)
104
+ def list_exchanges(vhost = nil, query = {})
105
105
  path = if vhost.nil?
106
106
  "exchanges"
107
107
  else
108
108
  "exchanges/#{uri_encode(vhost)}"
109
109
  end
110
110
 
111
- decode_resource_collection(@connection.get(path))
111
+ decode_resource_collection(@connection.get(path, query))
112
112
  end
113
113
 
114
114
  def declare_exchange(vhost, name, attributes = {})
@@ -137,22 +137,22 @@ module RabbitMQ
137
137
  decode_resource(@connection.get("exchanges/#{uri_encode(vhost)}/#{uri_encode(name)}"))
138
138
  end
139
139
 
140
- def list_bindings_by_source(vhost, exchange)
141
- decode_resource_collection(@connection.get("exchanges/#{uri_encode(vhost)}/#{uri_encode(exchange)}/bindings/source"))
140
+ def list_bindings_by_source(vhost, exchange, query = {})
141
+ decode_resource_collection(@connection.get("exchanges/#{uri_encode(vhost)}/#{uri_encode(exchange)}/bindings/source", query))
142
142
  end
143
143
 
144
- def list_bindings_by_destination(vhost, exchange)
145
- decode_resource_collection(@connection.get("exchanges/#{uri_encode(vhost)}/#{uri_encode(exchange)}/bindings/destination"))
144
+ def list_bindings_by_destination(vhost, exchange, query = {})
145
+ decode_resource_collection(@connection.get("exchanges/#{uri_encode(vhost)}/#{uri_encode(exchange)}/bindings/destination", query))
146
146
  end
147
147
 
148
- def list_queues(vhost = nil)
148
+ def list_queues(vhost = nil, query = {})
149
149
  path = if vhost.nil?
150
150
  "queues"
151
151
  else
152
152
  "queues/#{uri_encode(vhost)}"
153
153
  end
154
154
 
155
- decode_resource_collection(@connection.get(path))
155
+ decode_resource_collection(@connection.get(path, query))
156
156
  end
157
157
 
158
158
  def queue_info(vhost, name)
@@ -171,8 +171,8 @@ module RabbitMQ
171
171
  decode_resource(@connection.delete("queues/#{uri_encode(vhost)}/#{uri_encode(name)}"))
172
172
  end
173
173
 
174
- def list_queue_bindings(vhost, queue)
175
- decode_resource_collection(@connection.get("queues/#{uri_encode(vhost)}/#{uri_encode(queue)}/bindings"))
174
+ def list_queue_bindings(vhost, queue, query = {})
175
+ decode_resource_collection(@connection.get("queues/#{uri_encode(vhost)}/#{uri_encode(queue)}/bindings", query))
176
176
  end
177
177
 
178
178
  def purge_queue(vhost, name)
@@ -188,18 +188,18 @@ module RabbitMQ
188
188
  decode_resource_collection(response)
189
189
  end
190
190
 
191
- def list_bindings(vhost = nil)
191
+ def list_bindings(vhost = nil, query = {})
192
192
  path = if vhost.nil?
193
193
  "bindings"
194
194
  else
195
195
  "bindings/#{uri_encode(vhost)}"
196
196
  end
197
197
 
198
- decode_resource_collection(@connection.get(path))
198
+ decode_resource_collection(@connection.get(path, query))
199
199
  end
200
200
 
201
- def list_bindings_between_queue_and_exchange(vhost, queue, exchange)
202
- decode_resource_collection(@connection.get("bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}"))
201
+ def list_bindings_between_queue_and_exchange(vhost, queue, exchange, query = {})
202
+ decode_resource_collection(@connection.get("bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}", query))
203
203
  end
204
204
 
205
205
  def queue_binding_info(vhost, queue, exchange, properties_key)
@@ -219,8 +219,8 @@ module RabbitMQ
219
219
  resp.success?
220
220
  end
221
221
 
222
- def list_bindings_between_exchanges(vhost, destination_exchange, source_exchange)
223
- decode_resource_collection(@connection.get("bindings/#{uri_encode(vhost)}/e/#{uri_encode(source_exchange)}/e/#{uri_encode(destination_exchange)}"))
222
+ def list_bindings_between_exchanges(vhost, destination_exchange, source_exchange, query = {})
223
+ decode_resource_collection(@connection.get("bindings/#{uri_encode(vhost)}/e/#{uri_encode(source_exchange)}/e/#{uri_encode(destination_exchange)}", query))
224
224
  end
225
225
 
226
226
  def exchange_binding_info(vhost, destination_exchange, source_exchange, properties_key)
@@ -242,8 +242,8 @@ module RabbitMQ
242
242
  end
243
243
 
244
244
 
245
- def list_vhosts
246
- decode_resource_collection(@connection.get("vhosts"))
245
+ def list_vhosts(query = {})
246
+ decode_resource_collection(@connection.get("vhosts", query))
247
247
  end
248
248
 
249
249
  def vhost_info(name)
@@ -263,14 +263,14 @@ module RabbitMQ
263
263
 
264
264
 
265
265
 
266
- def list_permissions(vhost = nil)
266
+ def list_permissions(vhost = nil, query = {})
267
267
  path = if vhost
268
268
  "vhosts/#{uri_encode(vhost)}/permissions"
269
269
  else
270
270
  "permissions"
271
271
  end
272
272
 
273
- decode_resource_collection(@connection.get(path))
273
+ decode_resource_collection(@connection.get(path, query))
274
274
  end
275
275
 
276
276
  def list_permissions_of(vhost, user)
@@ -291,8 +291,8 @@ module RabbitMQ
291
291
 
292
292
 
293
293
 
294
- def list_users
295
- decode_resource_collection(@connection.get("users"))
294
+ def list_users(query = {})
295
+ decode_resource_collection(@connection.get("users", query))
296
296
  end
297
297
 
298
298
  def user_info(name)
@@ -314,8 +314,8 @@ module RabbitMQ
314
314
  decode_resource(@connection.delete("users/#{uri_encode(name)}"))
315
315
  end
316
316
 
317
- def user_permissions(name)
318
- decode_resource_collection(@connection.get("users/#{uri_encode(name)}/permissions"))
317
+ def user_permissions(name, query = {})
318
+ decode_resource_collection(@connection.get("users/#{uri_encode(name)}/permissions", query))
319
319
  end
320
320
 
321
321
  def whoami
@@ -324,23 +324,23 @@ module RabbitMQ
324
324
 
325
325
 
326
326
 
327
- def list_policies(vhost = nil)
327
+ def list_policies(vhost = nil, query = {})
328
328
  path = if vhost
329
329
  "policies/#{uri_encode(vhost)}"
330
330
  else
331
331
  "policies"
332
332
  end
333
333
 
334
- decode_resource_collection(@connection.get(path))
334
+ decode_resource_collection(@connection.get(path, query))
335
335
  end
336
336
 
337
- def list_policies_of(vhost, name = nil)
337
+ def list_policies_of(vhost, name = nil, query = {})
338
338
  path = if name
339
339
  "policies/#{uri_encode(vhost)}/#{uri_encode(name)}"
340
340
  else
341
341
  "policies/#{uri_encode(vhost)}"
342
342
  end
343
- decode_resource_collection(@connection.get(path))
343
+ decode_resource_collection(@connection.get(path, query))
344
344
  end
345
345
 
346
346
  def update_policies_of(vhost, name, attributes)
@@ -358,22 +358,22 @@ module RabbitMQ
358
358
 
359
359
 
360
360
 
361
- def list_parameters(component = nil)
361
+ def list_parameters(component = nil, query = {})
362
362
  path = if component
363
363
  "parameters/#{uri_encode(component)}"
364
364
  else
365
365
  "parameters"
366
366
  end
367
- decode_resource_collection(@connection.get(path))
367
+ decode_resource_collection(@connection.get(path, query))
368
368
  end
369
369
 
370
- def list_parameters_of(component, vhost, name = nil)
370
+ def list_parameters_of(component, vhost, name = nil, query = {})
371
371
  path = if name
372
372
  "parameters/#{uri_encode(component)}/#{uri_encode(vhost)}/#{uri_encode(name)}"
373
373
  else
374
374
  "parameters/#{uri_encode(component)}/#{uri_encode(vhost)}"
375
375
  end
376
- decode_resource_collection(@connection.get(path))
376
+ decode_resource_collection(@connection.get(path, query))
377
377
  end
378
378
 
379
379
  def update_parameters_of(component, vhost, name, attributes)
@@ -436,7 +436,9 @@ module RabbitMQ
436
436
  end
437
437
 
438
438
  def decode_resource_collection(response)
439
- response.body.map { |i| Hashie::Mash.new(i) }
439
+ collection = response.body.is_a?(Array) ? response.body : response.body.fetch('items')
440
+
441
+ collection.map { |i| Hashie::Mash.new(i) }
440
442
  end
441
443
  end # Client
442
444
  end # HTTP
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "1.12.0"
4
+ VERSION = "1.13.0"
5
5
  end
6
6
  end
7
7
  end
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: 1.12.0
4
+ version: 1.13.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: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2020-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -42,30 +42,42 @@ dependencies:
42
42
  name: faraday
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0.15'
48
+ - - "<"
46
49
  - !ruby/object:Gem::Version
47
- version: 0.15.4
50
+ version: '1'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0.15'
58
+ - - "<"
53
59
  - !ruby/object:Gem::Version
54
- version: 0.15.4
60
+ version: '1'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: faraday_middleware
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - "~>"
65
+ - - ">="
60
66
  - !ruby/object:Gem::Version
61
67
  version: 0.13.0
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '1'
62
71
  type: :runtime
63
72
  prerelease: false
64
73
  version_requirements: !ruby/object:Gem::Requirement
65
74
  requirements:
66
- - - "~>"
75
+ - - ">="
67
76
  - !ruby/object:Gem::Version
68
77
  version: 0.13.0
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '1'
69
81
  description: RabbitMQ HTTP API client for Ruby
70
82
  email:
71
83
  - michael@clojurewerkz.org
@@ -98,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
110
  - !ruby/object:Gem::Version
99
111
  version: '0'
100
112
  requirements: []
101
- rubygems_version: 3.0.2
113
+ rubygems_version: 3.0.3
102
114
  signing_key:
103
115
  specification_version: 4
104
116
  summary: RabbitMQ HTTP API client for Ruby