Sha256: cfc008653374c4a96a9aa491a7344e2814fbc5cc060ad493425ea18eab72da41

Contents?: true

Size: 1.74 KB

Versions: 12

Compression:

Stored size: 1.74 KB

Contents

require 'typhoeus'

# ApiClient::Dispatcher provides methods to make requests using typhoeus
module ApiClient::Dispatcher::Typhoeus
  # Make a get request and returns it.
  #
  # @param [String] url of the api request.
  # @param [Hash] header attributes of the request.
  # @return [Typhoeus::Request] the response object.
  def self.get(url, header = {})
    ::Typhoeus::Request.get(url, :headers => header)
  end

  # Make a post request and returns it.
  #
  # @param [String] url of the api request.
  # @param [Hash] args attributes of object.
  # @param [Hash] header attributes of the request.
  # @return [Typhoeus::Request] the response object.
  def self.post(url, args, header = {})
    ::Typhoeus::Request.post(url, :params => args, :headers => header)
  end

  # Make a put request and returns it.
  #
  # @param [String] url of the api request.
  # @param [Hash] args attributes of object.
  # @param [Hash] header attributes of the request.
  # @return [Typhoeus::Request] the response object.
  def self.put(url, args, header = {})
    ::Typhoeus::Request.put(url, :params => args, :headers => header)
  end

  # Make a patch request and returns it.
  #
  # @param [String] url of the api request.
  # @param [Hash] args attributes of object.
  # @param [Hash] header attributes of the request.
  # @return [Typhoeus::Request] the response object.
  def self.patch(url, args, header = {})
    ::Typhoeus::Request.patch(url, :params => args, :headers => header)
  end

  # Make a delete request and returns it.
  #
  # @param [String] url of the api request.
  # @param [Hash] header attributes of the request.
  # @return [Typhoeus::Request] the response object.
  def self.delete(url, header = {})
    ::Typhoeus::Request.delete(url, :headers => header)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
api-client-2.0.0.rc2 lib/api-client/dispatcher/typhoeus.rb
api-client-2.0.0.rc1 lib/api-client/dispatcher/typhoeus.rb
api-client-1.10.0 lib/api-client/dispatcher/typhoeus.rb
api-client-1.9.1 lib/api-client/dispatcher/typhoeus.rb
api-client-1.9.0 lib/api-client/dispatcher/typhoeus.rb
api-client-1.8.2 lib/api-client/dispatcher/typhoeus.rb
api-client-1.8.1 lib/api-client/dispatcher/typhoeus.rb
api-client-1.8.0 lib/api-client/dispatcher/typhoeus.rb
api-client-1.7.1 lib/api-client/dispatcher/typhoeus.rb
api-client-1.7.0 lib/api-client/dispatcher/typhoeus.rb
api-client-1.6.1 lib/api-client/dispatcher/typhoeus.rb
api-client-1.6.0 lib/api-client/dispatcher/typhoeus.rb