Class: MTProto::TL::Dialogs
- Inherits:
-
Object
- Object
- MTProto::TL::Dialogs
- Defined in:
- lib/mtproto/tl/objects/dialogs.rb
Defined Under Namespace
Constant Summary collapse
- SCHEMA_PATH =
File.('../../../../data/tl-schema.json', __dir__)
Instance Attribute Summary collapse
-
#chats ⇒ Object
readonly
Returns the value of attribute chats.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#dialogs ⇒ Object
readonly
Returns the value of attribute dialogs.
-
#message_dates ⇒ Object
readonly
Returns the value of attribute message_dates.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dialogs:, chats:, users:, count: nil, message_dates: {}) ⇒ Dialogs
constructor
A new instance of Dialogs.
- #slice? ⇒ Boolean
Constructor Details
#initialize(dialogs:, chats:, users:, count: nil, message_dates: {}) ⇒ Dialogs
Returns a new instance of Dialogs.
15 16 17 18 19 20 21 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 15 def initialize(dialogs:, chats:, users:, count: nil, message_dates: {}) @dialogs = dialogs @chats = chats @users = users @count = count @message_dates = end |
Instance Attribute Details
#chats ⇒ Object (readonly)
Returns the value of attribute chats.
13 14 15 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 13 def chats @chats end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
13 14 15 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 13 def count @count end |
#dialogs ⇒ Object (readonly)
Returns the value of attribute dialogs.
13 14 15 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 13 def dialogs @dialogs end |
#message_dates ⇒ Object (readonly)
Returns the value of attribute message_dates.
13 14 15 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 13 def @message_dates end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
13 14 15 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 13 def users @users end |
Class Method Details
.deserialize(data) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 31 def self.deserialize(data) constructor = data[0, 4].unpack1('L<') unless [Constructors::MESSAGES_DIALOGS, Constructors::MESSAGES_DIALOGS_SLICE].include?(constructor) raise UnexpectedConstructorError, constructor end offset = 4 count = nil if constructor == Constructors::MESSAGES_DIALOGS_SLICE count = data[offset, 4].unpack1('L<') offset += 4 end dialogs, offset = parse_dialogs_vector(data, offset) , offset = (data, offset) chats, offset = parse_chats_vector(data, offset) users, = parse_users_vector(data, offset) new(dialogs: dialogs, chats: chats, users: users, count: count, message_dates: ) end |
.schema ⇒ Object
27 28 29 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 27 def self.schema @schema ||= Schema.new(SCHEMA_PATH) end |
Instance Method Details
#slice? ⇒ Boolean
23 24 25 |
# File 'lib/mtproto/tl/objects/dialogs.rb', line 23 def slice? !@count.nil? end |