module Flubber::ApiToken

Constants

API_TOKEN_LOCATION

Public Class Methods

api_token_exists?() click to toggle source
# File lib/api_token.rb, line 19
def self.api_token_exists?
  File.exists?(API_TOKEN_LOCATION)
end
get() click to toggle source
# 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) click to toggle source
# 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