Class: CommandTower::Messaging::Rendering::RenderedPayload
- Inherits:
-
Data
- Object
- Data
- CommandTower::Messaging::Rendering::RenderedPayload
- Defined in:
- app/services/command_tower/messaging/rendering/rendered_payload.rb
Instance Attribute Summary collapse
-
#html_body ⇒ Object
readonly
Returns the value of attribute html_body.
-
#recipient_address ⇒ Object
readonly
Returns the value of attribute recipient_address.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#text_body ⇒ Object
readonly
Returns the value of attribute text_body.
Class Method Summary collapse
Instance Attribute Details
#html_body ⇒ Object (readonly)
Returns the value of attribute html_body
6 7 8 |
# File 'app/services/command_tower/messaging/rendering/rendered_payload.rb', line 6 def html_body @html_body end |
#recipient_address ⇒ Object (readonly)
Returns the value of attribute recipient_address
6 7 8 |
# File 'app/services/command_tower/messaging/rendering/rendered_payload.rb', line 6 def recipient_address @recipient_address end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject
6 7 8 |
# File 'app/services/command_tower/messaging/rendering/rendered_payload.rb', line 6 def subject @subject end |
#text_body ⇒ Object (readonly)
Returns the value of attribute text_body
6 7 8 |
# File 'app/services/command_tower/messaging/rendering/rendered_payload.rb', line 6 def text_body @text_body end |
Class Method Details
.build(recipient_address:, subject:, text_body:, html_body:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/command_tower/messaging/rendering/rendered_payload.rb', line 12 def self.build(recipient_address:, subject:, text_body:, html_body:) values = [recipient_address, subject, text_body, html_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!(subject, "subject") validate_required_string!(text_body, "text_body") validate_required_string!(html_body, "html_body") new( recipient_address:, subject:, text_body:, html_body:, ).freeze end |