Module: Octokit::Configurable
- Included in:
- Octokit, Client, EnterpriseAdminClient, EnterpriseManagementConsoleClient, ManageGHESClient
- Defined in:
- lib/octokit/configurable.rb
Overview
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_endpoint ⇒ String
Base URL for API requests.
-
#auto_paginate ⇒ Boolean
Auto fetch next page of results until rate limit reached.
-
#bearer_token ⇒ Object
Returns the value of attribute bearer_token.
-
#client_id ⇒ String
Configure OAuth app key.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#connection_options ⇒ Hash
Configure connection options for Faraday.
-
#default_media_type ⇒ String
Configure preferred media type (for API versioning, for example).
-
#login ⇒ String
GitHub username for Basic Authentication.
-
#manage_ghes_endpoint ⇒ String
Base URL for API requests to the GitHub Enterprise Server Manage API.
-
#manage_ghes_password ⇒ String
API user password for requests to the GitHub Enterprise Server Manage API.
-
#manage_ghes_username ⇒ String
API username for requests to the GitHub Enterprise Server Manage API.
-
#management_console_endpoint ⇒ String
Base URL for API requests to the GitHub Enterprise management console.
-
#management_console_password ⇒ String
An admin password set up for your GitHub Enterprise management console.
-
#middleware ⇒ Faraday::Builder or Faraday::RackBuilder
Configure middleware for Faraday.
-
#netrc ⇒ Boolean
Instruct Octokit to get credentials from .netrc file.
-
#netrc_file ⇒ String
Path to .netrc file.
-
#password ⇒ String
writeonly
GitHub password for Basic Authentication.
-
#per_page ⇒ String
Configure page size for paginated results.
-
#proxy ⇒ String
URI for proxy server.
-
#ssl_verify_mode ⇒ String
SSL verify mode for ssl connections.
-
#user_agent ⇒ String
Configure User-Agent header for requests.
-
#web_endpoint ⇒ String
Base URL for generated web URLs.
Class Method Summary collapse
-
.keys ⇒ Array
List of configurable keys for Client.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
- #netrc? ⇒ Boolean
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
-
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options.
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
63 64 65 |
# File 'lib/octokit/configurable.rb', line 63 def access_token @access_token end |
#api_endpoint ⇒ String
Returns Base URL for API requests. default: https://api.github.com/.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#auto_paginate ⇒ Boolean
Returns Auto fetch next page of results until rate limit reached.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#bearer_token ⇒ Object
Returns the value of attribute bearer_token.
63 64 65 |
# File 'lib/octokit/configurable.rb', line 63 def bearer_token @bearer_token end |
#client_id ⇒ String
Returns Configure OAuth app key.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
63 64 65 |
# File 'lib/octokit/configurable.rb', line 63 def client_secret @client_secret end |
#connection_options ⇒ Hash
Returns Configure connection options for Faraday.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#default_media_type ⇒ String
Returns Configure preferred media type (for API versioning, for example).
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#login ⇒ String
Returns GitHub username for Basic Authentication.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#manage_ghes_endpoint ⇒ String
Returns Base URL for API requests to the GitHub Enterprise Server Manage API.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#manage_ghes_password ⇒ String
Returns API user password for requests to the GitHub Enterprise Server Manage API.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#manage_ghes_username ⇒ String
Returns API username for requests to the GitHub Enterprise Server Manage API.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#management_console_endpoint ⇒ String
Returns Base URL for API requests to the GitHub Enterprise management console.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#management_console_password ⇒ String
Returns An admin password set up for your GitHub Enterprise management console.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#middleware ⇒ Faraday::Builder or Faraday::RackBuilder
Returns Configure middleware for Faraday.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#netrc ⇒ Boolean
Returns Instruct Octokit to get credentials from .netrc file.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#netrc_file ⇒ String
Returns Path to .netrc file. default: ~/.netrc.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#password=(value) ⇒ String (writeonly)
Returns GitHub password for Basic Authentication.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#per_page ⇒ String
Returns Configure page size for paginated results. API default: 30.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#proxy ⇒ String
Returns URI for proxy server.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#ssl_verify_mode ⇒ String
Returns SSL verify mode for ssl connections.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#user_agent ⇒ String
Returns Configure User-Agent header for requests.
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
#web_endpoint ⇒ String
Base URL for generated web URLs
63 64 65 66 |
# File 'lib/octokit/configurable.rb', line 63 attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent |
Class Method Details
.keys ⇒ Array
List of configurable keys for Octokit::Client
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/octokit/configurable.rb', line 76 def keys @keys ||= %i[ access_token api_endpoint auto_paginate bearer_token client_id client_secret connection_options default_media_type login management_console_endpoint management_console_password manage_ghes_endpoint manage_ghes_username manage_ghes_password middleware netrc netrc_file per_page password proxy ssl_verify_mode user_agent web_endpoint ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
106 107 108 |
# File 'lib/octokit/configurable.rb', line 106 def configure yield self end |
#netrc? ⇒ Boolean
156 157 158 |
# File 'lib/octokit/configurable.rb', line 156 def netrc? !!@netrc end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/octokit/configurable.rb', line 111 def reset! # rubocop:disable Style/HashEachMethods # # This may look like a `.keys.each` which should be replaced with `#each_key`, but # this doesn't actually work, since `#keys` is just a method we've defined ourselves. # The class doesn't fulfill the whole `Enumerable` contract. Octokit::Configurable.keys.each do |key| # rubocop:enable Style/HashEachMethods instance_variable_set(:"@#{key}", Octokit::Default.[key]) end self end |
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options
129 130 131 |
# File 'lib/octokit/configurable.rb', line 129 def (opts) opts.hash == .hash end |