Class: CommandTower::Messaging::Rendering::RenderedSmsPayload
- Inherits:
-
Data
- Object
- Data
- CommandTower::Messaging::Rendering::RenderedSmsPayload
- Defined in:
- app/services/command_tower/messaging/rendering/rendered_sms_payload.rb
Overview
Provider-neutral SMS rendered payload. Recipient is resolved separately at execution and included here for the adapter request contract (same as email).
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#recipient_address ⇒ Object
readonly
Returns the value of attribute recipient_address.
Class Method Summary collapse
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
8 9 10 |
# File 'app/services/command_tower/messaging/rendering/rendered_sms_payload.rb', line 8 def body @body end |
#recipient_address ⇒ Object (readonly)
Returns the value of attribute recipient_address
8 9 10 |
# File 'app/services/command_tower/messaging/rendering/rendered_sms_payload.rb', line 8 def recipient_address @recipient_address end |
Class Method Details
.build(recipient_address:, body:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/command_tower/messaging/rendering/rendered_sms_payload.rb', line 12 def self.build(recipient_address:, body:) values = [recipient_address, body] raise ArgumentError, "arbitrary hashes are not accepted" if values.any? { |v| v.is_a?(Hash) } raise ArgumentError, "ActiveRecord objects are not accepted" if values.any? { |v| active_record_like?(v) } raise ArgumentError, "raw exception objects are not accepted" if values.any? { |v| v.is_a?(Exception) } validate_required_string!(recipient_address, "recipient_address") validate_required_string!(body, "body") new( recipient_address:, body:, ).freeze end |