lib/open311/client/connection.rb in open311-0.1.2 vs lib/open311/client/connection.rb in open311-0.2.0
- old
+ new
@@ -1,8 +1,7 @@
require 'faraday_middleware'
-require 'faraday/multipart'
-require 'faraday/raise_error'
+require 'faraday/response/raise_error'
module Open311
class Client
# @private
module Connection
@@ -14,20 +13,22 @@
:proxy => proxy,
:ssl => {:verify => false},
:url => endpoint
}
- Faraday::Connection.new(options) do |connection|
+ Faraday.new(options) do |connection|
connection.use Faraday::Request::Multipart
- connection.adapter(adapter)
- connection.use Faraday::Response::RaiseError
unless raw
+ connection.use Faraday::Response::Mashify
case format.to_s.downcase
- when 'json' then connection.use Faraday::Response::ParseJson
- when 'xml' then connection.use Faraday::Response::ParseXml
+ when 'json'
+ connection.use Faraday::Response::ParseJson
+ when 'xml'
+ connection.use Faraday::Response::ParseXml
end
- connection.use Faraday::Response::Mashify
end
+ connection.use Faraday::Response::RaiseError
+ connection.adapter(adapter)
end
end
end
end
end