Sha256: 26396307730a68f77b74f2e4b620df85cc04799518373760325e6048b3e6b809

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

# ApiClient::Dispatcher::Typhoeus 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.get(url, :headers => ApiClient.config.header.merge(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.post(url, :body => args, :headers => ApiClient.config.header.merge(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.put(url, :body => args, :headers => ApiClient.config.header.merge(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.patch(url, :body => args, :headers => ApiClient.config.header.merge(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.delete(url, :headers => ApiClient.config.header.merge(header))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
api-client-3.1.0 lib/api-client/dispatcher/typhoeus.rb
api-client-3.0.0 lib/api-client/dispatcher/typhoeus.rb
api-client-2.7.0 lib/api-client/dispatcher/typhoeus.rb
api-client-2.6.0 lib/api-client/dispatcher/typhoeus.rb
api-client-2.5.0 lib/api-client/dispatcher/typhoeus.rb
api-client-2.5.0.rc1 lib/api-client/dispatcher/typhoeus.rb