Sha256: e0e555197191d3191c82c0bc213cddf82bc3b1e81fcdcdde0af5f3065f78001a
Contents?: true
Size: 780 Bytes
Versions: 29
Compression:
Stored size: 780 Bytes
Contents
# frozen_string_literal: true gem 'typhoeus' require 'typhoeus' class WCC::Contentful::SimpleClient::TyphoeusAdapter 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 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 class Response < SimpleDelegator delegate :to_s, to: :body def raw __getobj__ end def status code end end end
Version data entries
29 entries across 29 versions & 1 rubygems