Class: MTProto::RPC::GetUsers

Inherits:
Object
  • Object
show all
Defined in:
lib/mtproto/rpc/get_users.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ GetUsers

Returns a new instance of GetUsers.



9
10
11
# File 'lib/mtproto/rpc/get_users.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#callObject



13
14
15
16
17
18
# File 'lib/mtproto/rpc/get_users.rb', line 13

def call
  raise 'Auth key not generated' unless @client.auth_key

  query = Type::RPC::Users::GetUsers.build
  @client.rpc.call(query)
end

#call_syncObject



20
21
22
23
24
25
26
# File 'lib/mtproto/rpc/get_users.rb', line 20

def call_sync
  raise 'Auth key not generated' unless @client.auth_key

  query = Type::RPC::Users::GetUsers.build
  response = @client.rpc.call_sync(query)
  Type::RPC::Users::Users.parse(response)
end