Sha256: 2d4dc182601309171f08b2fc5a1469f2c4890b4d93043c3c2eef4c74091f9682

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

module Plaza
  module Connection

    def self.for(config_sym= :default)
      config = Plaza.configuration(config_sym)
      Faraday.new(config.base_url) do |conn|
        conn.request :json
        conn.response :json, :content_type => /\bjson$/

        config.middleware.each do |middleware|
          conn.use middleware
        end
        conn.use :http_cache, store: config.cache_store, logger: config.logger

        conn.headers[:accept] = 'application/json'

        conn.adapter Faraday.default_adapter
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plaza-0.1.1 lib/plaza/connection.rb
plaza-0.1.0 lib/plaza/connection.rb