Sha256: 2426e738235c2d6c1c7144805deadff995b75b9c0e45182af07b4ab5bae1a7a9

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true

gem 'typhoeus'
require 'typhoeus'

class TyphoeusAdapter
  def call(url, query, headers = {}, proxy = {})
    raise NotImplementedError, 'Proxying Not Yet Implemented' if proxy[:host]

    TyphoeusAdapter::Response.new(
      Typhoeus.get(
        url,
        params: query,
        headers: headers
      )
    )
  end

  Response =
    Struct.new(:raw) do
      delegate :body, to: :raw
      delegate :to_s, to: :body
      delegate :code, to: :raw
      delegate :headers, to: :raw

      def status
        raw.code
      end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wcc-contentful-0.2.2 lib/wcc/contentful/simple_client/typhoeus_adapter.rb
wcc-contentful-0.2.1 lib/wcc/contentful/simple_client/typhoeus_adapter.rb
wcc-contentful-0.2.0 lib/wcc/contentful/simple_client/typhoeus_adapter.rb