Class: MTProto::TL::Contacts
- Inherits:
-
Object
- Object
- MTProto::TL::Contacts
- Defined in:
- lib/mtproto/tl/objects/contacts.rb
Defined Under Namespace
Constant Summary collapse
- SCHEMA_PATH =
File.('../../../../data/tl-schema.json', __dir__)
Instance Attribute Summary collapse
-
#contacts ⇒ Object
readonly
Returns the value of attribute contacts.
-
#not_modified ⇒ Object
readonly
Returns the value of attribute not_modified.
-
#saved_count ⇒ Object
readonly
Returns the value of attribute saved_count.
-
#users ⇒ Object
readonly
Returns the value of attribute users.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(contacts: [], saved_count: 0, users: [], not_modified: false) ⇒ Contacts
constructor
A new instance of Contacts.
- #not_modified? ⇒ Boolean
Constructor Details
#initialize(contacts: [], saved_count: 0, users: [], not_modified: false) ⇒ Contacts
Returns a new instance of Contacts.
15 16 17 18 19 20 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 15 def initialize(contacts: [], saved_count: 0, users: [], not_modified: false) @contacts = contacts @saved_count = saved_count @users = users @not_modified = not_modified end |
Instance Attribute Details
#contacts ⇒ Object (readonly)
Returns the value of attribute contacts.
13 14 15 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 13 def contacts @contacts end |
#not_modified ⇒ Object (readonly)
Returns the value of attribute not_modified.
13 14 15 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 13 def not_modified @not_modified end |
#saved_count ⇒ Object (readonly)
Returns the value of attribute saved_count.
13 14 15 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 13 def saved_count @saved_count end |
#users ⇒ Object (readonly)
Returns the value of attribute users.
13 14 15 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 13 def users @users end |
Class Method Details
.deserialize(data) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 30 def self.deserialize(data) constructor = data[0, 4].unpack1('L<') return new(not_modified: true) if constructor == Constructors::CONTACTS_CONTACTS_NOT_MODIFIED raise UnexpectedConstructorError, constructor unless constructor == Constructors::CONTACTS_CONTACTS offset = 4 contacts, offset = parse_contacts_vector(data, offset) saved_count = data[offset, 4].unpack1('l<') offset += 4 users, = parse_users_vector(data, offset) new(contacts: contacts, saved_count: saved_count, users: users) end |
.schema ⇒ Object
26 27 28 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 26 def self.schema @schema ||= Schema.new(SCHEMA_PATH) end |
Instance Method Details
#not_modified? ⇒ Boolean
22 23 24 |
# File 'lib/mtproto/tl/objects/contacts.rb', line 22 def not_modified? @not_modified end |