Sha256: 72f17f1300d7a9519d01042f7cfb002b69edcde8b22ee13e95f5e3527f1b8f66
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'faraday_middleware' Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f} module Douban # @private module Connection private def connection(raw=false) options = { :headers => {'Accept' => "application/#{format}; charset=utf-8", 'User-Agent' => user_agent}, :proxy => proxy, :ssl => {:verify => false}, :url => endpoint, } Faraday::Connection.new(options) do |connection| connection.use FaradayMiddleware::OAuth2, client_id, access_token connection.use FaradayMiddleware::Mashify unless raw connection.use Faraday::Request::Multipart connection.use Faraday::Request::UrlEncoded connection.use FaradayMiddleware::Mashify unless raw unless raw case format.to_s.downcase when 'json' then connection.use Faraday::Response::ParseJson end end connection.use FaradayMiddleware::RaiseHttpException connection.adapter(adapter) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
douban_api-0.1.2 | lib/douban_api/connection.rb |
douban_api-0.1.1 | lib/douban_api/connection.rb |
douban_api-0.1.0 | lib/douban_api/connection.rb |