12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/mtproto/type/rpc/help/config.rb', line 12
def self.parse(response)
constructor = response[0, 4].unpack1('L<')
if constructor == Type::GzipPacked::CONSTRUCTOR
response = Type::GzipPacked.unpack(response)
constructor = response[0, 4].unpack1('L<')
end
if constructor == Type::RpcError::CONSTRUCTOR
error = Type::RpcError.deserialize(response)
raise MTProto::RpcError.new(error.error_code, error.error_message)
end
if constructor == Type::Config::CONSTRUCTOR || constructor == Type::Config::CONSTRUCTOR_ALT
Type::Config.deserialize(response)
else
raise UnexpectedConstructorError.new(constructor)
end
end
|