class PlayerDB::Client

Public Class Methods

new() click to toggle source
# File lib/PlayerDB.rb, line 7
def initialize; end

Public Instance Methods

Minecraft(id) click to toggle source
# File lib/PlayerDB.rb, line 11
def Minecraft(id); PlayerDB::Minecraft.new.Profile(id) end
Steam(id) click to toggle source
# File lib/PlayerDB.rb, line 10
def Steam(id); PlayerDB::Steam.new.Profile(id) end
Xbox(id) click to toggle source
# File lib/PlayerDB.rb, line 9
def Xbox(id); PlayerDB::Xbox.new.Profile(id) end
contact_api(resource, key) click to toggle source
# File lib/PlayerDB.rb, line 13
def contact_api(resource, key)
    begin
        response = HTTParty.get("https://playerdb.co/api/player/#{resource}/#{key}")

        response.parsed_response
    rescue HTTParty::Error => e
        raise "# [PlayerDB] Failed to retrieve resource: #{e}"
    rescue StandardError => e
        raise "# [PlayerDB] Error occurred: #{e}"
    end
end