Class: Kobot::Credential
- Inherits:
-
Object
- Object
- Kobot::Credential
- Defined in:
- lib/kobot/credential.rb
Overview
Credentials include id and password to login to KOT and Gmail SMTP id and password to send email notifications.
Class Attribute Summary collapse
-
.gmail_id ⇒ Object
Returns the value of attribute gmail_id.
-
.gmail_password ⇒ Object
Returns the value of attribute gmail_password.
-
.kot_id ⇒ Object
Returns the value of attribute kot_id.
-
.kot_password ⇒ Object
Returns the value of attribute kot_password.
Class Method Summary collapse
-
.load! ⇒ Object
Make sure credentials are loaded by first checking and reading from #Kobot::Config.credentials_file if it exists and then overriding any credentials if they are also supplied as environment variables in ENV.
Class Attribute Details
.gmail_id ⇒ Object
Returns the value of attribute gmail_id.
8 9 10 |
# File 'lib/kobot/credential.rb', line 8 def gmail_id @gmail_id end |
.gmail_password ⇒ Object
Returns the value of attribute gmail_password.
8 9 10 |
# File 'lib/kobot/credential.rb', line 8 def gmail_password @gmail_password end |
.kot_id ⇒ Object
Returns the value of attribute kot_id.
8 9 10 |
# File 'lib/kobot/credential.rb', line 8 def kot_id @kot_id end |
.kot_password ⇒ Object
Returns the value of attribute kot_password.
8 9 10 |
# File 'lib/kobot/credential.rb', line 8 def kot_password @kot_password end |
Class Method Details
.load! ⇒ Object
Make sure credentials are loaded by first checking and reading from #Kobot::Config.credentials_file if it exists and then overriding any credentials if they are also supplied as environment variables in ENV.
If neither #Kobot::Config.credentials_file nor ENV has all the required credentials a command line prompt will be displayed for users to input credentials which will be saved to #Config.credentials.file for later use.
KOT id and password are required by default and Gmail SMTP id and password are required only when #Kobot::Config.gmail_notify_enabled is true.
27 28 29 30 31 32 33 34 |
# File 'lib/kobot/credential.rb', line 27 def load! prompt_for_credentials until credentials_loaded @credentials.each do |attr, value| send("#{attr}=".to_sym, value) end Kobot.logger.info('Load credentials successful') Kobot.logger.debug(@credentials) end |