Sha256: d1baccea4db70b4f9ea7033651ff31fab8e364c158e06fe965dcc41931e205e5

Contents?: true

Size: 590 Bytes

Versions: 9

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

gem 'http'
require 'http'

class HttpAdapter
  def call(url, query, headers = {}, proxy = {})
    if proxy[:host]
      HTTP[headers].via(proxy[:host], proxy[:port], proxy[:username], proxy[:password])
        .get(url, params: query)
    else
      HTTP[headers].get(url, params: query)
    end
  end

  def post(url, body, headers = {}, proxy = {})
    if proxy[:host]
      HTTP[headers].via(proxy[:host], proxy[:port], proxy[:username], proxy[:password])
        .post(url, json: body)
    else
      HTTP[headers].post(url, json: body)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
wcc-media-client-0.1.1 lib/rest_client/http_adapter.rb
wcc-media-client-0.1.0 lib/rest_client/http_adapter.rb
wcc-contentful-0.4.0.pre.rc lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.4.0.pre.beta lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.4.0.pre.alpha lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.3.0 lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.3.0.pre.rc3 lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.3.0.pre.rc2 lib/wcc/contentful/simple_client/http_adapter.rb
wcc-contentful-0.3.0.pre.rc lib/wcc/contentful/simple_client/http_adapter.rb