Module: ApiClient::Dispatcher::NetHttp

Defined in:
lib/api-client/dispatcher/net-http.rb

Overview

ApiClient::Dispatcher::NetHttp provides methods to make requests using the native ruby library 'net/http'

Class Method Summary collapse

Class Method Details

.delete(url, header = {}) ⇒ HTTP

Make a delete request and returns it.

Parameters:

  • url (String)

    of the api request.

  • header (Hash) (defaults to: {})

    attributes of the request.

Returns:

  • (HTTP)

    the response object.


50
51
52
# File 'lib/api-client/dispatcher/net-http.rb', line 50

def self.delete(url, header = {})
  dispatch(:delete, url, { :header => header })
end

.get(url, header = {}) ⇒ HTTP

Make a get request and returns it.

Parameters:

  • url (String)

    of the api request.

  • header (Hash) (defaults to: {})

    attributes of the request.

Returns:

  • (HTTP)

    the response object.


11
12
13
# File 'lib/api-client/dispatcher/net-http.rb', line 11

def self.get(url, header = {})
  dispatch(:get, url, { :header => header })
end

.patch(url, args, header = {}) ⇒ HTTP

Make a patch request and returns it.

Parameters:

  • url (String)

    of the api request.

  • args (Hash)

    attributes of object.

  • header (Hash) (defaults to: {})

    attributes of the request.

Returns:

  • (HTTP)

    the response object.


41
42
43
# File 'lib/api-client/dispatcher/net-http.rb', line 41

def self.patch(url, args, header = {})
  dispatch(:patch, url, { :args => args, :header => header })
end

.post(url, args, header = {}) ⇒ HTTP

Make a post request and returns it.

Parameters:

  • url (String)

    of the api request.

  • args (Hash)

    attributes of object.

  • header (Hash) (defaults to: {})

    attributes of the request.

Returns:

  • (HTTP)

    the response object.


21
22
23
# File 'lib/api-client/dispatcher/net-http.rb', line 21

def self.post(url, args, header = {})
  dispatch(:post, url, { :args => args, :header => header })
end

.put(url, args, header = {}) ⇒ HTTP

Make a put request and returns it.

Parameters:

  • url (String)

    of the api request.

  • args (Hash)

    attributes of object.

  • header (Hash) (defaults to: {})

    attributes of the request.

Returns:

  • (HTTP)

    the response object.


31
32
33
# File 'lib/api-client/dispatcher/net-http.rb', line 31

def self.put(url, args, header = {})
  dispatch(:put, url, { :args => args, :header => header })
end