Module: ApiClient::Dispatcher::Typhoeus

Defined in:
lib/api-client/dispatcher/typhoeus.rb

Overview

ApiClient::Dispatcher::Typhoeus provides methods to make requests using typhoeus

Class Method Summary collapse

Class Method Details

.delete(url, header = {}) ⇒ Typhoeus::Request

Make a delete request and returns it.

Parameters:

  • url (String)

    of the api request.

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

    attributes of the request.

Returns:

  • (Typhoeus::Request)

    the response object.


47
48
49
# File 'lib/api-client/dispatcher/typhoeus.rb', line 47

def self.delete(url, header = {})
  ::Typhoeus.delete(url, :headers => ApiClient.config.header.merge(header))
end

.get(url, header = {}) ⇒ Typhoeus::Request

Make a get request and returns it.

Parameters:

  • url (String)

    of the api request.

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

    attributes of the request.

Returns:

  • (Typhoeus::Request)

    the response object.


8
9
10
# File 'lib/api-client/dispatcher/typhoeus.rb', line 8

def self.get(url, header = {})
  ::Typhoeus.get(url, :headers => ApiClient.config.header.merge(header))
end

.patch(url, args, header = {}) ⇒ Typhoeus::Request

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:

  • (Typhoeus::Request)

    the response object.


38
39
40
# File 'lib/api-client/dispatcher/typhoeus.rb', line 38

def self.patch(url, args, header = {})
  ::Typhoeus.patch(url, :body => args, :headers => ApiClient.config.header.merge(header))
end

.post(url, args, header = {}) ⇒ Typhoeus::Request

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:

  • (Typhoeus::Request)

    the response object.


18
19
20
# File 'lib/api-client/dispatcher/typhoeus.rb', line 18

def self.post(url, args, header = {})
  ::Typhoeus.post(url, :body => args, :headers => ApiClient.config.header.merge(header))
end

.put(url, args, header = {}) ⇒ Typhoeus::Request

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:

  • (Typhoeus::Request)

    the response object.


28
29
30
# File 'lib/api-client/dispatcher/typhoeus.rb', line 28

def self.put(url, args, header = {})
  ::Typhoeus.put(url, :body => args, :headers => ApiClient.config.header.merge(header))
end