rabbitmq_http_api_client 1.5.0 → 1.6.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: 544cb8a706ba1359e42ab9bff221cad9b67eb97d
4
- data.tar.gz: 0eb83fe2a328807ddb76a46ea054bbdcee3ff557
3
+ metadata.gz: 3b469accc29e88cb31b6a758bd41b8e5a4b23cdf
4
+ data.tar.gz: 0e937bf63faeb30172bee3008fe5ca3b7f05a776
5
5
  SHA512:
6
- metadata.gz: 8b6aaab7c0f8e9b4d456368d0490054657793da60baae1b6c32bedb794a986f34670c7e15a1a3903c1b7fccd77ee07665cde0f6eadfbe553688842d58f1a062f
7
- data.tar.gz: 9e73ea391051df2d4e3ab029bb6c788036c6ab1769a67da098ee04ec0269dacd35e57ccb93545e818b3e04fee5770ced227057f76da5e777144821568e972064
6
+ metadata.gz: 9049c26798c6aa7484216425676782e97f212ccb8ee2002867e0726aabe1b7f3c4ae0d14b737194b94b38263100376406f2107e68fa659a05f743b07205d1df0
7
+ data.tar.gz: d7aae20c64bbb343abe1beeb43e75840cac74318238fb3905ea9a624ee16b6bebdf46d7de772fcc2056d0dd509bdddc5c48fc86813955d5469942e961e657514
data/ChangeLog.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## Changes Between 1.5.0 and 1.6.0
2
+
3
+ ### Definition Upload Support
4
+
5
+ The client now can upload definitions (of queues, exchanges, etc):
6
+
7
+ ``` ruby
8
+ defs = {
9
+ :queues => [{
10
+ :name => 'my-definition-queue',
11
+ :vhost => '/',
12
+ :durable => true,
13
+ :auto_delete => false,
14
+ :arguments => {
15
+ "x-dead-letter-exchange" => 'dead'
16
+ }
17
+ }]
18
+ }.to_json
19
+
20
+ c.upload_definitions(defs)
21
+ ```
22
+
23
+ Contributed by Pol Miro.
24
+
25
+
26
+
1
27
  ## Changes Between 1.4.0 and 1.5.0
2
28
 
3
29
  ### Support for URIs containing a path
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 'rabbitmq_http_api_client', '>= 1.4.0'
36
+ gem 'rabbitmq_http_api_client', '>= 1.5.0'
37
37
 
38
38
  And then execute:
39
39
 
@@ -77,7 +77,11 @@ module RabbitMQ
77
77
  end
78
78
 
79
79
  def upload_definitions(defs)
80
- raise NotImplementedError.new
80
+ response = @connection.post("definitions") do |req|
81
+ req.headers['Content-Type'] = "application/json"
82
+ req.body = defs
83
+ end
84
+ response.success?
81
85
  end
82
86
 
83
87
  def list_connections
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "1.5.0"
4
+ VERSION = "1.6.0"
5
5
  end
6
6
  end
7
7
  end
@@ -139,7 +139,31 @@ describe RabbitMQ::HTTP::Client do
139
139
  end
140
140
 
141
141
  describe "POST /api/definitions" do
142
- it "uploads definitions to RabbitMQ"
142
+ let(:definition) do
143
+ {
144
+ :queues => [{
145
+ :name => 'my-definition-queue',
146
+ :vhost => '/',
147
+ :durable => true,
148
+ :auto_delete => false,
149
+ :arguments => {
150
+ "x-dead-letter-exchange" => 'dead'
151
+ }
152
+ }]
153
+ }.to_json
154
+ end
155
+
156
+ it "returns true when successful" do
157
+ r = subject.upload_definitions(definition)
158
+ expect(r).to eq(true)
159
+ end
160
+
161
+ it "stores the uploaded definitions" do
162
+ subject.upload_definitions(definition)
163
+ xs = subject.list_definitions
164
+ uploaded_queue = xs.queues.detect { |q| q.name = 'my-definition-queue' }
165
+ expect(uploaded_queue).not_to eq(nil)
166
+ end
143
167
  end
144
168
 
145
169
  #
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.5.0
4
+ version: 1.6.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: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie