Specifies Http connection options
Constant Summary collapse[ :headers, :url, :params, :request, :ssl ].freeze
Github::Constants::ACCEPT, Github::Constants::ACCEPTED_OAUTH_SCOPES, Github::Constants::ACCEPT_CHARSET, Github::Constants::CACHE_CONTROL, Github::Constants::CONTENT_LENGTH, Github::Constants::CONTENT_TYPE, Github::Constants::DATE, Github::Constants::ETAG, Github::Constants::HEADER_LAST, Github::Constants::HEADER_LINK, Github::Constants::HEADER_NEXT, Github::Constants::LOCATION, Github::Constants::META_FIRST, Github::Constants::META_LAST, Github::Constants::META_NEXT, Github::Constants::META_PREV, Github::Constants::META_REL, Github::Constants::OAUTH_SCOPES, Github::Constants::PARAM_PAGE, Github::Constants::PARAM_PER_PAGE, Github::Constants::PARAM_START_PAGE, Github::Constants::RATELIMIT_LIMIT, Github::Constants::RATELIMIT_REMAINING, Github::Constants::RATELIMIT_RESET, Github::Constants::SERVER, Github::Constants::USER_AGENT
Instance Method Summary collapseCreates http connection.
Default requets header information.
Create default connection options.
Exposes middleware builder to facilitate custom stacks and easy addition of new extensions such as cache adapter.
Creates http connection
Returns a Faraday::Connection object
69 70 71 72 73 74 75 76 77 78 79 80
# File 'lib/github_api/connection.rb', line 69 def connection(api, options = {}) connection_options = default_options(options) connection_options.merge!(builder: stack(options.merge!(api: api))) if options[:connection_options] connection_options.deep_merge!(options[:connection_options]) end if ENV['DEBUG'] p "Connection options : \n" pp connection_options end Faraday.new(connection_options) end
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Default requets header information
26 27 28 29 30 31 32 33
# File 'lib/github_api/connection.rb', line 26 def { ACCEPT => 'application/vnd.github.v3+json,' \ 'application/vnd.github.beta+json;q=0.5,' \ 'application/json;q=0.1', ACCEPT_CHARSET => 'utf-8' } end#default_options(options = {}) ⇒ Hash[Symbol]
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create default connection options
41 42 43 44 45 46 47 48 49
# File 'lib/github_api/connection.rb', line 41 def default_options(options = {}) = .merge(options[:headers] || {}) .merge!({USER_AGENT => options[:user_agent]}) { headers: , ssl: options[:ssl], url: options[:endpoint] } end#stack(options = {}) ⇒ Object
Exposes middleware builder to facilitate custom stacks and easy addition of new extensions such as cache adapter.
55 56 57 58 59 60 61 62 63 64
# File 'lib/github_api/connection.rb', line 55 def stack(options = {}) @stack ||= begin builder_class = if defined?(Faraday::RackBuilder) Faraday::RackBuilder else Faraday::Builder end builder_class.new(&Github.default_middleware(options)) end end
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4