Module: Flubber::ApiToken
- Defined in:
- lib/api_token.rb
Constant Summary collapse
- API_TOKEN_LOCATION =
"#{ENV["HOME"]}/.flubber"
Class Method Summary collapse
Class Method Details
.api_token_exists? ⇒ Boolean
19 20 21 |
# File 'lib/api_token.rb', line 19 def self.api_token_exists? File.exists?(API_TOKEN_LOCATION) end |
.get ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/api_token.rb', line 11 def self.get return unless api_token_exists? file = File.open(API_TOKEN_LOCATION) api_token = file.readlines[0].chomp file.close api_token end |
.set(api_token) ⇒ Object
5 6 7 8 9 |
# File 'lib/api_token.rb', line 5 def self.set(api_token) File.open(API_TOKEN_LOCATION, "w") do |file| file.puts "#{api_token}" end end |