Class: Messenger::Parameters::Message

Inherits:
Object
  • Object
show all
Includes:
Callback
Defined in:
lib/messenger/parameters/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callback

#type

Constructor Details

#initialize(mid:, seq:, sticker_id: nil, text: nil, attachments: nil, is_echo: nil, app_id: nil, metadata: nil) ⇒ Message

Returns a new instance of Message.



8
9
10
11
12
13
14
15
16
17
# File 'lib/messenger/parameters/message.rb', line 8

def initialize(mid:, seq:, sticker_id: nil, text: nil, attachments: nil, is_echo: nil, app_id: nil, metadata: nil)
  @mid         = mid
  @seq         = seq
  @sticker_id  = sticker_id if sticker_id.present?
  @text        = text if text.present?
  @attachments = build_attachments(attachments) if attachments.present?
  @is_echo     = is_echo
  @app_id      = app_id
      = 
end

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def app_id
  @app_id
end

#attachmentsObject

Returns the value of attribute attachments.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def attachments
  @attachments
end

#is_echoObject

Returns the value of attribute is_echo.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def is_echo
  @is_echo
end

#metadataObject

Returns the value of attribute metadata.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def 
  
end

#midObject

Returns the value of attribute mid.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def mid
  @mid
end

#seqObject

Returns the value of attribute seq.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def seq
  @seq
end

#sticker_idObject

Returns the value of attribute sticker_id.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def sticker_id
  @sticker_id
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/messenger/parameters/message.rb', line 6

def text
  @text
end

Instance Method Details

#build_attachments(attachments) ⇒ Object



19
20
21
# File 'lib/messenger/parameters/message.rb', line 19

def build_attachments(attachments)
  attachments.map { |attachment| Attachment.new(attachment.symbolize_keys.slice(:type, :payload)) }
end