lib/flexmls_api/authentication.rb in flexmls_api-0.4.5 vs lib/flexmls_api/authentication.rb in flexmls_api-0.6.4
- old
+ new
@@ -3,13 +3,13 @@
require 'faraday'
require 'faraday_middleware'
require 'yajl'
require 'date'
-require File.expand_path('../authentication/base_auth', __FILE__)
-require File.expand_path('../authentication/api_auth', __FILE__)
-require File.expand_path('../authentication/oauth2', __FILE__)
+require 'flexmls_api/authentication/base_auth'
+require 'flexmls_api/authentication/api_auth'
+require 'flexmls_api/authentication/oauth2'
module FlexmlsApi
# =Authentication
# Mixin module for handling client authentication and reauthentication to the flexmls api. Makes
# use of the configured authentication mode (API Auth by default).
@@ -64,11 +64,10 @@
else
opts[:url] = @endpoint.sub /^https:/, "http:"
end
conn = Faraday::Connection.new(opts) do |builder|
builder.adapter Faraday.default_adapter
- builder.use Faraday::Response::ParseJson
builder.use FlexmlsApi::FaradayExt::FlexmlsMiddleware
end
FlexmlsApi.logger.debug("Connection: #{conn.inspect}")
conn
end
@@ -76,11 +75,11 @@
# HTTP request headers for client requests
def headers
{
:accept => 'application/json',
:content_type => 'application/json',
- :user_agent => user_agent,
- 'X-flexmlsApi-User-Agent' => user_agent
+ :user_agent => Configuration::DEFAULT_USER_AGENT,
+ Configuration::X_FLEXMLS_API_USER_AGENT => user_agent
}
end
end
end