Class: CommandTower::Messaging::Inbox::ItemResult
- Inherits:
-
Data
- Object
- Data
- CommandTower::Messaging::Inbox::ItemResult
- Defined in:
- app/services/command_tower/messaging/inbox/item_result.rb
Instance Attribute Summary collapse
-
#archived_at ⇒ Object
readonly
Returns the value of attribute archived_at.
-
#communication_id ⇒ Object
readonly
Returns the value of attribute communication_id.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#deleted_at ⇒ Object
readonly
Returns the value of attribute deleted_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#recipient_id ⇒ Object
readonly
Returns the value of attribute recipient_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#viewed_at ⇒ Object
readonly
Returns the value of attribute viewed_at.
Class Method Summary collapse
- .build(id:, communication_id:, recipient_id:, title:, status:, viewed_at:, archived_at:, deleted_at:, created_at:, updated_at:) ⇒ Object
- .from_record(inbox_item) ⇒ Object
Instance Attribute Details
#archived_at ⇒ Object (readonly)
Returns the value of attribute archived_at
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def archived_at @archived_at end |
#communication_id ⇒ Object (readonly)
Returns the value of attribute communication_id
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def communication_id @communication_id end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def created_at @created_at end |
#deleted_at ⇒ Object (readonly)
Returns the value of attribute deleted_at
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def deleted_at @deleted_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def id @id end |
#recipient_id ⇒ Object (readonly)
Returns the value of attribute recipient_id
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def recipient_id @recipient_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def updated_at @updated_at end |
#viewed_at ⇒ Object (readonly)
Returns the value of attribute viewed_at
6 7 8 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 6 def viewed_at @viewed_at end |
Class Method Details
.build(id:, communication_id:, recipient_id:, title:, status:, viewed_at:, archived_at:, deleted_at:, created_at:, updated_at:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 18 def self.build( id:, communication_id:, recipient_id:, title:, status:, viewed_at:, archived_at:, deleted_at:, created_at:, updated_at: ) new( id:, communication_id:, recipient_id:, title: title.to_s, status: status.to_s, viewed_at:, archived_at:, deleted_at:, created_at:, updated_at:, ).freeze end |
.from_record(inbox_item) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/services/command_tower/messaging/inbox/item_result.rb', line 44 def self.from_record(inbox_item) communication = inbox_item.communication raise InvariantError, "inbox item missing communication" if communication.nil? build( id: inbox_item.id, communication_id: inbox_item.communication_id, recipient_id: communication.user_id, title: communication.title, status: inbox_item.lifecycle_label, viewed_at: inbox_item.viewed_at, archived_at: inbox_item.archived_at, deleted_at: inbox_item.deleted_at, created_at: inbox_item.created_at, updated_at: inbox_item.updated_at, ) end |