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'
- USER_AGENT =
Default User Agent header string
"Octokit Ruby Gem #{Octokit::VERSION}"
- MEDIA_TYPE =
Default media type
'application/vnd.github.v3+json'
- WEB_ENDPOINT =
Default WEB endpoint
'https://github.com'
- MIDDLEWARE =
Default Faraday middleware stack
Faraday::RackBuilder.new do |builder| # In Faraday 2.x, Faraday::Request::Retry was moved to a separate gem # so we use it only when it's available. if defined?(Faraday::Request::Retry) retry_exceptions = Faraday::Request::Retry::DEFAULT_EXCEPTIONS + [Octokit::ServerError] builder.use Faraday::Request::Retry, exceptions: retry_exceptions elsif defined?(Faraday::Retry::Middleware) retry_exceptions = Faraday::Retry::Middleware::DEFAULT_EXCEPTIONS + [Octokit::ServerError] builder.use Faraday::Retry::Middleware, exceptions: retry_exceptions end builder.use Octokit::Middleware::FollowRedirects builder.use Octokit::Response::RaiseError builder.use Octokit::Response::FeedParser 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.
-
.bearer_token ⇒ String
Default bearer token 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.
-
.manage_ghes_endpoint ⇒ String
Default GHES Manage API endpoint from ENV.
-
.manage_ghes_password ⇒ String
Default GHES Manage API password from ENV.
-
.manage_ghes_username ⇒ String
Default GHES Manage API username from ENV.
-
.management_console_endpoint ⇒ String
Default management console endpoint from ENV.
-
.management_console_password ⇒ String
Default management console password from ENV.
-
.middleware ⇒ Faraday::RackBuilder or Faraday::Builder
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 ⇒ Integer
Default pagination page size from ENV.
-
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV.
-
.ssl_verify_mode ⇒ Integer
Default SSL verify mode 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
59 60 61 |
# File 'lib/octokit/default.rb', line 59 def access_token ENV.fetch('OCTOKIT_ACCESS_TOKEN', nil) end |
.api_endpoint ⇒ String
Default API endpoint from ENV or API_ENDPOINT
65 66 67 |
# File 'lib/octokit/default.rb', line 65 def api_endpoint ENV.fetch('OCTOKIT_API_ENDPOINT') { API_ENDPOINT } end |
.auto_paginate ⇒ String
Default pagination preference from ENV
71 72 73 |
# File 'lib/octokit/default.rb', line 71 def auto_paginate ENV.fetch('OCTOKIT_AUTO_PAGINATE', nil) end |
.bearer_token ⇒ String
Default bearer token from ENV
77 78 79 |
# File 'lib/octokit/default.rb', line 77 def bearer_token ENV.fetch('OCTOKIT_BEARER_TOKEN', nil) end |
.client_id ⇒ String
Default OAuth app key from ENV
83 84 85 |
# File 'lib/octokit/default.rb', line 83 def client_id ENV.fetch('OCTOKIT_CLIENT_ID', nil) end |
.client_secret ⇒ String
Default OAuth app secret from ENV
89 90 91 |
# File 'lib/octokit/default.rb', line 89 def client_secret ENV.fetch('OCTOKIT_SECRET', nil) end |
.connection_options ⇒ Hash
Default options for Faraday::Connection
125 126 127 128 129 130 131 132 |
# File 'lib/octokit/default.rb', line 125 def { headers: { accept: default_media_type, user_agent: user_agent } } end |
.default_media_type ⇒ String
Default media type from ENV or MEDIA_TYPE
136 137 138 |
# File 'lib/octokit/default.rb', line 136 def default_media_type ENV.fetch('OCTOKIT_DEFAULT_MEDIA_TYPE') { MEDIA_TYPE } end |
.login ⇒ String
Default GitHub username for Basic Auth from ENV
142 143 144 |
# File 'lib/octokit/default.rb', line 142 def login ENV.fetch('OCTOKIT_LOGIN', nil) end |
.manage_ghes_endpoint ⇒ String
Default GHES Manage API endpoint from ENV
107 108 109 |
# File 'lib/octokit/default.rb', line 107 def manage_ghes_endpoint ENV.fetch('OCTOKIT_MANAGE_GHES_ENDPOINT', nil) end |
.manage_ghes_password ⇒ String
Default GHES Manage API password from ENV
119 120 121 |
# File 'lib/octokit/default.rb', line 119 def manage_ghes_password ENV.fetch('OCTOKIT_MANAGE_GHES_PASSWORD', nil) end |
.manage_ghes_username ⇒ String
Default GHES Manage API username from ENV
113 114 115 |
# File 'lib/octokit/default.rb', line 113 def manage_ghes_username ENV.fetch('OCTOKIT_MANAGE_GHES_USERNAME', nil) end |
.management_console_endpoint ⇒ String
Default management console endpoint from ENV
101 102 103 |
# File 'lib/octokit/default.rb', line 101 def management_console_endpoint ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_ENDPOINT', nil) end |
.management_console_password ⇒ String
Default management console password from ENV
95 96 97 |
# File 'lib/octokit/default.rb', line 95 def management_console_password ENV.fetch('OCTOKIT_ENTERPRISE_MANAGEMENT_CONSOLE_PASSWORD', nil) end |
.middleware ⇒ Faraday::RackBuilder or Faraday::Builder
Default middleware stack for Faraday::Connection from MIDDLEWARE
149 150 151 |
# File 'lib/octokit/default.rb', line 149 def middleware MIDDLEWARE end |
.netrc ⇒ Boolean
Default behavior for reading .netrc file
196 197 198 |
# File 'lib/octokit/default.rb', line 196 def netrc ENV.fetch('OCTOKIT_NETRC', false) end |
.netrc_file ⇒ String
Default path for .netrc file
202 203 204 |
# File 'lib/octokit/default.rb', line 202 def netrc_file ENV.fetch('OCTOKIT_NETRC_FILE') { File.join(Dir.home.to_s, '.netrc') } end |
.options ⇒ Hash
Configuration options
53 54 55 |
# File 'lib/octokit/default.rb', line 53 def Octokit::Configurable.keys.to_h { |key| [key, send(key)] } end |
.password ⇒ String
Default GitHub password for Basic Auth from ENV
155 156 157 |
# File 'lib/octokit/default.rb', line 155 def password ENV.fetch('OCTOKIT_PASSWORD', nil) end |
.per_page ⇒ Integer
Default pagination page size from ENV
161 162 163 164 165 |
# File 'lib/octokit/default.rb', line 161 def per_page page_size = ENV.fetch('OCTOKIT_PER_PAGE', nil) page_size&.to_i end |
.proxy ⇒ String
Default proxy server URI for Faraday connection from ENV
169 170 171 |
# File 'lib/octokit/default.rb', line 169 def proxy ENV.fetch('OCTOKIT_PROXY', nil) end |
.ssl_verify_mode ⇒ Integer
Default SSL verify mode from ENV
175 176 177 178 179 180 |
# File 'lib/octokit/default.rb', line 175 def ssl_verify_mode # 0 is OpenSSL::SSL::VERIFY_NONE # 1 is OpenSSL::SSL::SSL_VERIFY_PEER # the standard default for SSL is SSL_VERIFY_PEER which requires a server certificate check on the client ENV.fetch('OCTOKIT_SSL_VERIFY_MODE', 1).to_i end |
.user_agent ⇒ String
Default User-Agent header string from ENV or USER_AGENT
184 185 186 |
# File 'lib/octokit/default.rb', line 184 def user_agent ENV.fetch('OCTOKIT_USER_AGENT') { USER_AGENT } end |
.web_endpoint ⇒ String
Default web endpoint from ENV or WEB_ENDPOINT
190 191 192 |
# File 'lib/octokit/default.rb', line 190 def web_endpoint ENV.fetch('OCTOKIT_WEB_ENDPOINT') { WEB_ENDPOINT } end |