Class: MTProto::TL::Update

Inherits:
Object
  • Object
show all
Defined in:
lib/mtproto/tl/objects/update.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, text: nil) ⇒ Update

Returns a new instance of Update.



8
9
10
11
# File 'lib/mtproto/tl/objects/update.rb', line 8

def initialize(type, text: nil)
  @type = type
  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/mtproto/tl/objects/update.rb', line 6

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/mtproto/tl/objects/update.rb', line 6

def type
  @type
end

Class Method Details

.deserialize(bytes) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mtproto/tl/objects/update.rb', line 13

def self.deserialize(bytes)
  constructor_id = bytes[0, 4].unpack1('L<')
  type = type_name(constructor_id)

  case constructor_id
  when Constructors::UPDATE_NEW_MESSAGE
    text = extract_new_message_text(bytes)
    new(type, text: text)
  else
    new(type)
  end
end