Class: SafeNet::KeyHelper
- Inherits:
-
Object
- Object
- SafeNet::KeyHelper
- Defined in:
- lib/safenet.rb
Instance Method Summary collapse
- #get_token ⇒ Object
- #get_valid_token ⇒ Object
-
#initialize(client_obj) ⇒ KeyHelper
constructor
A new instance of KeyHelper.
Constructor Details
#initialize(client_obj) ⇒ KeyHelper
Returns a new instance of KeyHelper.
60 61 62 63 |
# File 'lib/safenet.rb', line 60 def initialize(client_obj) @client = client_obj @conf = {} end |
Instance Method Details
#get_token ⇒ Object
65 66 67 68 |
# File 'lib/safenet.rb', line 65 def get_token @conf = File.exists?(@client.app_info[:conf_path]) ? JSON.parse(File.read(@client.app_info[:conf_path])) : (@client.auth.auth() || {}) @conf["token"] end |
#get_valid_token ⇒ Object
70 71 72 73 74 75 |
# File 'lib/safenet.rb', line 70 def get_valid_token @last_conf = File.exists?(@client.app_info[:conf_path]) ? JSON.parse(File.read(@client.app_info[:conf_path])) : {} @client.auth.auth() unless File.exists?(@client.app_info[:conf_path]) && @client.auth.is_token_valid() @conf = JSON.parse(File.read(@client.app_info[:conf_path])) @conf["token"] end |