Class: MTProto::TL::GetDifference

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Binary

#b_u32, #b_u64, #u32_b, #u64_b

Constructor Details

#initialize(pts:, date:, qts:, pts_limit: nil, pts_total_limit: nil, qts_limit: nil) ⇒ GetDifference

Returns a new instance of GetDifference.



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

def initialize(pts:, date:, qts:, pts_limit: nil, pts_total_limit: nil, qts_limit: nil)
  @pts = pts
  @date = date
  @qts = qts
  @pts_limit = pts_limit
  @pts_total_limit = pts_total_limit
  @qts_limit = qts_limit
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



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

def date
  @date
end

#ptsObject (readonly)

Returns the value of attribute pts.



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

def pts
  @pts
end

#pts_limitObject (readonly)

Returns the value of attribute pts_limit.



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

def pts_limit
  @pts_limit
end

#pts_total_limitObject (readonly)

Returns the value of attribute pts_total_limit.



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

def pts_total_limit
  @pts_total_limit
end

#qtsObject (readonly)

Returns the value of attribute qts.



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

def qts
  @qts
end

#qts_limitObject (readonly)

Returns the value of attribute qts_limit.



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

def qts_limit
  @qts_limit
end

Instance Method Details

#serializeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/mtproto/tl/objects/get_difference.rb', line 19

def serialize
  flags = 0
  flags |= (1 << 0) if @pts_limit
  flags |= (1 << 1) if @pts_total_limit
  flags |= (1 << 2) if @qts_limit

  result = u32_b(Constructors::UPDATES_GET_DIFFERENCE) + u32_b(flags) + u32_b(@pts)
  result += u32_b(@pts_limit) if @pts_limit
  result += u32_b(@pts_total_limit) if @pts_total_limit
  result += u32_b(@date) + u32_b(@qts)
  result += u32_b(@qts_limit) if @qts_limit
  result
end