Module: Plaza::Connection
- Defined in:
- lib/plaza/connection.rb
Class Method Summary collapse
Class Method Details
.for(config_sym = :default) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/plaza/connection.rb', line 4 def self.for(config_sym= :default) config = Plaza.configuration(config_sym) Faraday.new(config.base_url) do |conn| conn.request :json conn.response :json, :content_type => /\bjson$/ config.middleware.each do |middleware| conn.use middleware end conn.use :http_cache, store: config.cache_store, logger: config.logger conn.headers[:accept] = 'application/json' conn.adapter Faraday.default_adapter end end |