rabbitmq_http_api_client 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +11 -0
- data/Gemfile +1 -1
- data/README.md +23 -0
- data/lib/rabbitmq/http/client/version.rb +1 -1
- data/lib/rabbitmq/http/client.rb +7 -1
- data/spec/integration/client_spec.rb +15 -0
- data/spec/spec_helper.rb +1 -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: 1da7410d9c30f5c606fa7c3625603cd6f7452062
|
4
|
+
data.tar.gz: ce4cab4b22d59edb563d2d99c6c9d4237263e5d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe4dd68dacda7a8bdf1d90c47af6f889b0031da6d62fdaff6d97f35f28bb67eb4eace7e8b487df1d912b0bc67b4941dd60166151df52060b66edccf460f9eee
|
7
|
+
data.tar.gz: a78ecfd9ae9a8507f71d71ba8da24a1da0e42115f5a11f0607fdf054f4a1235e829bef1fcc61a7a0866f4dacf8af3bd79226d7d14f48af49c71dc65686d63258
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## Changes Between 0.6.0 and 0.7.0
|
2
|
+
|
3
|
+
### Support for Basic HTTP Auth Credentials in URI
|
4
|
+
|
5
|
+
It is now possible to pass credentials in the endpoint URI:
|
6
|
+
|
7
|
+
``` ruby
|
8
|
+
c = RabbitMQ::HTTP::Client.new("https://guest:guest@127.0.0.1:15672/")
|
9
|
+
```
|
10
|
+
|
11
|
+
|
1
12
|
## Changes Between 0.5.0 and 0.6.0
|
2
13
|
|
3
14
|
### Support for Advanced Connection Options
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -75,6 +75,29 @@ puts r[:rabbitmq_version]
|
|
75
75
|
puts r.erlang_version
|
76
76
|
```
|
77
77
|
|
78
|
+
### Accessing Management API with HTTPS
|
79
|
+
|
80
|
+
All additional options other than `:username` and `:password` are passed
|
81
|
+
to [Faraday::Connection](https://github.com/lostisland/faraday). So, it is possible to use HTTPS
|
82
|
+
like so:
|
83
|
+
|
84
|
+
``` ruby
|
85
|
+
c = RabbitMQ::HTTP::Client.new("https://127.0.0.1:15672/", username: "guest", password: "guest", ssl: {
|
86
|
+
client_cer: ...,
|
87
|
+
client_key: ...,
|
88
|
+
ca_file: ...,
|
89
|
+
ca_path: ...,
|
90
|
+
cert_store: ...
|
91
|
+
})
|
92
|
+
```
|
93
|
+
|
94
|
+
Or, if you have good reasons to do so, disable peer verification:
|
95
|
+
|
96
|
+
``` ruby
|
97
|
+
c = RabbitMQ::HTTP::Client.new("https://127.0.0.1:15672/", username: "guest", password: "guest", ssl: {
|
98
|
+
verify: false
|
99
|
+
})
|
100
|
+
```
|
78
101
|
|
79
102
|
|
80
103
|
### Node and Cluster Status
|
data/lib/rabbitmq/http/client.rb
CHANGED
@@ -2,6 +2,7 @@ require "hashie"
|
|
2
2
|
require "faraday"
|
3
3
|
require "faraday_middleware"
|
4
4
|
require "multi_json"
|
5
|
+
require "uri"
|
5
6
|
|
6
7
|
# for URI encoding
|
7
8
|
require "cgi"
|
@@ -308,8 +309,13 @@ module RabbitMQ
|
|
308
309
|
protected
|
309
310
|
|
310
311
|
def initialize_connection(endpoint, options = {})
|
312
|
+
uri = URI.parse(endpoint)
|
313
|
+
|
314
|
+
user = uri.user || options[:username] || "guest"
|
315
|
+
password = uri.password || options[:password] || "guest"
|
316
|
+
|
311
317
|
@connection = Faraday.new(options.merge(:url => endpoint)) do |conn|
|
312
|
-
conn.basic_auth
|
318
|
+
conn.basic_auth user, password
|
313
319
|
conn.use FaradayMiddleware::FollowRedirects, :limit => 3
|
314
320
|
conn.use Faraday::Response::RaiseError
|
315
321
|
conn.response :json, :content_type => /\bjson$/
|
@@ -17,6 +17,21 @@ describe RabbitMQ::HTTP::Client do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
|
20
|
+
#
|
21
|
+
# URI-only access
|
22
|
+
#
|
23
|
+
|
24
|
+
describe "URI-only access" do
|
25
|
+
it "authenticates successfully" do
|
26
|
+
c = described_class.connect("http://guest:guest@127.0.0.1:15672")
|
27
|
+
|
28
|
+
r = c.overview
|
29
|
+
r.rabbitmq_version.should_not be_nil
|
30
|
+
r.erlang_version.should_not be_nil
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
20
35
|
#
|
21
36
|
# Overview
|
22
37
|
#
|
data/spec/spec_helper.rb
CHANGED
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: 0.
|
4
|
+
version: 0.7.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: 2013-10-
|
11
|
+
date: 2013-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.1.6
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: RabbitMQ HTTP API client for Ruby
|