Class: PostProxy::MessageCard
Overview
Extra fields for the generic-template element that carries buttons.
Requires buttons. subtitle is capped at 80 characters, and both URLs
must be https.
Instance Attribute Summary collapse
-
#default_action ⇒ Object
Returns the value of attribute default_action.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ MessageCard
constructor
A new instance of MessageCard.
- #to_h ⇒ Object
Constructor Details
#initialize(**attrs) ⇒ MessageCard
Returns a new instance of MessageCard.
481 482 483 484 485 486 487 488 489 |
# File 'lib/postproxy/types.rb', line 481 def initialize(**attrs) @subtitle = nil @image_url = nil @default_action = nil super if @default_action && !@default_action.is_a?(CardDefaultAction) @default_action = CardDefaultAction.new(**@default_action.transform_keys(&:to_sym)) end end |
Instance Attribute Details
#default_action ⇒ Object
Returns the value of attribute default_action.
479 480 481 |
# File 'lib/postproxy/types.rb', line 479 def default_action @default_action end |
#image_url ⇒ Object
Returns the value of attribute image_url.
479 480 481 |
# File 'lib/postproxy/types.rb', line 479 def image_url @image_url end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
479 480 481 |
# File 'lib/postproxy/types.rb', line 479 def subtitle @subtitle end |
Instance Method Details
#to_h ⇒ Object
491 492 493 494 495 496 497 |
# File 'lib/postproxy/types.rb', line 491 def to_h { subtitle: @subtitle, image_url: @image_url, default_action: @default_action&.to_h }.compact end |