rabbitmq_http_api_client 0.7.0 → 0.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: 1da7410d9c30f5c606fa7c3625603cd6f7452062
4
- data.tar.gz: ce4cab4b22d59edb563d2d99c6c9d4237263e5d1
3
+ metadata.gz: 3fcc64344f962ce4cd8a09b31ec56fcb07e0e14e
4
+ data.tar.gz: 2ad823cabc46636f2bd76ac3afe11e73092e0949
5
5
  SHA512:
6
- metadata.gz: 1fe4dd68dacda7a8bdf1d90c47af6f889b0031da6d62fdaff6d97f35f28bb67eb4eace7e8b487df1d912b0bc67b4941dd60166151df52060b66edccf460f9eee
7
- data.tar.gz: a78ecfd9ae9a8507f71d71ba8da24a1da0e42115f5a11f0607fdf054f4a1235e829bef1fcc61a7a0866f4dacf8af3bd79226d7d14f48af49c71dc65686d63258
6
+ metadata.gz: 3bef8999c93f6c4b8df933023da82edfc521136e4e6458bf726e081a9b8c348702da3459da8787ee93f6767063909a438588d9996cbdc975f27122174ff2ee0e
7
+ data.tar.gz: 4ccda1d68cc3e4f7e7ebfb0aa77900b2c6d0d0bd6acac0285003a7c01b3a3d12bad998d2ca65055f4b38fedb929c31b7adbc26d849563b059d59e483a0ea7550
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ -cfs
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  group :development, :test do
4
4
  gem "rspec"
5
5
  gem "json", :platform => :ruby_18
6
- gem "bunny", ">= 0.10.2"
6
+ gem "bunny", ">= 0.10.8"
7
7
  end
8
8
 
9
9
  # Specify your gem's dependencies in superintendent.gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Michael Klishin
1
+ Copyright (c) 2012-2013 Michael Klishin
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -63,6 +63,14 @@ endpoint = "http://127.0.0.1:55672"
63
63
  client = RabbitMQ::HTTP::Client.new(endpoint, :username => "guest", :password => "guest")
64
64
  ```
65
65
 
66
+ Alternatively, credentials can be specified in the endpoint URI:
67
+
68
+ ``` ruby
69
+ require "rabbitmq/http/client"
70
+
71
+ client = RabbitMQ::HTTP::Client.new("http://guest:guest@127.0.0.1:55672")
72
+ ```
73
+
66
74
  ### Client API Design Overview
67
75
 
68
76
  All client methods return arrays or hash-like structures that can be used
@@ -32,6 +32,34 @@ module RabbitMQ
32
32
  decode_resource(@connection.get("/api/overview"))
33
33
  end
34
34
 
35
+ # Returns a list of messaging protocols supported by
36
+ # the node (or cluster).
37
+ #
38
+ # Common values are:
39
+ #
40
+ # * amqp
41
+ # * amqp/ssl
42
+ # * mqtt
43
+ # * stomp
44
+ #
45
+ # The exact value depends on RabbitMQ configuration and enabled
46
+ # plugins.
47
+ #
48
+ # @return [Array<String>] Enabled protocols
49
+ def enabled_protocols
50
+ self.overview.listeners.
51
+ map { |lnr| lnr.protocol }.
52
+ uniq
53
+ end
54
+
55
+ # Returns a hash of protocol => port.
56
+ #
57
+ # @return [Hash<String, Integer>] Hash of protocol => port
58
+ def protocol_ports
59
+ self.overview.listeners.
60
+ reduce(Hash.new) { |acc, lnr| acc[lnr.protocol] = lnr.port; acc }
61
+ end
62
+
35
63
  def list_nodes
36
64
  decode_resource_collection(@connection.get("/api/nodes"))
37
65
  end
@@ -1,7 +1,7 @@
1
1
  module RabbitMQ
2
2
  module HTTP
3
3
  class Client
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
6
6
  end
7
7
  end
@@ -51,6 +51,23 @@ describe RabbitMQ::HTTP::Client do
51
51
  end
52
52
  end
53
53
 
54
+ describe "#enabled_protocols" do
55
+ it "returns a list of enabled protocols" do
56
+ xs = subject.enabled_protocols
57
+
58
+ xs.should include("amqp")
59
+ end
60
+ end
61
+
62
+ describe "#enabled_protocols" do
63
+ it "returns a list of enabled protocols" do
64
+ xs = subject.protocol_ports
65
+
66
+ # hash of protocol => port
67
+ xs["amqp"].should == 5672
68
+ end
69
+ end
70
+
54
71
  #
55
72
  # Nodes
56
73
  #
@@ -604,10 +621,10 @@ describe RabbitMQ::HTTP::Client do
604
621
 
605
622
  describe "PUT /api/users/:name" do
606
623
  it "updates information about a user" do
607
- subject.update_user("alt", :tags => "http", :password => "alt")
624
+ subject.update_user("alt", :tags => "http policymaker management", :password => "alt")
608
625
 
609
626
  u = subject.user_info("alt")
610
- u.tags.should == "http"
627
+ u.tags.should == "http policymaker management"
611
628
  end
612
629
  end
613
630
 
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.7.0
4
+ version: 0.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: 2013-10-14 00:00:00.000000000 Z
11
+ date: 2013-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -88,6 +88,7 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - .gitignore
91
+ - .rspec
91
92
  - .travis.yml
92
93
  - ChangeLog.md
93
94
  - Gemfile