Class: MTProto::TL::Contacts

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

Defined Under Namespace

Classes: Contact, User

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contacts: [], saved_count: 0, users: [], not_modified: false) ⇒ Contacts

Returns a new instance of Contacts.



14
15
16
17
18
19
# File 'lib/mtproto/tl/objects/contacts.rb', line 14

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

#contactsObject (readonly)

Returns the value of attribute contacts.



12
13
14
# File 'lib/mtproto/tl/objects/contacts.rb', line 12

def contacts
  @contacts
end

#not_modifiedObject (readonly)

Returns the value of attribute not_modified.



12
13
14
# File 'lib/mtproto/tl/objects/contacts.rb', line 12

def not_modified
  @not_modified
end

#saved_countObject (readonly)

Returns the value of attribute saved_count.



12
13
14
# File 'lib/mtproto/tl/objects/contacts.rb', line 12

def saved_count
  @saved_count
end

#usersObject (readonly)

Returns the value of attribute users.



12
13
14
# File 'lib/mtproto/tl/objects/contacts.rb', line 12

def users
  @users
end

Class Method Details

.deserialize(data) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mtproto/tl/objects/contacts.rb', line 25

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

Instance Method Details

#not_modified?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/mtproto/tl/objects/contacts.rb', line 21

def not_modified?
  @not_modified
end