Sha256: a8b2624119bfca9e782e4802b26d1c2494e6662ff041bcdf15c64603f32e7610
Contents?: true
Size: 873 Bytes
Versions: 1
Compression:
Stored size: 873 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' require 'pp' require 'rack/amqp/curl' connection_options = { host: 'localhost', timeout: 5, } options = { http_method: 'GET', headers: {}, } OptionParser.new do |opts| opts.banner = "Usage: amqurl [options] [URL...]" opts.on '-X [OPTIONAL]', '--request [OPTIONAL]', 'Specify the HTTP request method (GET, POST, etc)' do |v| options[:http_method] = v.upcase end opts.on_tail '--version', 'Show Version' do puts Rack::AMQP::Curl::VERSION exit end # TODO support -T (upload file) end.parse! url = ARGV[0].gsub(/\Aamqps?:\/\//, '') raise "Need to specify a URL before continuing" unless url Rack::AMQP::Client.with_client(connection_options) do |client| Timeout.timeout(connection_options[:timeout]) do response = client.request(url, options) puts response.payload end end # vi:ft=ruby
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amqurl-0.0.1 | bin/amqurl |