Sha256: 06ed8c94a5ad6a9184aa115918f69c24c8df60ef2573c9d85b6dd1833e2d0867

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

class ShippingEasy::Http::FaradayAdapter

  extend Forwardable

  def_delegators :request, :body, :params, :base_url, :http_method, :uri

  attr_reader :request

  def initialize(request)
    @request = request
  end

  def connect!
    send(http_method)
  end

  def post
    connection.post do |req|
      req.url uri, params
      req.body = request.body
    end
  end

  def connection
    @connection ||= Faraday.new(url: base_url) do |faraday|
      faraday.adapter Faraday.default_adapter
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shipping_easy-0.2.2 lib/shipping_easy/http/faraday_adapter.rb
shipping_easy-0.2.1 lib/shipping_easy/http/faraday_adapter.rb
shipping_easy-0.2.0 lib/shipping_easy/http/faraday_adapter.rb