Class: MTProto::TL::PQInnerData

Inherits:
Object
  • Object
show all
Includes:
Binary
Defined in:
lib/mtproto/tl/objects/pq_inner_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(pq:, p:, q:, nonce:, server_nonce:, new_nonce:, dc:, expires_in: nil) ⇒ PQInnerData

Returns a new instance of PQInnerData.



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

def initialize(pq:, p:, q:, nonce:, server_nonce:, new_nonce:, dc:, expires_in: nil)
  @pq = pq
  @p = p
  @q = q
  @nonce = nonce
  @server_nonce = server_nonce
  @new_nonce = new_nonce
  @dc = dc
  @expires_in = expires_in
end

Instance Attribute Details

#dcObject (readonly)

Returns the value of attribute dc.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def dc
  @dc
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def expires_in
  @expires_in
end

#new_nonceObject (readonly)

Returns the value of attribute new_nonce.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def new_nonce
  @new_nonce
end

#nonceObject (readonly)

Returns the value of attribute nonce.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def nonce
  @nonce
end

#pObject (readonly)

Returns the value of attribute p.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def p
  @p
end

#pqObject (readonly)

Returns the value of attribute pq.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def pq
  @pq
end

#qObject (readonly)

Returns the value of attribute q.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def q
  @q
end

#server_nonceObject (readonly)

Returns the value of attribute server_nonce.



8
9
10
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 8

def server_nonce
  @server_nonce
end

Instance Method Details

#serializeObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mtproto/tl/objects/pq_inner_data.rb', line 21

def serialize
  constructor = @expires_in ? Constructors::PQ_INNER_DATA_TEMP_DC : Constructors::PQ_INNER_DATA_DC

  result = u32_b(constructor)
  result += serialize_tl_bytes(integer_to_bytes(@pq))
  result += serialize_tl_bytes(integer_to_bytes(@p))
  result += serialize_tl_bytes(integer_to_bytes(@q))
  result += @nonce.bytes
  result += @server_nonce.bytes
  result += @new_nonce.bytes
  result += u32_b(@expires_in) if @expires_in
  result += u32_b(@dc)

  result
end