Module: Octokit::Configurable
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Extended In:
| |
Included In:
| |
Defined in: | lib/octokit/configurable.rb |
Overview
Class Method Summary
-
.keys ⇒ Array
List of configurable keys for
Client
Instance Attribute Summary
- #access_token rw
- #api_endpoint ⇒ String rw
- #api_endpoint=(value) ⇒ String rw
- #auto_paginate ⇒ Boolean rw
- #bearer_token rw
- #client_id ⇒ String rw
- #client_secret rw
- #connection_options ⇒ Hash rw
- #default_media_type ⇒ String rw
- #login ⇒ String rw
- #login=(value) ⇒ String rw
- #management_console_endpoint ⇒ String rw
- #management_console_endpoint=(value) ⇒ String rw
- #management_console_password ⇒ String rw
- #management_console_password=(value) ⇒ String rw
- #middleware ⇒ Faraday::Builder or Faraday::RackBuilder rw
- #netrc ⇒ Boolean rw
- #netrc? ⇒ Boolean rw
- #netrc_file ⇒ String rw
- #password=(value) ⇒ String writeonly
- #per_page ⇒ String rw
- #proxy ⇒ String rw
- #ssl_verify_mode ⇒ String rw
- #user_agent ⇒ String rw
-
#web_endpoint ⇒ String
rw
Base URL for generated web URLs.
- #web_endpoint=(value) ⇒ String rw
Instance Method Summary
-
#configure {|_self| ... }
Set configuration options using a block.
-
#reset!
(also: #setup)
Reset configuration options to default values.
-
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options.
-
#setup
Alias for #reset!.
- #fetch_client_id_and_secret(overrides = {}) private
- #options private
Class Method Details
.keys ⇒ Array
List of configurable keys for Client
# File 'lib/octokit/configurable.rb', line 67
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 middleware netrc netrc_file per_page password proxy ssl_verify_mode user_agent web_endpoint ] end
Instance Attribute Details
#access_token (rw)
[ GitHub ]# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#api_endpoint ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 121
def api_endpoint File.join(@api_endpoint, '') end
#api_endpoint=(value) ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#auto_paginate ⇒ Boolean
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#bearer_token (rw)
[ GitHub ]# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#client_id ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#client_secret (rw)
[ GitHub ]# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#connection_options ⇒ Hash
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#default_media_type ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#login ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 136
def login @login ||= begin user.login if token_authenticated? end end
#login=(value) ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#management_console_endpoint ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 125
def management_console_endpoint File.join(@management_console_endpoint, '') end
#management_console_endpoint=(value) ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#management_console_password ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#management_console_password=(value) ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#middleware ⇒ Faraday::Builder
or
Faraday::RackBuilder
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#netrc ⇒ Boolean
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#netrc? ⇒ Boolean
(rw)
[ GitHub ]
# File 'lib/octokit/configurable.rb', line 142
def netrc? !!@netrc end
#netrc_file ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#password=(value) ⇒ String
(writeonly)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#per_page ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#proxy ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#ssl_verify_mode ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#user_agent ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
#web_endpoint ⇒ String
(rw)
Base URL for generated web URLs
# File 'lib/octokit/configurable.rb', line 132
def web_endpoint File.join(@web_endpoint, '') end
#web_endpoint=(value) ⇒ String
(rw)
# File 'lib/octokit/configurable.rb', line 57
attr_accessor :access_token, :auto_paginate, :bearer_token, :client_id, :client_secret, :default_media_type, :, :middleware, :netrc, :netrc_file, :per_page, :proxy, :ssl_verify_mode, :user_agent
Instance Method Details
#configure {|_self| ... }
Set configuration options using a block
# File 'lib/octokit/configurable.rb', line 94
def configure yield self end
#fetch_client_id_and_secret(overrides = {}) (private)
[ GitHub ]# File 'lib/octokit/configurable.rb', line 152
def fetch_client_id_and_secret(overrides = {}) opts = .merge(overrides) opts.values_at :client_id, :client_secret end
#options (private)
[ GitHub ]#reset! Also known as: #setup
Reset configuration options to default values
# File 'lib/octokit/configurable.rb', line 99
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
# File 'lib/octokit/configurable.rb', line 117
def (opts) opts.hash == .hash end
#setup
Alias for #reset!.
# File 'lib/octokit/configurable.rb', line 111
alias setup reset!