class Ruby::Pubg::Client

Constants

ID_API_URL
NICK_API_URL

Public Class Methods

new(api_key) click to toggle source
# File lib/ruby/pubg/client.rb, line 10
def initialize(api_key)
  @api_key = api_key
end

Public Instance Methods

find_by_name(name) click to toggle source
# File lib/ruby/pubg/client.rb, line 14
def find_by_name(name)
  response = RestClient::Request.execute(
     :method => :get,
     :url => "#{NICK_API_URL}/#{name}",
     :headers => {"TRN-Api-Key": @api_key}
  )

  JSON.parse(response)
end
find_name_by_steam_id(steam_id) click to toggle source
# File lib/ruby/pubg/client.rb, line 24
def find_name_by_steam_id(steam_id)
  response = RestClient::Request.execute(
     :method => :get,
     :url => "#{ID_API_URL}/?steamId=#{steam_id}",
     :headers => {"TRN-Api-Key": @api_key}
  )

  JSON.parse(response)
end