rabbitmq_http_api_client 1.0.0 → 1.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 +4 -4
- data/.travis.yml +1 -0
- data/ChangeLog.md +13 -0
- data/README.md +2 -1
- data/lib/rabbitmq/http/client.rb +17 -3
- data/lib/rabbitmq/http/client/version.rb +1 -1
- data/spec/integration/client_spec.rb +15 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 596f116b77ab889cb05cdd85783b4215d1d876db
|
4
|
+
data.tar.gz: 3a480dc5177104fc06aacc23ac769ce6a5a414ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1599452a4274adc34b01b08a7f2d0fdfd714d71b61cc2cc876b56ad237ac15bdea3019e535783c488572938d920dfa2b42df55572ff9fbc678dec9c3dcef85df
|
7
|
+
data.tar.gz: 1b1a9c774f0f3248818d802f6946370a45bba4edc4c99851db116a7bcb44106eff42431722e1c5f94077f7077b1bb564ce127e361a654014ebb3cc684f207ec2
|
data/.travis.yml
CHANGED
data/ChangeLog.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## Changes Between 1.0.0 and 1.1.0
|
2
|
+
|
3
|
+
### declare_exchange
|
4
|
+
|
5
|
+
It is now possible to declare an exchange over HTTP API using `RabbitMQ::HTTP::Client#declare_exchange`:
|
6
|
+
|
7
|
+
``` ruby
|
8
|
+
c.declare_exchange("/", exchange_name, :durable => false, :type => "fanout")
|
9
|
+
```
|
10
|
+
|
11
|
+
Contributed by Jake Davis (Simple).
|
12
|
+
|
13
|
+
|
1
14
|
## Changes Between 0.9.0 and 1.0.0
|
2
15
|
|
3
16
|
### Hashi Upgrade
|
data/README.md
CHANGED
@@ -18,6 +18,7 @@ and will support more HTTP API features in the future
|
|
18
18
|
|
19
19
|
## Supported Ruby Versions
|
20
20
|
|
21
|
+
* MRI 2.1
|
21
22
|
* MRI 2.0
|
22
23
|
* MRI 1.9.3
|
23
24
|
* JRuby 1.7+
|
@@ -358,7 +359,7 @@ ps = client.clear_permissions_of("/", "guest")
|
|
358
359
|
|
359
360
|
Double-licensed under the MIT and Mozilla Public License (same as RabbitMQ).
|
360
361
|
|
361
|
-
(c) Michael S. Klishin, 2012-
|
362
|
+
(c) Michael S. Klishin, 2012-2014.
|
362
363
|
|
363
364
|
|
364
365
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
data/lib/rabbitmq/http/client.rb
CHANGED
@@ -110,6 +110,21 @@ module RabbitMQ
|
|
110
110
|
decode_resource_collection(@connection.get(path))
|
111
111
|
end
|
112
112
|
|
113
|
+
def declare_exchange(vhost, name, attributes = {})
|
114
|
+
opts = {
|
115
|
+
:type => "direct",
|
116
|
+
:auto_delete => false,
|
117
|
+
:durable => true,
|
118
|
+
:arguments => {}
|
119
|
+
}.merge(attributes)
|
120
|
+
|
121
|
+
response = @connection.put("/api/exchanges/#{uri_encode(vhost)}/#{uri_encode(name)}") do |req|
|
122
|
+
req.headers['Content-Type'] = 'application/json'
|
123
|
+
req.body = MultiJson.dump(opts)
|
124
|
+
end
|
125
|
+
decode_resource(response)
|
126
|
+
end
|
127
|
+
|
113
128
|
def exchange_info(vhost, name)
|
114
129
|
decode_resource(@connection.get("/api/exchanges/#{uri_encode(vhost)}/#{uri_encode(name)}"))
|
115
130
|
end
|
@@ -164,7 +179,6 @@ module RabbitMQ
|
|
164
179
|
decode_resource_collection(response)
|
165
180
|
end
|
166
181
|
|
167
|
-
|
168
182
|
def list_bindings(vhost = nil)
|
169
183
|
path = if vhost.nil?
|
170
184
|
"/api/bindings"
|
@@ -182,7 +196,7 @@ module RabbitMQ
|
|
182
196
|
def queue_binding_info(vhost, queue, exchange, properties_key)
|
183
197
|
decode_resource(@connection.get("/api/bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}/#{uri_encode(properties_key)}"))
|
184
198
|
end
|
185
|
-
|
199
|
+
|
186
200
|
def bind_queue(vhost, queue, exchange, routing_key, arguments = [])
|
187
201
|
resp = @connection.post("/api/bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}") do |req|
|
188
202
|
req.headers['Content-Type'] = 'application/json'
|
@@ -190,7 +204,7 @@ module RabbitMQ
|
|
190
204
|
end
|
191
205
|
resp.headers['location']
|
192
206
|
end
|
193
|
-
|
207
|
+
|
194
208
|
def delete_queue_binding(vhost, queue, exchange, properties_key)
|
195
209
|
resp = @connection.delete("/api/bindings/#{uri_encode(vhost)}/e/#{uri_encode(exchange)}/q/#{uri_encode(queue)}/#{uri_encode(properties_key)}")
|
196
210
|
resp.success?
|
@@ -269,6 +269,21 @@ describe RabbitMQ::HTTP::Client do
|
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
272
|
+
describe "PUT /api/exchanges/:vhost/:name" do
|
273
|
+
before :all do
|
274
|
+
@channel = @connection.create_channel
|
275
|
+
end
|
276
|
+
|
277
|
+
let(:exchange_name) { "httpdeclared" }
|
278
|
+
|
279
|
+
it "declares an exchange" do
|
280
|
+
subject.declare_exchange("/", exchange_name, :durable => false, :type => "fanout")
|
281
|
+
|
282
|
+
x = @channel.fanout(exchange_name, :durable => false, :auto_delete => false)
|
283
|
+
x.delete
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
272
287
|
describe "GET /api/exchanges/:vhost/:name/bindings/source" do
|
273
288
|
before :all do
|
274
289
|
@channel = @connection.create_channel
|
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.
|
4
|
+
version: 1.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: 2014-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.2.2
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: RabbitMQ HTTP API client for Ruby
|