Class: MergetrainCheck::AuthTokenStorage
- Inherits:
-
Object
- Object
- MergetrainCheck::AuthTokenStorage
- Defined in:
- lib/mergetrain_check/config.rb
Constant Summary collapse
- KEYCHAIN_SERVICE_NAME =
'mergetrain_check'
Instance Method Summary collapse
-
#initialize(host) ⇒ AuthTokenStorage
constructor
A new instance of AuthTokenStorage.
- #password ⇒ Object
- #password=(value) ⇒ Object
- #save! ⇒ Object
Constructor Details
#initialize(host) ⇒ AuthTokenStorage
Returns a new instance of AuthTokenStorage.
8 9 10 11 12 |
# File 'lib/mergetrain_check/config.rb', line 8 def initialize(host) @host = host @kitem = Keychain.generic_passwords.where(service: KEYCHAIN_SERVICE_NAME).all.detect { |k| k.account == host } @kitem = Keychain.generic_passwords.create(service: KEYCHAIN_SERVICE_NAME, password: 'secret', account: host) if @kitem.nil? end |
Instance Method Details
#password ⇒ Object
14 15 16 |
# File 'lib/mergetrain_check/config.rb', line 14 def password return @kitem.password end |
#password=(value) ⇒ Object
18 19 20 |
# File 'lib/mergetrain_check/config.rb', line 18 def password=(value) @kitem.password = value end |
#save! ⇒ Object
22 23 24 |
# File 'lib/mergetrain_check/config.rb', line 22 def save! @kitem.save! end |