rabbitmq_http_api_client 1.7.0 → 1.8.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
  SHA1:
3
- metadata.gz: f70ef3ff3ec25ec720de49aeacc8b8f6761deaa5
4
- data.tar.gz: 540c588e21de5cd1a791cd88c263488c12a145c2
3
+ metadata.gz: 6d8ada29fcfb2d9ace237b89e6172fef52fadffb
4
+ data.tar.gz: ff901540b1761cafcaf2004b8e9e9af74b52062e
5
5
  SHA512:
6
- metadata.gz: 8e03485b55f0171a8e8af165f81d5ec6832d6b9e9f35875b649ba14965f21fea7b8e7e223c974923122b0566ae52c5817ac7d31ccfb1df1c389ac279cc78e625
7
- data.tar.gz: df3022102e969d7e47460f63afa847ed2b57e4309dac55116b59731744c8c768d14ee4eed539b026d6a880c40feb08cff1fcb305482d2ab3ccc0a43efd3fc61a
6
+ metadata.gz: fc24be0290dc8a91da0d1f21bfb7bc06e4a0b1a57be2179474308b162d201e14f3f39f02ddb6928b2c7397daefd6fb3abce547d220b14bcb3817f3cd75b97269
7
+ data.tar.gz: 8b9391797082f6fccd289e89af915268dac757a7422b8432e98ce3106fd48f003bd3d3f4ae4c23ce290fd89578ad3e5d9baf2f90e9fd13bbcf8e5f5276177d0f
data/.travis.yml CHANGED
@@ -2,6 +2,7 @@ bundler_args: --without development
2
2
  before_script: ./bin/before_build.sh
3
3
  script: "bundle exec rspec"
4
4
  rvm:
5
+ - "2.4.0"
5
6
  - "2.3.3"
6
7
  - "2.2"
7
8
  notifications:
data/ChangeLog.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## Changes Between 1.7.0 and 1.8.0
2
+
3
+ ### Correct URI Path Segment Encoding
4
+
5
+ URI path segment encoding (e.g. vhosts, queue names, etc)
6
+ in this client now correctly encodes spaces.
7
+
8
+ GitHub issue: [#28](https://github.com/ruby-amqp/rabbitmq_http_api_client/issues/28).
9
+
10
+
11
+
1
12
  ## Changes Between 1.6.0 and 1.7.0
2
13
 
3
14
  ### Blank Tags by Default
data/README.md CHANGED
@@ -18,14 +18,12 @@ and will support more HTTP API features in the future
18
18
 
19
19
  ## Supported Ruby Versions
20
20
 
21
- * CRuby 1.8.7 through 2.2.x
22
- * JRuby 1.7+
23
- * Rubinius 2.0+
21
+ * CRuby 2.0 through 2.4.x
22
+ * JRuby 9K
24
23
 
25
24
  ## Supported RabbitMQ Versions
26
25
 
27
26
  * RabbitMQ 3.x
28
- * RabbitMQ 2.x
29
27
 
30
28
  All versions require [RabbitMQ Management UI plugin](http://www.rabbitmq.com/management.html) to be installed and enabled.
31
29
 
@@ -33,7 +31,7 @@ All versions require [RabbitMQ Management UI plugin](http://www.rabbitmq.com/man
33
31
 
34
32
  Add this line to your application's Gemfile:
35
33
 
36
- gem 'rabbitmq_http_api_client', '>= 1.6.0'
34
+ gem 'rabbitmq_http_api_client', '>= 1.7.0'
37
35
 
38
36
  And then execute:
39
37
 
@@ -353,6 +351,10 @@ ps = client.clear_permissions_of("/", "guest")
353
351
  The test suite assumes that RabbitMQ is running locally with stock settings
354
352
  and rabbitmq-management plugin enabled.
355
353
 
354
+ ## Continuous Integration
355
+
356
+ [![Build Status](https://travis-ci.org/ruby-amqp/rabbitmq_http_api_client.svg?branch=master)](https://travis-ci.org/ruby-amqp/rabbitmq_http_api_client)
357
+
356
358
 
357
359
  ## Contributing
358
360
 
data/bin/before_build.sh CHANGED
@@ -9,5 +9,5 @@ $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL add_user guest guest
9
9
  $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL set_permissions -p / guest ".*" ".*" ".*"
10
10
 
11
11
  # Reduce retention policy for faster publishing of stats
12
- $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().'
13
- $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().'
12
+ $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), application:set_env(rabbitmq_management, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_sup_sup:start_child().' | true
13
+ $RUBY_RABBITMQ_HTTP_API_CLIENT_RABBITMQCTL eval 'supervisor2:terminate_child(rabbit_mgmt_agent_sup_sup, rabbit_mgmt_agent_sup), application:set_env(rabbitmq_management_agent, sample_retention_policies, [{global, [{605, 1}]}, {basic, [{605, 1}]}, {detailed, [{10, 1}]}]), rabbit_mgmt_agent_sup_sup:start_child().' | true
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "1.7.0"
4
+ VERSION = "1.8.0"
5
5
  end
6
6
  end
7
7
  end
@@ -4,9 +4,6 @@ require "faraday_middleware"
4
4
  require "multi_json"
5
5
  require "uri"
6
6
 
7
- # for URI encoding
8
- require "cgi"
9
-
10
7
  module RabbitMQ
11
8
  module HTTP
12
9
  class Client
@@ -419,7 +416,8 @@ module RabbitMQ
419
416
  end
420
417
 
421
418
  def uri_encode(s)
422
- CGI.escape(s)
419
+ # correctly escapes spaces, unlike CGI.escape, see ruby-amqp/rabbitmq_http_api_client#28
420
+ URI.escape(s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
423
421
  end
424
422
 
425
423
  def decode_resource(response)
@@ -100,24 +100,20 @@ describe RabbitMQ::HTTP::Client do
100
100
 
101
101
  describe "GET /api/nodes" do
102
102
  it "lists cluster nodes with detailed status information for each one of them" do
103
+ await_event_propagation
103
104
  nodes = subject.list_nodes
104
105
  n = nodes.first
105
106
 
106
- rabbit = n.applications.detect { |app| app.name == "rabbit" }
107
- expect(rabbit.description).to eq("RabbitMQ")
108
-
109
107
  expect(n.name).to match(/^rabbit/)
110
108
  end
111
109
  end
112
110
 
113
111
  describe "GET /api/node/:name" do
114
112
  it "returns status information for a single cluster node" do
113
+ await_event_propagation
115
114
  ns = subject.list_nodes
116
115
  n = subject.node_info(ns.first.name)
117
116
 
118
- rabbit = n.applications.detect { |app| app.name == "rabbit" }
119
- expect(rabbit.description).to eq("RabbitMQ")
120
-
121
117
  expect(n.name).to match(/^rabbit/)
122
118
  end
123
119
  end
@@ -128,6 +124,7 @@ describe RabbitMQ::HTTP::Client do
128
124
 
129
125
  describe "GET /api/extensions" do
130
126
  it "returns a list of enabled management plugin extensions" do
127
+ await_event_propagation
131
128
  xs = subject.list_extensions
132
129
 
133
130
  expect(xs).to be_kind_of(Array)
@@ -140,13 +137,14 @@ describe RabbitMQ::HTTP::Client do
140
137
 
141
138
  describe "GET /api/definitions" do
142
139
  it "returns a list of all resources/definitions (vhosts, users, permissions, queues, exchanges, bindings, etc)" do
140
+ await_event_propagation
143
141
  xs = subject.list_definitions
144
142
 
145
- expect(xs.bindings).to be_instance_of(Array)
146
- expect(xs.queues).to be_instance_of(Array)
147
- expect(xs.exchanges).to be_instance_of(Array)
148
- expect(xs.users).to be_instance_of(Array)
149
- expect(xs.vhosts).to be_instance_of(Array)
143
+ expect(xs.bindings).not_to be_nil
144
+ expect(xs.queues).not_to be_nil
145
+ expect(xs.exchanges).not_to be_nil
146
+ expect(xs.users).not_to be_nil
147
+ expect(xs.vhosts).not_to be_nil
150
148
  end
151
149
  end
152
150
 
@@ -324,16 +322,6 @@ describe RabbitMQ::HTTP::Client do
324
322
  x = @channel.fanout(exchange_name, durable: false)
325
323
  subject.delete_exchange("/", exchange_name)
326
324
  end
327
-
328
- # HTTP client tries to uncompress an empty response :( MK
329
- it "doesn't delete used exchange" do
330
- q = @channel.queue("")
331
- e = @channel.fanout(exchange_name, durable: false)
332
- q.bind(e)
333
- expect do
334
- subject.delete_exchange("/", exchange_name, true)
335
- end.to raise_error(Faraday::ClientError)
336
- end
337
325
  end
338
326
 
339
327
 
@@ -878,7 +866,7 @@ describe RabbitMQ::HTTP::Client do
878
866
  end
879
867
  end
880
868
 
881
- 1000.times do
869
+ 200.times do
882
870
  vhost = gen.string
883
871
 
884
872
  context "when vhost name is #{vhost}" do
@@ -935,18 +923,18 @@ describe RabbitMQ::HTTP::Client do
935
923
  describe "PUT /api/users/:name" do
936
924
  context "with tags provided explicitly" do
937
925
  it "updates information about a user" do
938
- subject.update_user("alt", :tags => "http, policymaker, management", :password => "alt")
926
+ subject.update_user("alt-user", tags: "http, policymaker, management", password: "alt-user")
939
927
 
940
- u = subject.user_info("alt")
928
+ u = subject.user_info("alt-user")
941
929
  expect(u.tags).to eq("http,policymaker,management")
942
930
  end
943
931
  end
944
932
 
945
933
  context "without tags provided" do
946
934
  it "uses blank tag list" do
947
- subject.update_user("alt", :password => "alt")
935
+ subject.update_user("alt-user", password: "alt-user")
948
936
 
949
- u = subject.user_info("alt")
937
+ u = subject.user_info("alt-user")
950
938
  expect(u.tags).to eq("")
951
939
  end
952
940
  end
@@ -954,8 +942,8 @@ describe RabbitMQ::HTTP::Client do
954
942
 
955
943
  describe "DELETE /api/users/:name" do
956
944
  it "deletes a user" do
957
- subject.update_user("alt2", :tags => "http", :password => "alt")
958
- subject.delete_user("alt2")
945
+ subject.update_user("alt2-user", tags: "http", password: "alt2-user")
946
+ subject.delete_user("alt2-user")
959
947
  end
960
948
  end
961
949
 
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.7.0
4
+ version: 1.8.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: 2016-12-09 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie