Sha256: 33ece9ea2b62112d50980b05743c3cfaef6c06ac0efbfa1e9ee571ecf08e7c7a
Contents?: true
Size: 798 Bytes
Versions: 1
Compression:
Stored size: 798 Bytes
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 class Response < SimpleDelegator delegate :to_s, to: :body def raw __getobj__ end def status code end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wcc-contentful-1.6.2 | lib/wcc/contentful/simple_client/typhoeus_adapter.rb |