Class: AccountSerializer
- Inherits:
-
AbstractSerializer
- Object
- AbstractSerializer
- AccountSerializer
- Defined in:
- app/serializers/account_serializer.rb
Class Method Summary collapse
- .active(account) ⇒ Object
- .available_attributes ⇒ Object
- .created_at(account) ⇒ Object
- .id(account) ⇒ Object
- .props(account) ⇒ Object
- .type_index(account) ⇒ Object
Methods inherited from AbstractSerializer
Class Method Details
.active(account) ⇒ Object
13 14 15 |
# File 'app/serializers/account_serializer.rb', line 13 def active(account) { active: account.active } end |
.available_attributes ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/serializers/account_serializer.rb', line 3 def available_attributes i[ active created_at id type_index props ] end |
.created_at(account) ⇒ Object
17 18 19 |
# File 'app/serializers/account_serializer.rb', line 17 def created_at(account) { created_at: account.created_at } end |
.id(account) ⇒ Object
21 22 23 |
# File 'app/serializers/account_serializer.rb', line 21 def id(account) { id: account.id } end |
.props(account) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/serializers/account_serializer.rb', line 29 def props(account) props = case account.type_id when ::Dicts::AccountType::MANAGER_GUEST.id mg = account.manager_guest { radius: mg.radius.to_i } else {} end { props: props } end |
.type_index(account) ⇒ Object
25 26 27 |
# File 'app/serializers/account_serializer.rb', line 25 def type_index(account) { type_index: ::Dicts::AccountType.find(account.type_id).index } end |