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.



22
23
24
25
# File 'lib/octoauth/auth.rb', line 22

def initialize(params = {})
  parse_params!(params)
  save if @options[:autosave]
end

Instance Method Details

#saveObject



27
28
29
30
31
32
# File 'lib/octoauth/auth.rb', line 27

def save
  fail 'No token to save' unless token
  fail 'No file given for config' unless config.file
  config.token = token
  config.write
end

#tokenObject



34
35
36
# File 'lib/octoauth/auth.rb', line 34

def token
  @token ||= load_token
end