Module: HTTP::Chainable::Verbs

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

Overview

HTTP verb shortcut methods

Each method delegates to #request with the appropriate verb.

Defined Under Namespace

Modules: _VerbsHost

Instance Method Summary collapse

Instance Method Details

#connect(uri, opts) ⇒ Response #connectvoid

Convert to a transparent TCP/IP tunnel

Examples:

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

Overloads:

  • #connect(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #connectvoid

    This method returns an undefined value.

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, opts) ⇒ Response #deletevoid

Delete a resource

Examples:

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

Overloads:

  • #delete(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #deletevoid

    This method returns an undefined value.

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, opts) ⇒ Response #getvoid

Get a resource

Examples:

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

Overloads:

  • #get(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #getvoid

    This method returns an undefined value.

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, opts) ⇒ Response #headvoid

Request a get sans response body

Examples:

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

Overloads:

  • #head(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #headvoid

    This method returns an undefined value.

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, opts) ⇒ Response #optionsvoid

Return the methods supported on the given URI

Examples:

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

Overloads:

  • #options(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #optionsvoid

    This method returns an undefined value.

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, opts) ⇒ Response #patchvoid

Apply partial modifications to a resource

Examples:

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

Overloads:

  • #patch(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #patchvoid

    This method returns an undefined value.

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, opts) ⇒ Response #postvoid

Post to a resource

Examples:

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

Overloads:

  • #post(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #postvoid

    This method returns an undefined value.

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, opts) ⇒ Response #putvoid

Put to a resource

Examples:

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

Overloads:

  • #put(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #putvoid

    This method returns an undefined value.

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, opts) ⇒ Response #tracevoid

Echo the request back to the client

Examples:

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

Overloads:

  • #trace(uri, opts) ⇒ Response

    Parameters:

    • uri (String, URI)
    • opts (Object)

    Returns:

  • #tracevoid

    This method returns an undefined value.

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