Sha256: 8eb0d9438befdb472fcf2363371ddbdfc4141db080d24cbd87deff1efaad8dbd

Contents?: true

Size: 624 Bytes

Versions: 5

Compression:

Stored size: 624 Bytes

Contents

require 'mrkt/faraday_middleware'

module Mrkt
  module Connection
    def connection
      @connection ||= init_connection
    end

    def init_connection
      Faraday.new(url: "https://#{@host}") do |conn|
        conn.request :multipart
        conn.request :url_encoded

        conn.response :logger if @debug
        conn.response :mkto, content_type: /\bjson$/

        conn.options.timeout = @options[:read_timeout] if @options.key?(:read_timeout)
        conn.options.open_timeout = @options[:open_timeout] if @options.key?(:open_timeout)

        conn.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mrkt-0.6.2 lib/mrkt/concerns/connection.rb
mrkt-0.6.1 lib/mrkt/concerns/connection.rb
mrkt-0.6.0 lib/mrkt/concerns/connection.rb
mrkt-0.5.0 lib/mrkt/concerns/connection.rb
mrkt-0.4.0 lib/mrkt/concerns/connection.rb