rabbitmq_http_api_client 0.2.0.pre1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ## Changes Between 0.1.0 and 0.2.0
2
2
 
3
- No changes yet.
3
+ ### Support for more HTTP API operations
4
+
5
+ * Operations on queues
6
+ * Operations on users
7
+ * Operations on permissions
8
+ * Operations on parameters
9
+ * Operations on policies
4
10
 
5
11
 
6
12
  ## Original Release: 0.1.0
data/README.md CHANGED
@@ -33,7 +33,7 @@ All versions require [RabbitMQ Management UI plugin](http://www.rabbitmq.com/man
33
33
 
34
34
  Add this line to your application's Gemfile:
35
35
 
36
- gem 'veterinarian'
36
+ gem 'rabbitmq_http_api_client'
37
37
 
38
38
  And then execute:
39
39
 
@@ -41,7 +41,7 @@ And then execute:
41
41
 
42
42
  Or install it yourself as:
43
43
 
44
- $ gem install veterinarian
44
+ $ gem install rabbitmq_http_api_client
45
45
 
46
46
  ## Usage
47
47
 
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "0.2.0.pre1"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
@@ -42,7 +42,7 @@ module RabbitMQ
42
42
  end
43
43
 
44
44
  def list_definitions
45
- decode_resource_collection(@connection.get("/api/definitions"))
45
+ decode_resource(@connection.get("/api/definitions"))
46
46
  end
47
47
 
48
48
  def upload_definitions(defs)
@@ -106,15 +106,31 @@ module RabbitMQ
106
106
  end
107
107
 
108
108
  def declare_queue(vhost, name, attributes)
109
- raise NotImplementedError.new
109
+ response = @connection.put("/api/queues/#{uri_encode(vhost)}/#{uri_encode(name)}") do |req|
110
+ req.headers['Content-Type'] = "application/json"
111
+ req.body = MultiJson.dump(attributes)
112
+ end
113
+ decode_resource(response)
110
114
  end
111
115
 
112
116
  def delete_queue(vhost, name)
113
- raise NotImplementedError.new
117
+ decode_resource(@connection.delete("/api/queues/#{uri_encode(vhost)}/#{uri_encode(name)}"))
118
+ end
119
+
120
+ def list_queue_bindings(vhost, queue)
121
+ decode_resource_collection(@connection.get("/api/queues/#{uri_encode(vhost)}/#{uri_encode(queue)}/bindings"))
114
122
  end
115
123
 
116
124
  def purge_queue(vhost, name)
117
- raise NotImplementedError.new
125
+ decode_resource(@connection.delete("/api/queues/#{uri_encode(vhost)}/#{uri_encode(name)}/contents"))
126
+ end
127
+
128
+ def get_messages(vhost, name, options)
129
+ response = @connection.post("/api/queues/#{uri_encode(vhost)}/#{uri_encode(name)}/get") do |req|
130
+ req.headers['Content-Type'] = "application/json"
131
+ req.body = MultiJson.dump(options)
132
+ end
133
+ decode_resource_collection(response)
118
134
  end
119
135
 
120
136
 
@@ -128,6 +144,13 @@ module RabbitMQ
128
144
  decode_resource_collection(@connection.get(path))
129
145
  end
130
146
 
147
+ def list_bindings_between_queue_and_exchange(vhost, queue, exchange)
148
+ decode_resource_collection(@connection.get("/api/bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}"))
149
+ end
150
+
151
+
152
+
153
+
131
154
  def list_vhosts
132
155
  decode_resource_collection(@connection.get("/api/vhosts"))
133
156
  end
@@ -136,21 +159,140 @@ module RabbitMQ
136
159
  decode_resource(@connection.get("/api/vhosts/#{uri_encode(name)}"))
137
160
  end
138
161
 
162
+ def create_vhost(name)
163
+ response = @connection.put("/api/vhosts/#{uri_encode(name)}") do |req|
164
+ req.headers['Content-Type'] = "application/json"
165
+ end
166
+ decode_resource(response)
167
+ end
168
+
169
+ def delete_vhost(name)
170
+ decode_resource(@connection.delete("/api/vhosts/#{uri_encode(name)}"))
171
+ end
172
+
173
+
174
+
175
+ def list_permissions(vhost = nil)
176
+ path = if vhost
177
+ "/api/vhosts/#{uri_encode(vhost)}/permissions"
178
+ else
179
+ "/api/permissions"
180
+ end
181
+
182
+ decode_resource_collection(@connection.get(path))
183
+ end
184
+
185
+ def list_permissions_of(vhost, user)
186
+ decode_resource(@connection.get("/api/permissions/#{uri_encode(vhost)}/#{uri_encode(user)}"))
187
+ end
188
+
189
+ def update_permissions_of(vhost, user, attributes)
190
+ response = @connection.put("/api/permissions/#{uri_encode(vhost)}/#{uri_encode(user)}") do |req|
191
+ req.headers['Content-Type'] = "application/json"
192
+ req.body = MultiJson.dump(attributes)
193
+ end
194
+ decode_resource(response)
195
+ end
196
+
197
+ def clear_permissions_of(vhost, user)
198
+ decode_resource(@connection.delete("/api/permissions/#{uri_encode(vhost)}/#{uri_encode(user)}"))
199
+ end
200
+
139
201
 
140
202
 
141
203
  def list_users
142
204
  decode_resource_collection(@connection.get("/api/users"))
143
205
  end
144
206
 
207
+ def user_info(name)
208
+ decode_resource(@connection.get("/api/users/#{uri_encode(name)}"))
209
+ end
210
+
211
+ def update_user(name, attributes)
212
+ response = @connection.put("/api/users/#{uri_encode(name)}") do |req|
213
+ req.headers['Content-Type'] = "application/json"
214
+ req.body = MultiJson.dump(attributes)
215
+ end
216
+ decode_resource(response)
217
+ end
218
+ alias create_user update_user
219
+
220
+ def delete_user(name)
221
+ decode_resource(@connection.delete("/api/users/#{uri_encode(name)}"))
222
+ end
145
223
 
224
+ def user_permissions(name)
225
+ decode_resource_collection(@connection.get("/api/users/#{uri_encode(name)}/permissions"))
226
+ end
146
227
 
147
- def list_policies
148
- decode_resource_collection(@connection.get("/api/policies"))
228
+ def whoami
229
+ decode_resource(@connection.get("/api/whoami"))
149
230
  end
150
231
 
151
232
 
152
- def list_parameters
153
- decode_resource_collection(@connection.get("/api/parameters"))
233
+
234
+ def list_policies(vhost = nil)
235
+ path = if vhost
236
+ "/api/policies/#{uri_encode(vhost)}"
237
+ else
238
+ "/api/policies"
239
+ end
240
+
241
+ decode_resource_collection(@connection.get(path))
242
+ end
243
+
244
+ def list_policies_of(vhost, name = nil)
245
+ path = if name
246
+ "/api/policies/#{uri_encode(vhost)}/#{uri_encode(name)}"
247
+ else
248
+ "/api/policies/#{uri_encode(vhost)}"
249
+ end
250
+ decode_resource_collection(@connection.get(path))
251
+ end
252
+
253
+ def update_policies_of(vhost, name, attributes)
254
+ response = @connection.put("/api/policies/#{uri_encode(vhost)}/#{uri_encode(name)}") do |req|
255
+ req.headers['Content-Type'] = "application/json"
256
+ req.body = MultiJson.dump(attributes)
257
+ end
258
+ decode_resource(response)
259
+ end
260
+
261
+ def clear_policies_of(vhost, name)
262
+ decode_resource(@connection.delete("/api/policies/#{uri_encode(vhost)}/#{uri_encode(name)}"))
263
+ end
264
+
265
+
266
+
267
+
268
+ def list_parameters(component = nil)
269
+ path = if component
270
+ "/api/parameters/#{uri_encode(component)}"
271
+ else
272
+ "/api/parameters"
273
+ end
274
+ decode_resource_collection(@connection.get(path))
275
+ end
276
+
277
+ def list_parameters_of(component, vhost, name = nil)
278
+ path = if name
279
+ "/api/parameters/#{uri_encode(component)}/#{uri_encode(vhost)}/#{uri_encode(name)}"
280
+ else
281
+ "/api/parameters/#{uri_encode(component)}/#{uri_encode(vhost)}"
282
+ end
283
+ decode_resource_collection(@connection.get(path))
284
+ end
285
+
286
+ def update_parameters_of(component, vhost, name, attributes)
287
+ response = @connection.put("/api/parameters/#{uri_encode(component)}/#{uri_encode(vhost)}/#{uri_encode(name)}") do |req|
288
+ req.headers['Content-Type'] = "application/json"
289
+ req.body = MultiJson.dump(attributes)
290
+ end
291
+ decode_resource(response)
292
+ end
293
+
294
+ def clear_parameters_of(component, vhost, name)
295
+ decode_resource(@connection.delete("/api/parameters/#{uri_encode(component)}/#{uri_encode(vhost)}/#{uri_encode(name)}"))
154
296
  end
155
297
 
156
298
 
@@ -1,12 +1,21 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe RabbitMQ::HTTP::Client do
4
- let(:endpoint) { "http://127.0.0.1:55672" }
4
+ let(:endpoint) { "http://127.0.0.1:15672" }
5
5
 
6
6
  subject do
7
7
  described_class.connect(endpoint, :username => "guest", :password => "guest")
8
8
  end
9
9
 
10
+ before :all do
11
+ @connection = Bunny.new
12
+ @connection.start
13
+ end
14
+
15
+ after :all do
16
+ @connection.close
17
+ end
18
+
10
19
 
11
20
  #
12
21
  # Overview
@@ -94,11 +103,19 @@ describe RabbitMQ::HTTP::Client do
94
103
  #
95
104
 
96
105
  describe "GET /api/definitions" do
106
+ it "returns a list of all resources/definitions (vhosts, users, permissions, queues, exchanges, bindings, etc)" do
107
+ xs = subject.list_definitions
97
108
 
109
+ xs.bindings.should be_instance_of(Array)
110
+ xs.queues.should be_instance_of(Array)
111
+ xs.exchanges.should be_instance_of(Array)
112
+ xs.users.should be_instance_of(Array)
113
+ xs.vhosts.should be_instance_of(Array)
114
+ end
98
115
  end
99
116
 
100
117
  describe "POST /api/definitions" do
101
-
118
+ it "uploads definitions to RabbitMQ"
102
119
  end
103
120
 
104
121
  #
@@ -110,9 +127,6 @@ describe RabbitMQ::HTTP::Client do
110
127
  @connection = Bunny.new
111
128
  @connection.start
112
129
  end
113
- after :all do
114
- @connection.close
115
- end
116
130
 
117
131
  it "returns a list of all active connections" do
118
132
  xs = subject.list_connections
@@ -124,14 +138,6 @@ describe RabbitMQ::HTTP::Client do
124
138
  end
125
139
 
126
140
  describe "GET /api/connections/:name" do
127
- before :all do
128
- @connection = Bunny.new
129
- @connection.start
130
- end
131
- after :all do
132
- @connection.close
133
- end
134
-
135
141
  it "returns information about the connection" do
136
142
  xs = subject.list_connections
137
143
  c = subject.connection_info(xs.first.name)
@@ -142,15 +148,6 @@ describe RabbitMQ::HTTP::Client do
142
148
  end
143
149
 
144
150
  describe "DELETE /api/connections/:name" do
145
- before :all do
146
- @connection = Bunny.new
147
- @connection.start
148
- end
149
- after :all do
150
- @connection.close if @connection.open?
151
- end
152
-
153
-
154
151
  it "closes the connection" do
155
152
  pending "Needs investigation, DELETE does not seem to close the connection"
156
153
  xs = subject.list_connections
@@ -170,13 +167,8 @@ describe RabbitMQ::HTTP::Client do
170
167
 
171
168
  describe "GET /api/channels" do
172
169
  before :all do
173
- @connection = Bunny.new
174
- @connection.start
175
170
  @channel = @connection.create_channel
176
171
  end
177
- after :all do
178
- @connection.close
179
- end
180
172
 
181
173
  it "returns a list of all active channels" do
182
174
  xs = subject.list_channels
@@ -189,13 +181,8 @@ describe RabbitMQ::HTTP::Client do
189
181
 
190
182
  describe "GET /api/channels/:name" do
191
183
  before :all do
192
- @connection = Bunny.new
193
- @connection.start
194
184
  @channel = @connection.create_channel
195
185
  end
196
- after :all do
197
- @connection.close
198
- end
199
186
 
200
187
  it "returns information about the channel" do
201
188
  xs = subject.list_channels
@@ -247,13 +234,8 @@ describe RabbitMQ::HTTP::Client do
247
234
 
248
235
  describe "GET /api/exchanges/:vhost/:name/bindings/source" do
249
236
  before :all do
250
- @connection = Bunny.new
251
- @connection.start
252
237
  @channel = @connection.create_channel
253
238
  end
254
- after :all do
255
- @connection.close
256
- end
257
239
 
258
240
  it "returns a list of all bindings in which the given exchange is the source" do
259
241
  e = @channel.fanout("http.api.tests.fanout", :durable => true)
@@ -277,13 +259,8 @@ describe RabbitMQ::HTTP::Client do
277
259
 
278
260
  describe "GET /api/exchanges/:vhost/:name/bindings/destination" do
279
261
  before :all do
280
- @connection = Bunny.new
281
- @connection.start
282
262
  @channel = @connection.create_channel
283
263
  end
284
- after :all do
285
- @connection.close
286
- end
287
264
 
288
265
  it "returns a list of all bindings in which the given exchange is the source" do
289
266
  e1 = @channel.fanout("http.api.tests.fanout1", :durable => true)
@@ -312,13 +289,8 @@ describe RabbitMQ::HTTP::Client do
312
289
 
313
290
  describe "GET /api/queues" do
314
291
  before :all do
315
- @connection = Bunny.new
316
- @connection.start
317
292
  @channel = @connection.create_channel
318
293
  end
319
- after :all do
320
- @connection.close
321
- end
322
294
 
323
295
  it "returns a list of all queues" do
324
296
  q = @channel.queue("", :exclusive => true)
@@ -330,13 +302,8 @@ describe RabbitMQ::HTTP::Client do
330
302
 
331
303
  describe "GET /api/queues/:vhost" do
332
304
  before :all do
333
- @connection = Bunny.new
334
- @connection.start
335
305
  @channel = @connection.create_channel
336
306
  end
337
- after :all do
338
- @connection.close
339
- end
340
307
 
341
308
  it "returns a list of all queues" do
342
309
  q = @channel.queue("", :exclusive => true)
@@ -348,13 +315,8 @@ describe RabbitMQ::HTTP::Client do
348
315
 
349
316
  describe "GET /api/queues/:vhost/:name" do
350
317
  before :all do
351
- @connection = Bunny.new
352
- @connection.start
353
318
  @channel = @connection.create_channel
354
319
  end
355
- after :all do
356
- @connection.close
357
- end
358
320
 
359
321
  it "returns information about a queue" do
360
322
  q = @channel.queue("", :exclusive => true, :durable => false)
@@ -372,31 +334,98 @@ describe RabbitMQ::HTTP::Client do
372
334
 
373
335
  describe "PUT /api/queues/:vhost/:name" do
374
336
  before :all do
375
- @connection = Bunny.new
376
- @connection.start
377
337
  @channel = @connection.create_channel
378
338
  end
379
- after :all do
380
- @connection.close
381
- end
382
339
 
383
- it "declares a queue"
340
+ let(:queue_name) { "httpdeclared" }
341
+
342
+ it "declares a queue" do
343
+ subject.declare_queue("/", queue_name, :durable => false, :auto_delete => true)
344
+
345
+ q = @channel.queue(queue_name, :durable => false, :auto_delete => true)
346
+ q.delete
347
+ end
384
348
  end
385
349
 
386
350
  describe "DELETE /api/queues/:vhost/:name" do
387
- it "deletes a queue"
351
+ before :all do
352
+ @channel = @connection.create_channel
353
+ end
354
+
355
+ let(:queue_name) { "httpdeclared" }
356
+
357
+ it "deletes a queue" do
358
+ q = @channel.queue(queue_name, :durable => false)
359
+ subject.delete_queue("/", queue_name)
360
+ end
388
361
  end
389
362
 
390
363
  describe "GET /api/queues/:vhost/:name/bindings" do
391
- it "returns a list of bindings for a queue"
364
+ before :all do
365
+ @channel = @connection.create_channel
366
+ end
367
+
368
+ it "returns a list of bindings for a queue" do
369
+ q = @channel.queue("")
370
+ q.bind("amq.fanout")
371
+
372
+ xs = subject.list_queue_bindings("/", q.name)
373
+ x = xs.first
374
+
375
+ x.destination.should == q.name
376
+ x.destination_type.should == "queue"
377
+ end
392
378
  end
393
379
 
394
380
  describe "DELETE /api/queues/:vhost/:name/contents" do
395
- it "purges a queue"
381
+ before :all do
382
+ @channel = @connection.create_channel
383
+ end
384
+
385
+ it "purges a queue" do
386
+ q = @channel.queue("")
387
+ x = @channel.fanout("amq.fanout", :durable => true, :auto_delete => false)
388
+ q.bind(x)
389
+
390
+ 10.times do
391
+ x.publish("", :routing_key => q.name)
392
+ end
393
+ sleep 0.7
394
+
395
+ q.message_count.should == 10
396
+ subject.purge_queue("/", q.name)
397
+ sleep 0.5
398
+ q.message_count.should == 0
399
+ q.delete
400
+ end
396
401
  end
397
402
 
398
- describe "GET /api/queues/:vhost/:name/get" do
399
- it "fetches a message from a queue, a la basic.get"
403
+ # yes, POST, because it potentially modifies the state (ordering) of the queue
404
+ describe "POST /api/queues/:vhost/:name/get" do
405
+ before :all do
406
+ @channel = @connection.create_channel
407
+ end
408
+
409
+ it "fetches a message from a queue, a la basic.get" do
410
+ q = @channel.queue("")
411
+ x = @channel.fanout("amq.fanout", :durable => true, :auto_delete => false)
412
+ q.bind(x)
413
+
414
+ 10.times do |i|
415
+ x.publish("msg #{i}", :routing_key => q.name, :content_type => "application/xyz")
416
+ end
417
+ sleep 0.7
418
+
419
+ q.message_count.should == 10
420
+ xs = subject.get_messages("/", q.name, :count => 10, :requeue => false, :encoding => "auto")
421
+ m = xs.first
422
+
423
+ m.properties.content_type.should == "application/xyz"
424
+ m.payload.should == "msg 0"
425
+ m.payload_encoding.should == "string"
426
+
427
+ q.delete
428
+ end
400
429
  end
401
430
 
402
431
  describe "GET /api/bindings" do
@@ -426,7 +455,26 @@ describe RabbitMQ::HTTP::Client do
426
455
  end
427
456
 
428
457
  describe "GET /api/bindings/:vhost/e/:exchange/q/:queue" do
429
- it "returns a list of all bindings between an exchange and a queue"
458
+ before :all do
459
+ @channel = @connection.create_channel
460
+ end
461
+
462
+ it "returns a list of all bindings between an exchange and a queue" do
463
+ q = @channel.queue("")
464
+ x = @channel.fanout("http.client.fanout")
465
+ q.bind(x)
466
+
467
+ xs = subject.list_bindings_between_queue_and_exchange("/", q.name, x.name)
468
+ b = xs.first
469
+ b.destination.should == q.name
470
+ b.destination_type.should == "queue"
471
+ b.source.should == x.name
472
+ b.routing_key.should_not be_nil
473
+ b.vhost.should == "/"
474
+
475
+ q.delete
476
+ x.delete
477
+ end
430
478
  end
431
479
 
432
480
  describe "POST /api/bindings/:vhost/e/:exchange/q/:queue" do
@@ -460,16 +508,34 @@ describe RabbitMQ::HTTP::Client do
460
508
  end
461
509
  end
462
510
 
463
- describe "POST /api/vhosts/:name" do
464
- it "creates a vhost"
511
+ describe "PUT /api/vhosts/:name" do
512
+ let(:vhost) { "http-created" }
513
+
514
+ it "creates a vhost" do
515
+ subject.create_vhost(vhost)
516
+ subject.create_vhost(vhost)
517
+
518
+ v = subject.vhost_info(vhost)
519
+ v.name.should == vhost
520
+ end
465
521
  end
466
522
 
467
- describe "PUT /api/vhosts/:name" do
468
- it "updates a vhost"
523
+ describe "DELETE /api/vhosts/:name" do
524
+ let(:vhost) { "http-created2" }
525
+
526
+ it "deletes a vhost" do
527
+ subject.create_vhost(vhost)
528
+ subject.delete_vhost(vhost)
529
+ end
469
530
  end
470
531
 
471
532
  describe "GET /api/vhosts/:name/permissions" do
472
- it "returns a list of permissions in a vhost"
533
+ it "returns a list of permissions in a vhost" do
534
+ xs = subject.list_permissions("/")
535
+ p = xs.detect { |x| x.user == "guest" }
536
+
537
+ p.read.should == ".*"
538
+ end
473
539
  end
474
540
 
475
541
  describe "GET /api/users" do
@@ -484,39 +550,85 @@ describe RabbitMQ::HTTP::Client do
484
550
  end
485
551
 
486
552
  describe "GET /api/users/:name" do
487
- it "returns information about a user"
553
+ it "returns information about a user" do
554
+ u = subject.user_info("guest")
555
+ u.name.should == "guest"
556
+ u.tags.should == "administrator"
557
+ end
488
558
  end
489
559
 
490
560
  describe "PUT /api/users/:name" do
491
- it "updates information about a user"
561
+ it "updates information about a user" do
562
+ subject.update_user("alt", :tags => "http", :password => "alt")
563
+
564
+ u = subject.user_info("alt")
565
+ u.tags.should == "http"
566
+ end
492
567
  end
493
568
 
494
- describe "POST /api/users/:name" do
495
- it "creates a user"
569
+ describe "DELETE /api/users/:name" do
570
+ it "deletes a user" do
571
+ subject.update_user("alt2", :tags => "http", :password => "alt")
572
+ subject.delete_user("alt2")
573
+ end
496
574
  end
497
575
 
498
576
  describe "GET /api/users/:name/permissions" do
499
- it "returns a list of permissions for a user"
577
+ it "returns a list of permissions for a user" do
578
+ xs = subject.user_permissions("guest")
579
+ p = xs.first
580
+
581
+ p.read.should == ".*"
582
+ end
500
583
  end
501
584
 
502
585
  describe "GET /api/whoami" do
503
- it "returns information about the current user"
586
+ it "returns information about the current user" do
587
+ u = subject.whoami
588
+ u.name.should == "guest"
589
+ end
504
590
  end
505
591
 
506
592
  describe "GET /api/permissions" do
507
- it "lists all permissions"
593
+ it "lists all permissions" do
594
+ xs = subject.list_permissions
595
+ xs.first.read.should_not be_nil
596
+ end
508
597
  end
509
598
 
510
599
  describe "GET /api/permissions/:vhost/:user" do
511
- it "returns a list of permissions of a user in a vhost"
600
+ it "returns a list of permissions of a user in a vhost" do
601
+ p = subject.list_permissions_of("/", "guest")
602
+
603
+ p.read.should == ".*"
604
+ p.write.should == ".*"
605
+ p.configure.should == ".*"
606
+ end
512
607
  end
513
608
 
514
609
  describe "PUT /api/permissions/:vhost/:user" do
515
- it "updates permissions of a user in a vhost"
610
+ it "updates permissions of a user in a vhost" do
611
+ subject.update_permissions_of("/", "guest", :write => ".*", :read => ".*", :configure => ".*")
612
+
613
+ p = subject.list_permissions_of("/", "guest")
614
+
615
+ p.read.should == ".*"
616
+ p.write.should == ".*"
617
+ p.configure.should == ".*"
618
+ end
516
619
  end
517
620
 
518
621
  describe "DELETE /api/permissions/:vhost/:user" do
519
- it "clears permissions of a user in a vhost"
622
+ it "clears permissions of a user in a vhost" do
623
+ pending
624
+ subject.create_user("/", "alt3")
625
+ subject.update_permissions_of("/", "alt3", :write => ".*", :read => ".*", :configure => ".*")
626
+ subject.clear_permissions_of("/", "alt3")
627
+
628
+ p = subject.list_permissions_of("/", "alt3")
629
+
630
+ puts p.inspect
631
+ end
520
632
  end
521
633
 
522
634
  #
@@ -530,26 +642,6 @@ describe RabbitMQ::HTTP::Client do
530
642
  end
531
643
  end
532
644
 
533
- describe "GET /api/parameters/:component" do
534
- it "returns a list of all parameters for a component"
535
- end
536
-
537
- describe "GET /api/parameters/:component/:vhost" do
538
- it "returns a list of all parameters for a component in a vhost"
539
- end
540
-
541
- describe "GET /api/parameters/:component/:vhost/:name" do
542
- it "returns information about a specific parameter"
543
- end
544
-
545
- describe "PUT /api/parameters/:component/:vhost/:name" do
546
- it "updates information about a specific parameter"
547
- end
548
-
549
- describe "DELETE /api/parameters/:component/:vhost/:name" do
550
- it "clears information about a specific parameter"
551
- end
552
-
553
645
 
554
646
  #
555
647
  # Policies
@@ -563,19 +655,10 @@ describe RabbitMQ::HTTP::Client do
563
655
  end
564
656
 
565
657
  describe "GET /api/policies/:vhost" do
566
- it "returns a list of all policies in a vhost"
567
- end
568
-
569
- describe "GET /api/policies/:vhost/:name" do
570
- it "returns information about a policy in a vhost"
571
- end
572
-
573
- describe "PUT /api/policies/:vhost/:name" do
574
- it "updates information about a policy in a vhost"
575
- end
576
-
577
- describe "DELETE /api/policies/:vhost/:name" do
578
- it "clears information about a policy in a vhost"
658
+ it "returns a list of all policies in a vhost" do
659
+ xs = subject.list_policies("/")
660
+ xs.should be_kind_of(Array)
661
+ end
579
662
  end
580
663
 
581
664
 
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitmq_http_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre1
5
- prerelease: 6
4
+ version: 0.2.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Michael Klishin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -126,10 +126,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  none: false
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - !binary |-
130
- Pg==
129
+ - - ! '>='
131
130
  - !ruby/object:Gem::Version
132
- version: 1.3.1
131
+ version: !binary |-
132
+ MA==
133
133
  none: false
134
134
  requirements: []
135
135
  rubyforge_project: