Class: CommandTower::Messaging::Execution::AdapterRequest
- Inherits:
-
Data
- Object
- Data
- CommandTower::Messaging::Execution::AdapterRequest
- Defined in:
- app/services/command_tower/messaging/execution/adapter_request.rb
Instance Attribute Summary collapse
-
#attempt_id ⇒ Object
readonly
Returns the value of attribute attempt_id.
-
#channel_delivery_id ⇒ Object
readonly
Returns the value of attribute channel_delivery_id.
-
#channel_key ⇒ Object
readonly
Returns the value of attribute channel_key.
-
#communication_id ⇒ Object
readonly
Returns the value of attribute communication_id.
-
#rendered ⇒ Object
readonly
Returns the value of attribute rendered.
Class Method Summary collapse
Instance Attribute Details
#attempt_id ⇒ Object (readonly)
Returns the value of attribute attempt_id
6 7 8 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 6 def attempt_id @attempt_id end |
#channel_delivery_id ⇒ Object (readonly)
Returns the value of attribute channel_delivery_id
6 7 8 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 6 def channel_delivery_id @channel_delivery_id end |
#channel_key ⇒ Object (readonly)
Returns the value of attribute channel_key
6 7 8 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 6 def channel_key @channel_key end |
#communication_id ⇒ Object (readonly)
Returns the value of attribute communication_id
6 7 8 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 6 def communication_id @communication_id end |
#rendered ⇒ Object (readonly)
Returns the value of attribute rendered
6 7 8 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 6 def rendered @rendered end |
Class Method Details
.build(channel_delivery_id:, communication_id:, channel_key:, attempt_id:, rendered:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/services/command_tower/messaging/execution/adapter_request.rb', line 13 def self.build(channel_delivery_id:, communication_id:, channel_key:, attempt_id:, rendered:) raise InvalidAdapterContractError, "arbitrary hashes are not accepted" if [channel_delivery_id, communication_id, channel_key, attempt_id].any? { |v| v.is_a?(Hash) } raise InvalidAdapterContractError, "channel_delivery_id is required" if blank?(channel_delivery_id) raise InvalidAdapterContractError, "communication_id is required" if blank?(communication_id) raise InvalidAdapterContractError, "attempt_id is required" if blank?(attempt_id) raise InvalidAdapterContractError, "channel_key is required" if blank?(channel_key) raise InvalidAdapterContractError, "channel_key must be a String" unless channel_key.is_a?(String) raise InvalidAdapterContractError, "rendered is required" if rendered.nil? unless rendered.is_a?(Rendering::RenderedPayload) || rendered.is_a?(Rendering::RenderedSmsPayload) || rendered.is_a?(Rendering::RenderedPushoverPayload) raise InvalidAdapterContractError, "rendered must be a RenderedPayload, RenderedSmsPayload, or RenderedPushoverPayload" end raise InvalidAdapterContractError, "rendered must be frozen" unless rendered.frozen? new( channel_delivery_id:, communication_id:, channel_key:, attempt_id:, rendered:, ).freeze end |