Class: PostProxy::Message
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
-
#body ⇒ Object
Returns the value of attribute body.
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#card ⇒ Object
Returns the value of attribute card.
-
#chat_id ⇒ Object
Returns the value of attribute chat_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#external_comment_id ⇒ Object
Returns the value of attribute external_comment_id.
-
#external_deleted_at ⇒ Object
Returns the value of attribute external_deleted_at.
-
#external_delivered_at ⇒ Object
Returns the value of attribute external_delivered_at.
-
#external_edited_at ⇒ Object
Returns the value of attribute external_edited_at.
-
#external_id ⇒ Object
Returns the value of attribute external_id.
-
#external_posted_at ⇒ Object
Returns the value of attribute external_posted_at.
-
#external_read_at ⇒ Object
Returns the value of attribute external_read_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_unsupported ⇒ Object
Returns the value of attribute is_unsupported.
-
#platform_data ⇒ Object
Returns the value of attribute platform_data.
-
#quick_replies ⇒ Object
Returns the value of attribute quick_replies.
-
#reactions ⇒ Object
Returns the value of attribute reactions.
-
#reply_markup ⇒ Object
Returns the value of attribute reply_markup.
-
#reply_to_external_id ⇒ Object
Returns the value of attribute reply_to_external_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#tapped_action ⇒ Object
Returns the value of attribute tapped_action.
Instance Method Summary collapse
-
#initialize(**attrs) ⇒ Message
constructor
A new instance of Message.
Methods inherited from Model
Constructor Details
#initialize(**attrs) ⇒ Message
Returns a new instance of Message.
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
# File 'lib/postproxy/types.rb', line 523 def initialize(**attrs) @external_id = nil @body = nil @tag = nil @external_comment_id = nil @error_message = nil @platform_data = nil @external_posted_at = nil @external_delivered_at = nil @external_read_at = nil @external_edited_at = nil @reply_to_external_id = nil @reply_markup = nil @quick_replies = nil @buttons = nil @card = nil @tapped_action = nil @external_deleted_at = nil @reactions = [] @attachments = [] @is_unsupported = false super @external_posted_at = parse_time(@external_posted_at) @external_delivered_at = parse_time(@external_delivered_at) @external_read_at = parse_time(@external_read_at) @external_edited_at = parse_time(@external_edited_at) @external_deleted_at = parse_time(@external_deleted_at) @created_at = parse_time(@created_at) @reactions = (@reactions || []).map do |r| r.is_a?(Reaction) ? r : Reaction.new(**r.transform_keys(&:to_sym)) end @attachments = (@attachments || []).map do |a| a.is_a?(Attachment) ? a : Attachment.new(**a.transform_keys(&:to_sym)) end # Left nil rather than [] when absent — the API omits these on non-Meta # networks, and an empty array would read as "sent with none". @quick_replies = @quick_replies&.map do |q| q.is_a?(QuickReply) ? q : QuickReply.new(**q.transform_keys(&:to_sym)) end @buttons = @buttons&.map do |b| b.is_a?(MessageButton) ? b : MessageButton.new(**b.transform_keys(&:to_sym)) end if @card && !@card.is_a?(MessageCard) @card = MessageCard.new(**@card.transform_keys(&:to_sym)) end if @tapped_action && !@tapped_action.is_a?(TappedAction) @tapped_action = TappedAction.new(**@tapped_action.transform_keys(&:to_sym)) end end |
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def @attachments end |
#body ⇒ Object
Returns the value of attribute body.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def body @body end |
#buttons ⇒ Object
Returns the value of attribute buttons.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def @buttons end |
#card ⇒ Object
Returns the value of attribute card.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def card @card end |
#chat_id ⇒ Object
Returns the value of attribute chat_id.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def chat_id @chat_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def created_at @created_at end |
#direction ⇒ Object
Returns the value of attribute direction.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def direction @direction end |
#error_message ⇒ Object
Returns the value of attribute error_message.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def @error_message end |
#external_comment_id ⇒ Object
Returns the value of attribute external_comment_id.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_comment_id @external_comment_id end |
#external_deleted_at ⇒ Object
Returns the value of attribute external_deleted_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_deleted_at @external_deleted_at end |
#external_delivered_at ⇒ Object
Returns the value of attribute external_delivered_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_delivered_at @external_delivered_at end |
#external_edited_at ⇒ Object
Returns the value of attribute external_edited_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_edited_at @external_edited_at end |
#external_id ⇒ Object
Returns the value of attribute external_id.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_id @external_id end |
#external_posted_at ⇒ Object
Returns the value of attribute external_posted_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_posted_at @external_posted_at end |
#external_read_at ⇒ Object
Returns the value of attribute external_read_at.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def external_read_at @external_read_at end |
#id ⇒ Object
Returns the value of attribute id.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def id @id end |
#is_unsupported ⇒ Object
Returns the value of attribute is_unsupported.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def is_unsupported @is_unsupported end |
#platform_data ⇒ Object
Returns the value of attribute platform_data.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def platform_data @platform_data end |
#quick_replies ⇒ Object
Returns the value of attribute quick_replies.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def quick_replies @quick_replies end |
#reactions ⇒ Object
Returns the value of attribute reactions.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def reactions @reactions end |
#reply_markup ⇒ Object
Returns the value of attribute reply_markup.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def reply_markup @reply_markup end |
#reply_to_external_id ⇒ Object
Returns the value of attribute reply_to_external_id.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def reply_to_external_id @reply_to_external_id end |
#status ⇒ Object
Returns the value of attribute status.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def status @status end |
#tag ⇒ Object
Returns the value of attribute tag.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def tag @tag end |
#tapped_action ⇒ Object
Returns the value of attribute tapped_action.
515 516 517 |
# File 'lib/postproxy/types.rb', line 515 def tapped_action @tapped_action end |