Class: MTProto::TL::GetFile

Inherits:
Object
  • Object
show all
Includes:
Binary
Defined in:
lib/mtproto/tl/objects/get_file.rb

Constant Summary collapse

CONSTRUCTOR =
0xbe5335be
INPUT_PHOTO_FILE_LOCATION =
0x40181ffe
INPUT_DOCUMENT_FILE_LOCATION =
0xbad07584
LOCATION_CONSTRUCTORS =
{
  photo: INPUT_PHOTO_FILE_LOCATION,
  document: INPUT_DOCUMENT_FILE_LOCATION
}.freeze

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(location:, type: :photo, offset: 0, limit: 1024 * 1024) ⇒ GetFile

location: { id:, access_hash:, file_reference: (binary String), thumb_size: (String) } type: :photo for photos, :document for documents/voice/video/audio.



19
20
21
22
23
24
# File 'lib/mtproto/tl/objects/get_file.rb', line 19

def initialize(location:, type: :photo, offset: 0, limit: 1024 * 1024)
  @location = location
  @type = type
  @offset = offset
  @limit = limit
end

Instance Method Details

#serializeObject



26
27
28
29
30
31
32
33
# File 'lib/mtproto/tl/objects/get_file.rb', line 26

def serialize
  result = u32_b(CONSTRUCTOR)
  result += u32_b(0) # flags
  result += serialize_location
  result += u64_b(@offset)
  result += u32_b(@limit)
  result
end