Please note that the gem name is case sensitive.
gem install PlayerDB
Firstly, require and initialize the library like so:
require "playerdb"
@Player = PlayerDB::Client.new- Grab a Minecraft profile
# Always catch exceptions!
begin
@Minecraft = @Player.Minecraft("jinzulen")
# General profile information
puts "# General profile information:"
puts "# ID: #{@Minecraft["id"]}"
puts "# Raw ID: #{@Minecraft["raw_id"]}"
puts "# Username: #{@Minecraft["username"]}"
puts "# Avatar: #{@Minecraft["avatar"]}\n\n"
# Name change history
@History = @Minecraft["meta"]["name_history"]
if @History.length > 1
puts "# Name change history:"
@History.each do |n|
puts "# #{n["name"]} <= Changed at: #{n["changedToAt"]}"
end
end
rescue StandardError => e
puts "#{e}"
end
# General profile information:
# ID: f0e60cbe-8f68-4e88-9d46-c60884101cde
# Raw ID: f0e60cbe8f684e889d46c60884101cde
# Username: Jinzulen
# Avatar: https://crafatar.com/avatars/f0e60cbe8f684e889d46c60884101cde
# Name change history:
# AKBAT <= Changed at: N/A (Original username)
# KhalilGr <= Changed at: 30/04/15 08:51 PM
# KhalilG <= Changed at: 23/01/16 01:11 PM
# Jinzulen <= Changed at: 10/10/17 08:24 AM- Grab a Steam profile
profilestate: The visibility status of the user's profile.
personatestate: The user's current online status.
# Always catch exceptions!
begin
@Steam = @Player.Steam("jinzulen")
# Profile
puts "# Profile:"
puts "# ID: #{@Steam["id"]}"
puts "# Username: #{@Steam["username"]}"
puts "# Avatar: #{@Steam["avatar"]}\n\n"
# Misc
puts "# Miscellaneous:"
@Steam["meta"].each { |m| puts "# #{m[0]}: #{m[1]}"}
rescue StandardError => e
puts "#{e}"
end
# Profile:
# ID: 76561198262601540
# Username: Jin
# Avatar: https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ff/ffec106a4a3b7dccce217e9c6553b73ce785b90f_full.jpg
# Miscellaneous:
# steam2id: STEAM_0:0:151167906
# steam2id_new: STEAM_1:0:151167906
# steam3id: [U:1:302335812]
# steam64id: 76561198262601540
# steamid: 76561198262601540
# communityvisibilitystate: 1
# profilestate: Private
# personaname: Jin
# profileurl: https://steamcommunity.com/id/jinzulen/
# avatar: https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ff/ffec106a4a3b7dccce217e9c6553b73ce785b90f.jpg
# avatarmedium: https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ff/ffec106a4a3b7dccce217e9c6553b73ce785b90f_medium.jpg
# avatarfull: https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ff/ffec106a4a3b7dccce217e9c6553b73ce785b90f_full.jpg
# personastate: Offline- Grab an Xbox profile
# Always catch exceptions!
begin
@Xbox = @Player.Xbox("Stallion83")
puts "# Profile:"
puts "# ID: #{@Xbox["id"]}"
puts "# Username: #{@Xbox["username"]}"
puts "# Avatar: #{@Xbox["avatar"]}"
puts "# Gamer score: #{@Xbox["meta"]["gamerscore"]}"
puts "# Account tier: #{@Xbox["meta"]["accountTier"]}"
puts "# Xbox One Rep: #{@Xbox["meta"]["xboxOneRep"]}"
puts "# Preferred color: #{@Xbox["meta"]["preferredColor"]}"
puts "# Real name: #{@Xbox["meta"]["realName"]}"
puts "# Bio: #{@Xbox["meta"]["bio"]}"
puts "# Tenure level: #{@Xbox["meta"]["tenureLevel"]}"
puts "# Watermarks: #{@Xbox["meta"]["watermarks"]}"
puts "# Location: #{@Xbox["meta"]["location"]}"
puts "# Show user as avatar: #{@Xbox["meta"]["showUserAsAvatar"]}"
rescue StandardError => e
puts "#{e}"
end
# Profile:
# ID: 2745051201447500
# Username: Stallion83
# Avatar: https://avatar-ssl.xboxlive.com/avatar/Stallion83/avatarpic-l.png
# Gamer score: 2126345
# Account tier: Gold
# Xbox One Rep: Superstar
# Preferred color: https://dlassets-ssl.xboxlive.com/public/content/ppl/colors/00009.json
# Real name: Ray Cox
# Bio: 1st to 1M & 2M Gamerscore. Mixer Partner Mixer.com/Stallion83
# Tenure level: 16
# Watermarks:
# Location: Knoxville, TN
# Show user as avatar: 1This library is published under the Apache 2.0 license.