Sha256: 62d95a15b2079ddfb7616894f1dc12b87551d8360eda754e93abda57dc1f4b1e

Contents?: true

Size: 613 Bytes

Versions: 5

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

require 'forwardable'
gem 'typhoeus'
require 'typhoeus'

class RestClient
  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
        extend Forwardable

        def_delegators :raw, :body, :to_s, :code, :headers

        def status
          raw.code
        end
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wcc-media-client-0.2.4 lib/rest_client/typhoeus_adapter.rb
wcc-media-client-0.2.3 lib/rest_client/typhoeus_adapter.rb
wcc-media-client-0.2.2 lib/rest_client/typhoeus_adapter.rb
wcc-media-client-0.2.1 lib/rest_client/typhoeus_adapter.rb
wcc-media-client-0.2.0 lib/rest_client/typhoeus_adapter.rb