class WCC::API::RestClient::TyphoeusAdapter

Public Instance Methods

delete(url, query = {}, headers = {}) click to toggle source
# File lib/wcc/api/rest_client/typhoeus_adapter.rb, line 40
def delete(url, query = {}, headers = {})
  Response.new(
    Typhoeus.delete(
      url,
      headers: headers
    )
  )
end
get(url, params = {}, headers = {}) { |req| ... } click to toggle source
# File lib/wcc/api/rest_client/typhoeus_adapter.rb, line 8
def get(url, params = {}, headers = {})
  req = OpenStruct.new(params: params, headers: headers)
  yield req if block_given?
  Response.new(
    Typhoeus.get(
      url,
      params: req.params,
      headers: req.headers
    )
  )
end
post(url, body, headers = {}) click to toggle source
# File lib/wcc/api/rest_client/typhoeus_adapter.rb, line 20
def post(url, body, headers = {})
  Response.new(
    Typhoeus.post(
      url,
      body: body.is_a?(String) ? body : body.to_json,
      headers: headers
    )
  )
end
put(url, body, headers = {}) click to toggle source
# File lib/wcc/api/rest_client/typhoeus_adapter.rb, line 30
def put(url, body, headers = {})
  Response.new(
    Typhoeus.put(
      url,
      body: body.is_a?(String) ? body : body.to_json,
      headers: headers
    )
  )
end