Sha256: c29212868ff4635e358ed5141a246c5554e100c7f1033d800675bf5e4f94a199

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

require 'faraday_middleware'

module Gems
  module Connection
    def connection(format=format)
      options = {
        :headers => {
          'User-Agent' => user_agent,
        },
        :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
        case format.to_sym
        when :json
          connection.use Faraday::Response::ParseJson
        when :marshal
          connection.use Faraday::Response::ParseMarshal
        when :xml
          connection.use Faraday::Response::ParseXml
        end
        connection.adapter Faraday.default_adapter
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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