Module: Octokit::Configurable
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.
-
#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.
-
#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.
-
#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.
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
46 47 48 |
# File 'lib/octokit/configurable.rb', line 46 def access_token @access_token end |
#api_endpoint ⇒ String
Returns Base URL for API requests. default: api.github.com/.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#auto_paginate ⇒ Boolean
Returns Auto fetch next page of results until rate limit reached.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#client_id ⇒ String
Returns Configure OAuth app key.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
46 47 48 |
# File 'lib/octokit/configurable.rb', line 46 def client_secret @client_secret end |
#connection_options ⇒ Hash
Returns Configure connection options for Faraday.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#default_media_type ⇒ String
Returns Configure preferred media type (for API versioning, for example).
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#login ⇒ String
Returns GitHub username for Basic Authentication.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#middleware ⇒ Faraday::Builder or Faraday::RackBuilder
Returns Configure middleware for Faraday.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#netrc ⇒ Boolean
Returns Instruct Octokit to get credentials from .netrc file.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#netrc_file ⇒ String
Returns Path to .netrc file. default: ~/.netrc.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#password=(value) ⇒ String (writeonly)
Returns GitHub password for Basic Authentication.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#per_page ⇒ String
Returns Configure page size for paginated results. API default: 30.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#proxy ⇒ String
Returns URI for proxy server.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#user_agent ⇒ String
Returns Configure User-Agent header for requests.
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
#web_endpoint ⇒ String
Base URL for generated web URLs
46 47 48 49 |
# File 'lib/octokit/configurable.rb', line 46 attr_accessor :access_token, :auto_paginate, :client_id, :client_secret, :default_media_type, :connection_options, :middleware, :netrc, :netrc_file, :per_page, :proxy, :user_agent |
Class Method Details
.keys ⇒ Array
List of configurable keys for Octokit::Client
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/octokit/configurable.rb', line 56 def keys @keys ||= [ :access_token, :api_endpoint, :auto_paginate, :client_id, :client_secret, :connection_options, :default_media_type, :login, :middleware, :netrc, :netrc_file, :per_page, :password, :proxy, :user_agent, :web_endpoint ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
79 80 81 |
# File 'lib/octokit/configurable.rb', line 79 def configure yield self end |
#netrc? ⇒ Boolean
109 110 111 |
# File 'lib/octokit/configurable.rb', line 109 def netrc? !!@netrc end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
84 85 86 87 88 89 |
# File 'lib/octokit/configurable.rb', line 84 def reset! Octokit::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Octokit::Default.[key]) end self end |