Class: Octoauth::Auth
- Inherits:
-
Object
- Object
- Octoauth::Auth
- Defined in:
- lib/octoauth/auth.rb
Overview
Authentication object
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Auth
constructor
A new instance of Auth.
- #save ⇒ Object
- #token ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Auth
Returns a new instance of Auth.
23 24 25 26 |
# File 'lib/octoauth/auth.rb', line 23 def initialize(params = {}) parse_params!(params) save if @options[:autosave] end |
Instance Method Details
#save ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/octoauth/auth.rb', line 28 def save raise 'No token to save' unless token raise 'No file given for config' unless config.file config.token = token return unless @token_changed config.write end |
#token ⇒ Object
36 37 38 |
# File 'lib/octoauth/auth.rb', line 36 def token @token ||= load_token end |