Sha256: bd7cb9e7ecfb89bd571f4f481eacb998273f5966ade503f3e3c84cc541af7a8f

Contents?: true

Size: 705 Bytes

Versions: 1

Compression:

Stored size: 705 Bytes

Contents

require 'faraday_middleware'

module Gems
  module Connection
    private

    def connection(format=:json)
      options = {
        :ssl => {:verify => false},
        :url => 'https://rubygems.org',
      }

      Faraday.new(options) do |connection|
        connection.use Faraday::Request::UrlEncoded
        connection.use Faraday::Response::RaiseError
        connection.use Faraday::Response::Mashify
        connection.use Faraday::Response::ParseXml if :xml == format
        connection.use Faraday::Response::ParseJson if :json == format
        connection.use Faraday::Response::ParseMarshal if :marshal == format
        connection.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gems-0.0.3 lib/gems/connection.rb