Class: MTProto::TL::ResolvedPeer

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

Class Method Summary collapse

Class Method Details

.deserialize(data) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/mtproto/tl/objects/resolved_peer.rb', line 9

def self.deserialize(data)
  constructor = data[0, 4].unpack1('L<')
  raise UnexpectedConstructorError, constructor unless constructor == Constructors::CONTACTS_RESOLVED_PEER

  type, id, offset = Reader.parse_peer(data, 4)
  chats, offset = Peers.chats_at(data, offset)
  users, = Peers.users_at(data, offset)

  { type: type, id: id, access_hash: access_hash_for(type, id, chats, users) }
end