Class: CommandTower::Messaging::RecipientReadiness::RecipientResult
- Inherits:
-
Data
- Object
- Data
- CommandTower::Messaging::RecipientReadiness::RecipientResult
- Defined in:
- app/services/command_tower/messaging/recipient_readiness/recipient_result.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#evaluated_at ⇒ Object
readonly
Returns the value of attribute evaluated_at.
-
#recipient_id ⇒ Object
readonly
Returns the value of attribute recipient_id.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels
6 7 8 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 6 def channels @channels end |
#evaluated_at ⇒ Object (readonly)
Returns the value of attribute evaluated_at
6 7 8 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 6 def evaluated_at @evaluated_at end |
#recipient_id ⇒ Object (readonly)
Returns the value of attribute recipient_id
6 7 8 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 6 def recipient_id @recipient_id end |
Class Method Details
.build(recipient_id:, channels:, evaluated_at: Time.current) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 11 def self.build(recipient_id:, channels:, evaluated_at: Time.current) frozen_channels = channels.to_h do |key, result| [key.to_s, result] end.freeze new( recipient_id:, channels: frozen_channels, evaluated_at:, ).freeze end |
Instance Method Details
#channel(key) ⇒ Object
24 25 26 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 24 def channel(key) channels[key.to_s] end |
#ready_channel_keys ⇒ Object
28 29 30 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 28 def ready_channel_keys channels.select { |_key, result| result.ready }.keys.freeze end |
#recipient_ready_channel_keys ⇒ Object
32 33 34 |
# File 'app/services/command_tower/messaging/recipient_readiness/recipient_result.rb', line 32 def recipient_ready_channel_keys channels.select { |_key, result| result.recipient_ready }.keys.freeze end |