Class: MTProto::Type::PQInnerData
- Inherits:
-
Object
- Object
- MTProto::Type::PQInnerData
- Defined in:
- lib/mtproto/type/pq_inner_data.rb
Constant Summary collapse
- CONSTRUCTOR_DC =
0xa9f55f95- CONSTRUCTOR_TEMP_DC =
0x56fddf88
Instance Attribute Summary collapse
-
#dc ⇒ Object
readonly
Returns the value of attribute dc.
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#new_nonce ⇒ Object
readonly
Returns the value of attribute new_nonce.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#p ⇒ Object
readonly
Returns the value of attribute p.
-
#pq ⇒ Object
readonly
Returns the value of attribute pq.
-
#q ⇒ Object
readonly
Returns the value of attribute q.
-
#server_nonce ⇒ Object
readonly
Returns the value of attribute server_nonce.
Instance Method Summary collapse
-
#initialize(pq:, p:, q:, nonce:, server_nonce:, new_nonce:, dc:, expires_in: nil) ⇒ PQInnerData
constructor
A new instance of PQInnerData.
- #serialize ⇒ Object
Constructor Details
#initialize(pq:, p:, q:, nonce:, server_nonce:, new_nonce:, dc:, expires_in: nil) ⇒ PQInnerData
Returns a new instance of PQInnerData.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 13 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
#dc ⇒ Object (readonly)
Returns the value of attribute dc.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def dc @dc end |
#expires_in ⇒ Object (readonly)
Returns the value of attribute expires_in.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def expires_in @expires_in end |
#new_nonce ⇒ Object (readonly)
Returns the value of attribute new_nonce.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def new_nonce @new_nonce end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def nonce @nonce end |
#p ⇒ Object (readonly)
Returns the value of attribute p.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def p @p end |
#pq ⇒ Object (readonly)
Returns the value of attribute pq.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def pq @pq end |
#q ⇒ Object (readonly)
Returns the value of attribute q.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def q @q end |
#server_nonce ⇒ Object (readonly)
Returns the value of attribute server_nonce.
11 12 13 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 11 def server_nonce @server_nonce end |
Instance Method Details
#serialize ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/mtproto/type/pq_inner_data.rb', line 24 def serialize constructor = @expires_in ? CONSTRUCTOR_TEMP_DC : CONSTRUCTOR_DC data = Serializer.serialize_int(constructor) data += Serializer.serialize_bytes(Serializer.integer_to_bytes(@pq)) data += Serializer.serialize_bytes(Serializer.integer_to_bytes(@p)) data += Serializer.serialize_bytes(Serializer.integer_to_bytes(@q)) data += @nonce data += @server_nonce data += @new_nonce data += Serializer.serialize_int(@expires_in) if @expires_in data + Serializer.serialize_int(@dc) end |