Class: Taxbear::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/taxbear/config.rb

Class Method Summary collapse

Class Method Details

.exists?Boolean

Checks whether the Taxbear config file exists on the users computer.

Returns:

  • (Boolean)

    whether the config file exists



9
10
11
# File 'lib/taxbear/config.rb', line 9

def exists?
  File.exist?(config_file)
end

.get_tokenString

Returns the TaxJar API token loaded from the users config file.

Returns:

  • (String)

    the TaxJar API token



16
17
18
# File 'lib/taxbear/config.rb', line 16

def get_token
  File.read(config_file)
end

.save_token(token) ⇒ Object

Saves the token to a .taxbear config file in the users home directory.



21
22
23
# File 'lib/taxbear/config.rb', line 21

def save_token(token)
  File.write(config_file, token)
end