Class: MTProto::TL::ForwardMessages
- Inherits:
-
Object
- Object
- MTProto::TL::ForwardMessages
- Includes:
- Binary
- Defined in:
- lib/mtproto/tl/objects/forward_messages.rb
Constant Summary collapse
- CONSTRUCTOR =
0x978928ca
Instance Method Summary collapse
-
#initialize(from_peer:, to_peer:, ids:, random_ids: nil) ⇒ ForwardMessages
constructor
A new instance of ForwardMessages.
- #serialize ⇒ Object
Methods included from Binary
#b_u32, #b_u64, #u32_b, #u64_b
Constructor Details
#initialize(from_peer:, to_peer:, ids:, random_ids: nil) ⇒ ForwardMessages
Returns a new instance of ForwardMessages.
12 13 14 15 16 17 |
# File 'lib/mtproto/tl/objects/forward_messages.rb', line 12 def initialize(from_peer:, to_peer:, ids:, random_ids: nil) @from_peer = from_peer @to_peer = to_peer @ids = ids @random_ids = random_ids || Array.new(ids.length) { SecureRandom.random_number(2**63) } end |
Instance Method Details
#serialize ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/mtproto/tl/objects/forward_messages.rb', line 19 def serialize result = u32_b(CONSTRUCTOR) result += u32_b(0) # flags result += serialize_input_peer(@from_peer) result += u32_b(Constructors::VECTOR) + u32_b(@ids.length) @ids.each { |id| result += u32_b(id) } result += u32_b(Constructors::VECTOR) + u32_b(@random_ids.length) @random_ids.each { |rid| result += u64_b(rid) } result += serialize_input_peer(@to_peer) result end |