class Rubhttp::Client
Public Class Methods
# File lib/rubhttp/client.rb, line 5 def initialize(&block) @app = RackBuilder.app(&block) end
Public Instance Methods
Convert to a transparent TCP/IP tunnel.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 77 def connect(uri, options = {}) request :connect, uri, options end
Delete a resource.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 50 def delete(uri, options = {}) request :delete, uri, options end
Get a resource.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 23 def get(uri, options = {}) request :get, uri, options end
Request
a get sans response body.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 14 def head(uri, options = {}) request :head, uri, options end
Return the methods supported on the given URI.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 68 def options(uri, options = {}) request :options, uri, options end
Apply partial modifications to a resource.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 86 def patch(uri, options = {}) request :patch, uri, options end
Post to a resource.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 32 def post(uri, options = {}) request :post, uri, options end
Put to a resource.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 41 def put(uri, options = {}) request :put, uri, options end
Make an HTTP request with the given verb.
@param verb [String, Symbol] @param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 96 def request(verb, uri, options = {}) r = Request.new(options.merge(verb: verb, uri: uri)) @app.call(r) end
Echo the request back to the client.
@param uri [String] @param options [Hash] @return [Response]
# File lib/rubhttp/client.rb, line 59 def trace(uri, options = {}) request :trace, uri, options end