lib/vertebrae/configuration.rb in vertebrae-1.0.2 vs lib/vertebrae/configuration.rb in vertebrae-1.0.4
- old
+ new
@@ -69,11 +69,11 @@
options[key] = value
end
end
def adapter
- options[:adapter] || auto_detect_adapter
+ options[:adapter] || ::Faraday.default_adapter
end
def adapter=(value)
options[:adapter] = value
end
@@ -88,11 +88,10 @@
VALID_OPTIONS_KEYS.each do |key|
default_options[key] = "Vertebrae::Configuration::DEFAULT_#{key.to_s.upcase}".constantize
end
end
-
def faraday_options
{
:headers => {
ACCEPT => "application/json;q=0.1",
ACCEPT_CHARSET => "utf-8",
@@ -115,35 +114,10 @@
self.username = auth[:username]
self.password = auth[:password]
end
end
-
def endpoint
"#{self.scheme}://#{self.host}#{self.port.present? ? ":#{self.port}" : ''}#{self.prefix}"
- end
-
- private
-
- # Auto-detect the best adapter (HTTP "driver") available, based on libraries
- # loaded by the user, preferring those with persistent connections
- # ("keep-alive") by default
- #
- # @return [Symbol]
- #
- #
- def auto_detect_adapter
- case
- when defined?(::Typhoeus)
- :typhoeus
- when defined?(::Patron)
- :patron
- when defined?(::HTTPClient)
- :httpclient
- when defined?(::Net::HTTP::Persistent)
- :net_http_persistent
- else
- ::Faraday.default_adapter
- end
end
end
end