Module: PatientHttp::RequestHelper::HttpMethodHelpers

Included in:
PatientHttp::RequestHelper, ClassMethods
Defined in:
lib/patient_http/request_helper.rb

Instance Method Summary collapse

Instance Method Details

#async_delete(uri, callback:, **kwargs) ⇒ Object

Enqueues an asynchronous HTTP DELETE request.

Parameters:

  • uri (String)

    absolute URL or path (when using a request template)

  • callback (Class, String)

    callback class to handle the response

  • kwargs (Hash)

    forwarded to ‘async_request`

Returns:

  • (Object)

    return value from the registered request handler



101
102
103
# File 'lib/patient_http/request_helper.rb', line 101

def async_delete(uri, callback:, **kwargs)
  async_request(:delete, uri, callback: callback, **kwargs)
end

#async_get(uri, callback:, **kwargs) ⇒ Object

Enqueues an asynchronous HTTP GET request.

Parameters:

  • uri (String)

    absolute URL or path (when using a request template)

  • callback (Class, String)

    callback class to handle the response

  • kwargs (Hash)

    forwarded to ‘async_request`

Returns:

  • (Object)

    return value from the registered request handler



61
62
63
# File 'lib/patient_http/request_helper.rb', line 61

def async_get(uri, callback:, **kwargs)
  async_request(:get, uri, callback: callback, **kwargs)
end

#async_patch(uri, callback:, **kwargs) ⇒ Object

Enqueues an asynchronous HTTP PATCH request.

Parameters:

  • uri (String)

    absolute URL or path (when using a request template)

  • callback (Class, String)

    callback class to handle the response

  • kwargs (Hash)

    forwarded to ‘async_request`

Returns:

  • (Object)

    return value from the registered request handler



91
92
93
# File 'lib/patient_http/request_helper.rb', line 91

def async_patch(uri, callback:, **kwargs)
  async_request(:patch, uri, callback: callback, **kwargs)
end

#async_post(uri, callback:, **kwargs) ⇒ Object

Enqueues an asynchronous HTTP POST request.

Parameters:

  • uri (String)

    absolute URL or path (when using a request template)

  • callback (Class, String)

    callback class to handle the response

  • kwargs (Hash)

    forwarded to ‘async_request`

Returns:

  • (Object)

    return value from the registered request handler



71
72
73
# File 'lib/patient_http/request_helper.rb', line 71

def async_post(uri, callback:, **kwargs)
  async_request(:post, uri, callback: callback, **kwargs)
end

#async_put(uri, callback:, **kwargs) ⇒ Object

Enqueues an asynchronous HTTP PUT request.

Parameters:

  • uri (String)

    absolute URL or path (when using a request template)

  • callback (Class, String)

    callback class to handle the response

  • kwargs (Hash)

    forwarded to ‘async_request`

Returns:

  • (Object)

    return value from the registered request handler



81
82
83
# File 'lib/patient_http/request_helper.rb', line 81

def async_put(uri, callback:, **kwargs)
  async_request(:put, uri, callback: callback, **kwargs)
end