Sha256: 7dbb07174d3f10b75231e217f5f17f504858cbc727d1c98d18be2bf633f2980d
Contents?: true
Size: 1.91 KB
Versions: 4
Compression:
Stored size: 1.91 KB
Contents
# encoding: utf-8 require 'faraday' require 'github_api/response' require 'github_api/response/mashify' require 'github_api/response/jsonize' require 'github_api/response/helpers' require 'github_api/response/raise_error' require 'github_api/request/oauth2' require 'github_api/request/basic_auth' require 'github_api/request/jsonize' module Github module Connection ALLOWED_OPTIONS = [ :headers, :url, :params, :request, :ssl ].freeze private def default_options(options={}) # :nodoc: { :headers => { :accept => '*/*', #accepts, :user_agent => user_agent, :content_type => 'application/x-www-form-urlencoded' }, :ssl => { :verify => false }, :url => endpoint } end def clear_cache # :nodoc: @connection = nil end def caching? # :nodoc: !@connection.nil? end def connection(options = {}) # :nodoc: merged_options = _filter_params_keys(ALLOWED_OPTIONS, default_options.merge(options)) clear_cache unless options.empty? @connection ||= begin Faraday.new(merged_options.merge(connection_options)) do |builder| puts options.inspect if ENV['DEBUG'] builder.use Github::Request::Jsonize builder.use Faraday::Request::Multipart builder.use Faraday::Request::UrlEncoded builder.use Faraday::Response::Logger if ENV['DEBUG'] builder.use Github::Request::OAuth2, oauth_token if oauth_token? builder.use Github::Request::BasicAuth, authentication if basic_authed? builder.use Github::Response::Helpers unless options[:raw] builder.use Github::Response::Mashify builder.use Github::Response::Jsonize end builder.use Github::Response::RaiseError builder.adapter adapter end end end end # Connection end # Github
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
github_api-0.6.0 | lib/github_api/connection.rb |
github_api-0.5.4 | lib/github_api/connection.rb |
github_api-0.5.3 | lib/github_api/connection.rb |
github_api-0.5.2 | lib/github_api/connection.rb |