Class: Lapis::Yggdrasil::Messaging::AuthenticationResponse

Inherits:
TokenResponse show all
Defined in:
lib/lapis/yggdrasil/messaging/authentication_response.rb

Overview

Response to a an authentication request.

Instance Attribute Summary collapse

Attributes inherited from TokenResponse

#access_token, #client_token

Attributes inherited from Response

#status

Instance Method Summary collapse

Methods inherited from Response

#ok?

Constructor Details

#initialize(message) ⇒ AuthenticationResponse

Creates a new authentication response by parsing a message from the server.

Parameters:

  • message (HTTP::Message)

    Authentication message from the server.



23
24
25
26
27
28
29
30
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 23

def initialize(message)
  super(message)
  hash = JSON.parse(message.body, :symbolize_names => true)
  @available_profiles = hash[:availableProfiles].map do |properties|
    Profile.from_properties(properties)
  end.freeze
  @selected_profile = Profile.from_properties(hash[:selectedProfile])
end

Instance Attribute Details

#available_profilesArray<Profile> (readonly)

List of profiles to choose from.

Returns:



15
16
17
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 15

def available_profiles
  @available_profiles
end

#selected_profileProfile (readonly)

Currently active profile for the user’s selected game.

Returns:



19
20
21
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 19

def selected_profile
  @selected_profile
end