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- MESSAGE_REPLY_HEADER =
0x6917560b- MEDIA_PHOTO =
0x695150d7- MEDIA_DOCUMENT =
0x52d8ccd9- UPDATE_NEW_MESSAGE =
0x1f2b0afd- UPDATE_NEW_CHANNEL_MESSAGE =
0x62ba04d9
Instance Attribute Summary collapse
-
#chats ⇒ Object
readonly
Returns the value of attribute chats.
-
#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.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil, chats: [], users: []) ⇒ UpdatesDifference
constructor
A new instance of UpdatesDifference.
Constructor Details
#initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil, chats: [], users: []) ⇒ UpdatesDifference
Returns a new instance of UpdatesDifference.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 13 def initialize(type:, date: nil, seq: nil, new_messages: [], pts: nil, state: nil, chats: [], users: []) @type = type @date = date @seq = seq @new_messages = @pts = pts @state = state @chats = chats @users = users end |
Instance Attribute Details
#chats ⇒ Object (readonly)
Returns the value of attribute chats.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def chats @chats end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def date @date end |
#new_messages ⇒ Object (readonly)
Returns the value of attribute new_messages.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def @new_messages end |
#pts ⇒ Object (readonly)
Returns the value of attribute pts.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def pts @pts end |
#seq ⇒ Object (readonly)
Returns the value of attribute seq.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def seq @seq end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def state @state end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def type @type end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
9 10 11 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 9 def users @users end |
Class Method Details
.deserialize(data) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 28 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
24 25 26 |
# File 'lib/mtproto/tl/objects/updates_difference.rb', line 24 def self.schema @schema ||= Schema.new(SCHEMA_PATH) end |