lib/onering/cli/call.rb in onering-client-0.0.62 vs lib/onering/cli/call.rb in onering-client-0.0.63
- old
+ new
@@ -22,17 +22,21 @@
$ onering call devices/0bf29c -m delete
Options:
EOS
opt :method, "The HTTP method to use when performing the request", :default => 'get', :short => "-m", :type => :string
+ opt :query, "A query string attribute to add to the request in the form of NAME=VALUE", :short => '-a', :type => :string, :multi => true
end
end
def self.run(args)
data = STDIN.read() unless STDIN.tty?
rv = @api.request(@opts[:method], args.first, {
- :body => data
+ :body => data,
+ :query => Hash[@opts[:query].collect{|i|
+ i.split('=',2)
+ }]
}.compact)
return (rv.parsed_response rescue rv.response.body)
end
end
\ No newline at end of file