Class: XeroCLI::Credentials
- Inherits:
-
Object
- Object
- XeroCLI::Credentials
- Defined in:
- lib/xero_cli/credentials.rb
Constant Summary collapse
- JSON_FILE =
'xero_credentials.json'.freeze
Class Method Summary collapse
Class Method Details
.read_guid ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/xero_cli/credentials.rb', line 11 def self.read_guid file = File.read(JSON_FILE) data_hash = JSON.parse(file) data_hash['xero_guid'] rescue StandardError 'GUID is not set' end |
.set(guid) ⇒ Object
5 6 7 8 9 |
# File 'lib/xero_cli/credentials.rb', line 5 def self.set(guid) File.open(JSON_FILE, 'w+') do |file| file.write({ 'xero_guid' => guid }.to_json) end end |