Class: MTProto::TL::DHGenResponse
- Inherits:
-
Object
- Object
- MTProto::TL::DHGenResponse
- Extended by:
- Binary
- Defined in:
- lib/mtproto/tl/objects/dh_gen_response.rb
Instance Attribute Summary collapse
-
#new_nonce_hash ⇒ Object
readonly
Returns the value of attribute new_nonce_hash.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#server_nonce ⇒ Object
readonly
Returns the value of attribute server_nonce.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Methods included from Binary
Instance Attribute Details
#new_nonce_hash ⇒ Object (readonly)
Returns the value of attribute new_nonce_hash.
8 9 10 |
# File 'lib/mtproto/tl/objects/dh_gen_response.rb', line 8 def new_nonce_hash @new_nonce_hash end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/dh_gen_response.rb', line 8 def nonce @nonce end |
#server_nonce ⇒ Object (readonly)
Returns the value of attribute server_nonce.
8 9 10 |
# File 'lib/mtproto/tl/objects/dh_gen_response.rb', line 8 def server_nonce @server_nonce end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/mtproto/tl/objects/dh_gen_response.rb', line 8 def status @status end |
Class Method Details
.deserialize(message) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mtproto/tl/objects/dh_gen_response.rb', line 10 def self.deserialize() data = .body constructor = b_u32(data[0, 4]) status = case constructor when Constructors::DH_GEN_OK then :ok when Constructors::DH_GEN_RETRY then :retry when Constructors::DH_GEN_FAIL then :fail else raise "Unexpected constructor: 0x#{constructor.to_s(16)}" end offset = 4 nonce = data[offset, 16].pack('C*') offset += 16 server_nonce = data[offset, 16].pack('C*') offset += 16 new_nonce_hash = data[offset, 16].pack('C*') new( status: status, nonce: nonce, server_nonce: server_nonce, new_nonce_hash: new_nonce_hash ) end |