Class: Gleis::Token
- Inherits:
-
Object
- Object
- Gleis::Token
- Defined in:
- lib/gleis/token.rb
Overview
This class manages the authentication token granted from the API server
Class Method Summary collapse
Class Method Details
.check ⇒ Object
11 12 13 14 15 |
# File 'lib/gleis/token.rb', line 11 def self.check return File.read(Config::TOKEN_FILE) if File.exist?(Config::TOKEN_FILE) abort('Not authenticated, please login first.') end |
.delete ⇒ Object
17 18 19 |
# File 'lib/gleis/token.rb', line 17 def self.delete File.delete(Config::TOKEN_FILE) if File.exist?(Config::TOKEN_FILE) end |
.save(token) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/gleis/token.rb', line 4 def self.save(token) abort('No tokens received.') unless token f = File.new(Config::TOKEN_FILE, 'w', 0o0640) f.write(token) f.close end |