Module: HTTP::Chainable::Verbs

Included in:
HTTP::Chainable
Defined in:
lib/http/chainable/verbs.rb

Overview

HTTP verb shortcut methods

Each method delegates to #request with the appropriate verb.

Instance Method Summary collapse

Instance Method Details

#connect(uri) {|response| ... } ⇒ HTTP::Response, Object

Convert to a transparent TCP/IP tunnel

Examples:

HTTP.connect("http://example.com")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



117
118
119
# File 'lib/http/chainable/verbs.rb', line 117

def connect(uri, **, &)
  request(:connect, uri, **, &) # steep:ignore
end

#delete(uri) {|response| ... } ⇒ HTTP::Response, Object

Delete a resource

Examples:

HTTP.delete("http://example.com/resource")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



75
76
77
# File 'lib/http/chainable/verbs.rb', line 75

def delete(uri, **, &)
  request(:delete, uri, **, &) # steep:ignore
end

#get(uri) {|response| ... } ⇒ HTTP::Response, Object

Get a resource

Examples:

HTTP.get("http://example.com")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



33
34
35
# File 'lib/http/chainable/verbs.rb', line 33

def get(uri, **, &)
  request(:get, uri, **, &) # steep:ignore
end

#head(uri) {|response| ... } ⇒ HTTP::Response, Object

Request a get sans response body

Examples:

HTTP.head("http://example.com")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



19
20
21
# File 'lib/http/chainable/verbs.rb', line 19

def head(uri, **, &)
  request(:head, uri, **, &) # steep:ignore
end

#options(uri) {|response| ... } ⇒ HTTP::Response, Object

Return the methods supported on the given URI

Examples:

HTTP.options("http://example.com")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



103
104
105
# File 'lib/http/chainable/verbs.rb', line 103

def options(uri, **, &)
  request(:options, uri, **, &) # steep:ignore
end

#patch(uri) {|response| ... } ⇒ HTTP::Response, Object

Apply partial modifications to a resource

Examples:

HTTP.patch("http://example.com/resource", body: "data")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



131
132
133
# File 'lib/http/chainable/verbs.rb', line 131

def patch(uri, **, &)
  request(:patch, uri, **, &) # steep:ignore
end

#post(uri) {|response| ... } ⇒ HTTP::Response, Object

Post to a resource

Examples:

HTTP.post("http://example.com", body: "data")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



47
48
49
# File 'lib/http/chainable/verbs.rb', line 47

def post(uri, **, &)
  request(:post, uri, **, &) # steep:ignore
end

#put(uri) {|response| ... } ⇒ HTTP::Response, Object

Put to a resource

Examples:

HTTP.put("http://example.com", body: "data")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



61
62
63
# File 'lib/http/chainable/verbs.rb', line 61

def put(uri, **, &)
  request(:put, uri, **, &) # steep:ignore
end

#trace(uri) {|response| ... } ⇒ HTTP::Response, Object

Echo the request back to the client

Examples:

HTTP.trace("http://example.com")

Parameters:

  • uri (String, URI)

    URI to request

  • options (Hash)

    request options

Yield Parameters:

Returns:



89
90
91
# File 'lib/http/chainable/verbs.rb', line 89

def trace(uri, **, &)
  request(:trace, uri, **, &) # steep:ignore
end