Class: MTProto::TL::HelpConfig

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags:, date:, expires:, test_mode:, this_dc:, dc_options:) ⇒ HelpConfig

Returns a new instance of HelpConfig.



8
9
10
11
12
13
14
15
# File 'lib/mtproto/tl/objects/help_config.rb', line 8

def initialize(flags:, date:, expires:, test_mode:, this_dc:, dc_options:)
  @flags = flags
  @date = date
  @expires = expires
  @test_mode = test_mode
  @this_dc = this_dc
  @dc_options = dc_options
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def date
  @date
end

#dc_optionsObject (readonly)

Returns the value of attribute dc_options.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def dc_options
  @dc_options
end

#expiresObject (readonly)

Returns the value of attribute expires.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def expires
  @expires
end

#flagsObject (readonly)

Returns the value of attribute flags.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def flags
  @flags
end

#test_modeObject (readonly)

Returns the value of attribute test_mode.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def test_mode
  @test_mode
end

#this_dcObject (readonly)

Returns the value of attribute this_dc.



6
7
8
# File 'lib/mtproto/tl/objects/help_config.rb', line 6

def this_dc
  @this_dc
end

Class Method Details

.deserialize(data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/mtproto/tl/objects/help_config.rb', line 17

def self.deserialize(data)
  constructor = data[0, 4].unpack1('L<')
  unless [Constructors::CONFIG, Constructors::GZIP_PACKED].include?(constructor)
    raise UnexpectedConstructorError, constructor
  end

  offset = 4
  flags = data[offset, 4].unpack1('L<')
  offset += 4
  date = data[offset, 4].unpack1('L<')
  offset += 4
  expires = data[offset, 4].unpack1('L<')
  offset += 4
  test_mode = data[offset, 4].unpack1('L<') == Constructors::BOOL_TRUE
  offset += 4
  this_dc = data[offset, 4].unpack1('L<')
  offset += 4

  offset += 4 # vector constructor
  dc_count = data[offset, 4].unpack1('L<')
  offset += 4

  dc_options = []
  dc_count.times do
    dc_option, offset = parse_dc_option(data, offset)
    dc_options << dc_option
  end

  new(
    flags: flags, date: date, expires: expires,
    test_mode: test_mode, this_dc: this_dc, dc_options: dc_options
  )
end