Module: PUBG::Client::Player

Included in:
PUBG::Client
Defined in:
lib/pubg/client/player.rb

Overview

Methods for Player API

Instance Method Summary collapse

Instance Method Details

#player(player_id) ⇒ Object

Find a single player by ID

Examples:

Find player by ID

client.player('account.6782798d64c64886a80dda0c4b22fc2a')

Parameters:

  • player_id (String)

    Player account ID

See Also:



27
28
29
30
# File 'lib/pubg/client/player.rb', line 27

def player(player_id)
  path = ['shards', @region, 'players', player_id].join('/')
  get(path)
end

#players(items) ⇒ Object

Find multiple players by name or ID

Examples:

Find players

client.players('user1,user2')
client.players('account.6782798d64c64886a80dda0c4b22fc2a,befd8e5b2f9d4b438ae83126bfd5de61')

Parameters:

  • items (String)

    Comma-separated player names or account IDs

See Also:



14
15
16
17
18
19
# File 'lib/pubg/client/player.rb', line 14

def players(items)
  filter_type = items.include?('account.') ? 'playerIds' : 'playerNames'
  path = ['shards', @region, 'players'].join('/')
  options = { query: { "filter[#{filter_type}]" => items } }
  get(path, options)
end