Module: MinecraftAuth

Defined in:
lib/minecraft_auth.rb,
lib/minecraft_auth/version.rb

Defined Under Namespace

Classes: Account, AccountError, Profile

Constant Summary collapse

PROTOCOL =
"https://"
BASE_URL =
"authserver.mojang.com"
ENDPOINT =
"/authenticate"
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.account(user, pass) ⇒ Object



9
10
11
# File 'lib/minecraft_auth.rb', line 9

def self.(user, pass)
  Account.new(user, pass)
end

.username_to_uuid(username) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/minecraft_auth.rb', line 13

def self.username_to_uuid(username)
  response = HTTParty.post("https://api.mojang.com/profiles/minecraft",
    :body => [username].to_json,
    :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'}
    )
  if response.length >= 1
    return response[0]["id"]
  else
    return nil
  end
end