Module: Octokit::Default
- Defined in:
- lib/octokit/default.rb
Overview
Default configuration options for Client
Constant Summary collapse
- API_ENDPOINT =
Default API endpoint
"https://api.github.com".freeze
- USER_AGENT =
Default User Agent header string
"Octokit Ruby Gem #{Octokit::VERSION}".freeze
- MEDIA_TYPE =
Default media type
"application/vnd.github.beta+json"
- WEB_ENDPOINT =
Default WEB endpoint
"https://github.com".freeze
- MIDDLEWARE =
Default Faraday middleware stack
Faraday::Builder.new do |builder| builder.use Octokit::Response::RaiseError builder.adapter Faraday.default_adapter end
Class Method Summary collapse
-
.access_token ⇒ String
Default access token from ENV.
-
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT.
-
.auto_paginate ⇒ String
Default pagination preference from ENV.
-
.client_id ⇒ String
Default OAuth app key from ENV.
-
.client_secret ⇒ String
Default OAuth app secret from ENV.
-
.connection_options ⇒ Hash
Default options for Faraday::Connection.
-
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE.
-
.login ⇒ String
Default GitHub username for Basic Auth from ENV.
-
.middleware ⇒ String
Default middleware stack for Faraday::Connection from MIDDLEWARE.
-
.netrc ⇒ Boolean
Default behavior for reading .netrc file.
-
.netrc_file ⇒ String
Default path for .netrc file.
-
.options ⇒ Hash
Configuration options.
-
.password ⇒ String
Default GitHub password for Basic Auth from ENV.
-
.per_page ⇒ Fixnum
Default pagination page size from ENV.
-
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV.
-
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT.
-
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT.
Class Method Details
.access_token ⇒ String
Default access token from ENV
37 38 39 |
# File 'lib/octokit/default.rb', line 37 def access_token ENV['OCTOKIT_ACCESS_TOKEN'] end |
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT
43 44 45 |
# File 'lib/octokit/default.rb', line 43 def api_endpoint ENV['OCTOKIT_API_ENDPOINT'] || API_ENDPOINT end |
.auto_paginate ⇒ String
Default pagination preference from ENV
49 50 51 |
# File 'lib/octokit/default.rb', line 49 def auto_paginate ENV['OCTOKIT_AUTO_PAGINATE'] end |
.client_id ⇒ String
Default OAuth app key from ENV
55 56 57 |
# File 'lib/octokit/default.rb', line 55 def client_id ENV['OCTOKIT_CLIENT_ID'] end |
.client_secret ⇒ String
Default OAuth app secret from ENV
61 62 63 |
# File 'lib/octokit/default.rb', line 61 def client_secret ENV['OCTOKIT_SECRET'] end |
.connection_options ⇒ Hash
Default options for Faraday::Connection
67 68 69 70 71 72 73 74 |
# File 'lib/octokit/default.rb', line 67 def { :headers => { :accept => default_media_type, :user_agent => user_agent } } end |
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE
78 79 80 |
# File 'lib/octokit/default.rb', line 78 def default_media_type ENV['OCTOKIT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE end |
.login ⇒ String
Default GitHub username for Basic Auth from ENV
84 85 86 |
# File 'lib/octokit/default.rb', line 84 def login ENV['OCTOKIT_LOGIN'] end |
.middleware ⇒ String
Default middleware stack for Faraday::Connection from MIDDLEWARE
91 92 93 |
# File 'lib/octokit/default.rb', line 91 def middleware MIDDLEWARE end |
.netrc ⇒ Boolean
Default behavior for reading .netrc file
129 130 131 |
# File 'lib/octokit/default.rb', line 129 def netrc ENV['OCTOKIT_NETRC'] || false end |
.netrc_file ⇒ String
Default path for .netrc file
135 136 137 |
# File 'lib/octokit/default.rb', line 135 def netrc_file ENV['OCTOKIT_NETRC_FILE'] || File.join(ENV['HOME'].to_s, '.netrc') end |
.options ⇒ Hash
Configuration options
31 32 33 |
# File 'lib/octokit/default.rb', line 31 def Hash[Octokit::Configurable.keys.map{|key| [key, send(key)]}] end |
.password ⇒ String
Default GitHub password for Basic Auth from ENV
97 98 99 |
# File 'lib/octokit/default.rb', line 97 def password ENV['OCTOKIT_PASSWORD'] end |
.per_page ⇒ Fixnum
Default pagination page size from ENV
103 104 105 106 107 |
# File 'lib/octokit/default.rb', line 103 def per_page page_size = ENV['OCTOKIT_PER_PAGE'] page_size.to_i if page_size end |
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV
111 112 113 |
# File 'lib/octokit/default.rb', line 111 def proxy ENV['OCTOKIT_PROXY'] end |
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT
117 118 119 |
# File 'lib/octokit/default.rb', line 117 def user_agent ENV['OCTOKIT_USER_AGENT'] || USER_AGENT end |
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT
123 124 125 |
# File 'lib/octokit/default.rb', line 123 def web_endpoint ENV['OCTOKIT_WEB_ENDPOINT'] || WEB_ENDPOINT end |