Module: Github::Configuration
- Included in:
- Github
- Defined in:
- lib/github_api/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :client_id, :client_secret, :oauth_token, :endpoint, :site, :ssl, :mime_type, :user_agent, :connection_options, :repo, :user, :org, :login, :password, :basic_auth, :auto_pagination ].freeze
- DEFAULT_ADAPTER =
Other adapters are :typhoeus, :patron, :em_synchrony, :excon, :test
:net_http
- DEFAULT_CLIENT_ID =
By default, don’t set an application key
nil
- DEFAULT_CLIENT_SECRET =
By default, don’t set an application secret
nil
- DEFAULT_OAUTH_TOKEN =
By default, don’t set a user oauth access token
nil
- DEFAULT_LOGIN =
By default, don’t set a user login name
nil
- DEFAULT_PASSWORD =
By default, don’t set a user password
nil
- DEFAULT_BASIC_AUTH =
By default, don’t set a user basic authentication
nil
- DEFAULT_ENDPOINT =
The api endpoint used to connect to GitHub if none is set
'https://api.github.com'.freeze
- DEFAULT_SITE =
The web endpoint used to connect to GitHub if none is set
'https://github.com'.freeze
- DEFAULT_SSL =
The default SSL configuration
{ :ca_file => File.('../ssl_certs/cacerts.pem', __FILE__) }
- DEFAULT_USER_AGENT =
The value sent in the http header for ‘User-Agent’ if none is set
"Github Ruby Gem #{Github::VERSION::STRING}".freeze
- DEFAULT_MIME_TYPE =
By default the
Accept
header will make a request forJSON
:json
- DEFAULT_CONNECTION_OPTIONS =
By default uses the Faraday connection options if none is set
{}
- DEFAULT_USER =
By default, don’t set user name
nil
- DEFAULT_REPO =
By default, don’t set repository name
nil
- DEFAULT_ORG =
By default, don’t set organization name
nil
- DEFAULT_AUTO_PAGINATION =
By default, don’t traverse the page links
false
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options.
- #options ⇒ Object
-
#reset! ⇒ Object
Reset configuration options to their defaults.
Class Method Details
.extended(base) ⇒ Object
86 87 88 |
# File 'lib/github_api/configuration.rb', line 86 def self.extended(base) base.reset! end |
.keys ⇒ Object
91 92 93 |
# File 'lib/github_api/configuration.rb', line 91 def keys VALID_OPTIONS_KEYS end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options
82 83 84 |
# File 'lib/github_api/configuration.rb', line 82 def configure yield self end |
#options ⇒ Object
96 97 98 99 100 |
# File 'lib/github_api/configuration.rb', line 96 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset! ⇒ Object
Reset configuration options to their defaults
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/github_api/configuration.rb', line 104 def reset! self.adapter = DEFAULT_ADAPTER self.client_id = DEFAULT_CLIENT_ID self.client_secret = DEFAULT_CLIENT_SECRET self.oauth_token = DEFAULT_OAUTH_TOKEN self.endpoint = DEFAULT_ENDPOINT self.site = DEFAULT_SITE self.ssl = DEFAULT_SSL self.user_agent = DEFAULT_USER_AGENT self. = DEFAULT_CONNECTION_OPTIONS self.mime_type = DEFAULT_MIME_TYPE self.user = DEFAULT_USER self.repo = DEFAULT_REPO self.org = DEFAULT_ORG self.login = DEFAULT_LOGIN self.password = DEFAULT_PASSWORD self.basic_auth = DEFAULT_BASIC_AUTH self.auto_pagination = DEFAULT_AUTO_PAGINATION self end |