lib/gems/connection.rb in gems-0.0.2 vs lib/gems/connection.rb in gems-0.0.3

- old
+ new

@@ -2,22 +2,23 @@ module Gems module Connection private - def connection + def connection(format=:json) options = { - :headers => {'Accept' => 'application/json'}, :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::Rashify - connection.use Faraday::Response::ParseJson - connection.adapter(Faraday.default_adapter) + 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