Class: Anoubis::Output::Login
- Defined in:
- app/controllers/anoubis/output/login.rb
Overview
Output subclass that represents data for login action
Instance Attribute Summary collapse
-
#email ⇒ String
The email of the user.
-
#locale ⇒ String
The user’s locale.
-
#name ⇒ String
The name of the user.
-
#surname ⇒ String
The surname of the user.
-
#token ⇒ String
The resulting login token.
Attributes inherited from Basic
#messages, #result, #tab, #title
Instance Method Summary collapse
-
#initialize ⇒ Login
constructor
Initializes login output data.
-
#message ⇒ String
Generates output message based on self.result variable.
-
#to_h ⇒ Hash
Generates hash representation of output class.
Methods inherited from Basic
#hash_to_json, #options_to_json
Constructor Details
#initialize ⇒ Login
Initializes login output data. Generates default values.
31 32 33 34 35 36 37 38 |
# File 'app/controllers/anoubis/output/login.rb', line 31 def initialize super self.token = '' self.name = '' self.surname = '' self.email = '' self.locale = '' end |
Instance Attribute Details
#email ⇒ String
Returns the email of the user.
23 |
# File 'app/controllers/anoubis/output/login.rb', line 23 class_attribute :email |
#locale ⇒ String
Returns the user’s locale.
27 |
# File 'app/controllers/anoubis/output/login.rb', line 27 class_attribute :locale |
#name ⇒ String
Returns the name of the user.
15 |
# File 'app/controllers/anoubis/output/login.rb', line 15 class_attribute :name |
#surname ⇒ String
Returns the surname of the user.
19 |
# File 'app/controllers/anoubis/output/login.rb', line 19 class_attribute :surname |
#token ⇒ String
Returns the resulting login token.
11 |
# File 'app/controllers/anoubis/output/login.rb', line 11 class_attribute :token |
Instance Method Details
#message ⇒ String
Generates output message based on self.result variable.
59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/anoubis/output/login.rb', line 59 def case self.result when -1 return I18n.t('errors.invalid_login_parameters') when -2 return I18n.t('errors.invalid_login_or_password') else return super end end |
#to_h ⇒ Hash
Generates hash representation of output class
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/anoubis/output/login.rb', line 43 def to_h result = super.to_h return result if self.result != 0 result.merge!({ token: self.token, name: self.name, surname: self.surname, email: self.email, locale: self.locale }) result end |