Class: Lapis::Yggdrasil::Messaging::AuthenticationResponse
- Inherits:
-
TokenResponse
- Object
- Response
- TokenResponse
- Lapis::Yggdrasil::Messaging::AuthenticationResponse
- Defined in:
- lib/lapis/yggdrasil/messaging/authentication_response.rb
Overview
Response to a an authentication request.
Instance Attribute Summary collapse
-
#available_profiles ⇒ Array<Profile>
readonly
List of profiles to choose from.
-
#selected_profile ⇒ Profile
readonly
Currently active profile for the user’s selected game.
Attributes inherited from TokenResponse
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize(message) ⇒ AuthenticationResponse
constructor
Creates a new authentication response by parsing a message from the server.
Methods inherited from Response
Constructor Details
#initialize(message) ⇒ AuthenticationResponse
Creates a new authentication response by parsing a message from the server.
23 24 25 26 27 28 29 30 |
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 23 def initialize() super() hash = JSON.parse(.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_profiles ⇒ Array<Profile> (readonly)
List of profiles to choose from.
15 16 17 |
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 15 def available_profiles @available_profiles end |
#selected_profile ⇒ Profile (readonly)
Currently active profile for the user’s selected game.
19 20 21 |
# File 'lib/lapis/yggdrasil/messaging/authentication_response.rb', line 19 def selected_profile @selected_profile end |