lib/nimbu-api/connection.rb in nimbu-api-0.3.0 vs lib/nimbu-api/connection.rb in nimbu-api-0.4.0
- old
+ new
@@ -14,12 +14,11 @@
].freeze
def default_options(options={})
{
:ssl => options.fetch(:ssl) { ssl },
- :url => options.fetch(:endpoint) { Nimbu.endpoint },
- :subdomain => options.fetch(:subdomain) { Nimbu.subdomain }
+ :url => options.fetch(:endpoint) { Nimbu.endpoint }
}.merge(options)
end
# Default middleware stack that uses default adapter as specified at
# configuration stage.
@@ -63,20 +62,20 @@
# addition of new extensions such as cache adapter.
#
def stack(options={}, &block)
@stack ||= begin
if block_given?
- Faraday::Builder.new(&block)
+ Faraday::RackBuilder.new(&block)
else
- Faraday::Builder.new(&default_middleware(options))
+ Faraday::RackBuilder.new(&default_middleware(options))
end
end
end
# Returns a Fraday::Connection object
#
def connection(options={})
- conn_options = default_options(options)
+ conn_options = default_options(options).keep_if {|k,_| ALLOWED_OPTIONS.include? k }
clear_cache unless options.empty?
puts "OPTIONS:#{conn_options.inspect}" if ENV['DEBUG']
Faraday.new(conn_options.merge(:builder => stack(options)))
end