Module: GrubY::RawTypes

Defined in:
lib/gruubY/raw_types.rb

Defined Under Namespace

Classes: UpdateGroupCall

Class Method Summary collapse

Class Method Details

.input_group_call(id:, access_hash:) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/gruubY/raw_types.rb', line 19

def input_group_call(id:, access_hash:)
  {
    "_" => "InputGroupCall",
    "id" => id.to_i,
    "access_hash" => access_hash.to_i
  }
end

.input_peer_selfObject



27
28
29
30
31
# File 'lib/gruubY/raw_types.rb', line 27

def input_peer_self
  {
    "_" => "InputPeerSelf"
  }
end

.join_group_call(call:, params:, muted: false, video_stopped: true, invite_hash: nil, join_as: nil) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gruubY/raw_types.rb', line 33

def join_group_call(call:, params:, muted: false, video_stopped: true, invite_hash: nil, join_as: nil)
  {
    "_" => "JoinGroupCall",
    "call" => call,
    "join_as" => join_as || input_peer_self,
    "params" => params,
    "muted" => !!muted,
    "video_stopped" => !!video_stopped,
    "invite_hash" => invite_hash
  }.compact
end

.leave_group_call(call:, source:) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/gruubY/raw_types.rb', line 45

def leave_group_call(call:, source:)
  {
    "_" => "LeaveGroupCall",
    "call" => call,
    "source" => source.to_i
  }
end

.to_data_json(data) ⇒ Object



12
13
14
15
16
17
# File 'lib/gruubY/raw_types.rb', line 12

def to_data_json(data)
  {
    "_" => "DataJSON",
    "data" => data.is_a?(String) ? data : JSON.generate(data)
  }
end

.update_group_call(payload) ⇒ Object



53
54
55
# File 'lib/gruubY/raw_types.rb', line 53

def update_group_call(payload)
  UpdateGroupCall.new(payload)
end