lib/evrythng/connection.rb in evrythng-0.0.1 vs lib/evrythng/connection.rb in evrythng-0.0.2

- old
+ new

@@ -1,28 +1,29 @@ require 'faraday_middleware' require 'faraday/request/multipart_with_file' require 'faraday/request/gateway' require 'faraday/request/evrythng_oauth' +require 'faraday/request/basic_authentication' require 'faraday/response/raise_http_4xx' require 'faraday/response/raise_http_5xx' module Evrythng # @private module Connection private def connection(raw=false) options = { - :headers => {'Accept' => "application/#{format}", 'User-Agent' => user_agent}, + :headers => {'Accept' => "application/vnd.evrythng-v1+json", 'User-Agent' => user_agent}, :proxy => proxy, :ssl => {:verify => false}, :url => api_endpoint, } Faraday.new(options) do |builder| builder.use Faraday::Request::MultipartWithFile - builder.use Faraday::Request::EvrythngOAuth, authentication if authenticated? builder.use Faraday::Request::Multipart + builder.use Faraday::Request::BasicAuthentication, username, password builder.use Faraday::Request::UrlEncoded builder.use Faraday::Request::Gateway, gateway if gateway builder.use Faraday::Response::RaiseHttp4xx builder.use Faraday::Response::Rashify unless raw unless raw