Sha256: dc8937c2f6c3729862b9bf0b9cac47d858f9ff24a072d7eb946cc77bc8e1e4a0

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 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

        if @debug
          conn.response :logger, @logger, (@log_options || {})
        end

        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

3 entries across 3 versions & 1 rubygems

Version Path
mrkt-0.9.0 lib/mrkt/concerns/connection.rb
mrkt-0.8.0 lib/mrkt/concerns/connection.rb
mrkt-0.7.0 lib/mrkt/concerns/connection.rb