ruby-amqp / rabbitmq_http_api_client

RabbitMQ HTTP API client for Ruby
MIT License
79 stars 49 forks source link

Unable to list parameters by name - undefined method `each_pair' #22

Open tetherit opened 9 years ago

tetherit commented 9 years ago

When I try to list_parameters_of by name, I get this error:

> client.list_parameters_of('federation-upstream', 'monitor', '33ac8c46007794dee1a6')
NoMethodError: undefined method `each_pair' for #<Array:0x0000000153b1e0>
from /var/lib/gems/2.2.0/gems/hashie-3.4.1/lib/hashie/mash.rb:179:in `deep_update'

If I don't list by name, I see the parameters as expected:

> client.list_parameters_of('federation-upstream', 'monitor')
=> [{"value"=>{"uri"=>"amqp://33ac8c46007794dee1a6:password@vpn.33ac8c46007794dee1a6/monitor", "reconnect-delay"=>30}, "vhost"=>"monitor", "component"=>"federation-upstream", "name"=>"33ac8c46007794dee1a6"}]
michaelklishin commented 9 years ago

Can you please post the output of the same request with curl? The body seems to be non-standard.

The path is

/api/parameters/#{uri_encode(component)}/#{uri_encode(vhost)}/#{uri_encode(name)}
tetherit commented 9 years ago

Sure:

$ curl "http://timeline:password@127.0.0.1:15672/api/parameters/federation-upstream/monitor/33ac8c46007794dee1a6"
{"value":{"uri":"amqp://33ac8c46007794dee1a6:password@vpn.33ac8c46007794dee1a6/monitor","reconnect-delay":30},"vhost":"monitor","component":"federation-upstream","name":"33ac8c46007794dee1a6"}

I'm also seeing the same issue with list_policies_of:

> client.list_policies_of('monitor', 'federate-me')
NoMethodError: undefined method `each_pair' for ["vhost", "monitor"]:Array
from /var/lib/gems/2.2.0/gems/hashie-3.4.1/lib/hashie/mash.rb:179:in `deep_update'