Sha256: f61011bccef29923151e161358faa729a1771375eac3d52c16eb97b0a4115748
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true gem 'typhoeus' require 'typhoeus' require 'ostruct' 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 def put(url, body, headers = {}, proxy = {}) raise NotImplementedError, 'Proxying Not Yet Implemented' if proxy[:host] Response.new( Typhoeus.put( 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
3 entries across 3 versions & 1 rubygems