Class: Octoauth::Auth

Inherits:
Object
  • Object
show all
Defined in:
lib/octoauth/auth.rb

Overview

Authentication object

Instance Method Summary collapse

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

#saveObject



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

#tokenObject



36
37
38
# File 'lib/octoauth/auth.rb', line 36

def token
  @token ||= load_token
end