Class: MTProto::TL::UpdatesDifference
- Inherits:
-
Object
- Object
- MTProto::TL::UpdatesDifference
- Defined in:
- lib/mtproto/tl/objects/updates_difference.rb
Constant Summary collapse
- SCHEMA_PATH =
File.('../../../../data/tl-schema.json', __dir__)
- MESSAGE_CONSTRUCTOR =
Constructors::MESSAGE
- MESSAGE_SERVICE =
0x7a800e0a- MESSAGE_EMPTY =
0x90a6ca84
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#new_messages ⇒ Object
readonly
Returns the value of attribute new_messages.
-
#pts ⇒ Object
readonly
Returns the value of attribute pts.
-
#seq ⇒ Object
readonly
Returns the value of attribute seq.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil) ⇒ UpdatesDifference
constructor
A new instance of UpdatesDifference.
Constructor Details
#initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil) ⇒ UpdatesDifference
Returns a new instance of UpdatesDifference.
12 13 14 15 16 17 18 19 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 12 def initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil) @type = type @date = date @seq = seq @new_messages = @pts = pts @state = state end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def date @date end |
#new_messages ⇒ Object (readonly)
Returns the value of attribute new_messages.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def @new_messages end |
#pts ⇒ Object (readonly)
Returns the value of attribute pts.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def pts @pts end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def seq @seq end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def state @state end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 8 def type @type end |
Class Method Details
.deserialize(data) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 25 def self.deserialize(data) constructor = data[0, 4].unpack1('L<') case constructor when Constructors::UPDATES_DIFFERENCE_EMPTY parse_empty(data) when Constructors::UPDATES_DIFFERENCE, Constructors::UPDATES_DIFFERENCE_SLICE parse_difference(data, constructor) when Constructors::UPDATES_DIFFERENCE_TOO_LONG new(type: :too_long, pts: data[4, 4].unpack1('L<')) else warn "Unknown Difference constructor: 0x#{constructor.to_s(16)}, treating as empty" new(type: :empty, date: Time.now.to_i, seq: 0) end end |
.schema ⇒ Object
21 22 23 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 21 def self.schema @schema ||= Schema.new(SCHEMA_PATH) end |