class WCC::Contentful::SimpleClient::TyphoeusAdapter

Public Instance Methods

get(url, params = {}, headers = {}) { |req| ... } click to toggle source
# File lib/wcc/contentful/simple_client/typhoeus_adapter.rb, line 7
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 = {}, proxy = {}) click to toggle source
# File lib/wcc/contentful/simple_client/typhoeus_adapter.rb, line 19
def post(url, body, headers = {}, proxy = {})
  raise NotImplementedError, 'Proxying Not Yet Implemented' if proxy[:host]

  Response.new(
    Typhoeus.post(
      url,
      body: body.to_json,
      headers: headers
    )
  )
end