Class: Lapis::Yggdrasil::Messaging::ResponseFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/lapis/yggdrasil/messaging/response_factory.rb

Overview

Parses messages from the server and builds responses from them.

Instance Method Summary collapse

Instance Method Details

#parse_authentication_response(message) ⇒ AuthenticationResponse, ErrorResponse

Generates an instance from a response to an authentication request.

Parameters:

  • message (HTTP::Message)

    Message received from the server.

Returns:

See Also:



18
19
20
21
22
23
24
# File 'lib/lapis/yggdrasil/messaging/response_factory.rb', line 18

def parse_authentication_response(message)
  if message.ok?
    AuthenticationResponse.new(message)
  else
    ErrorResponse.new(message)
  end
end

#parse_invalidate_response(message) ⇒ Response, ErrorResponse

Generates an instance from a response to an invalidation request.

Parameters:

  • message (HTTP::Message)

    Message received from the server.

Returns:

See Also:



57
58
59
60
61
62
63
# File 'lib/lapis/yggdrasil/messaging/response_factory.rb', line 57

def parse_invalidate_response(message)
  if message.ok?
    Response.new(message)
  else
    ErrorResponse.new(message)
  end
end

#parse_refresh_response(message) ⇒ RefreshResponse, ErrorResponse

Generates an instance from a response to a refresh request.

Parameters:

  • message (HTTP::Message)

    Message received from the server.

Returns:

See Also:



31
32
33
34
35
36
37
# File 'lib/lapis/yggdrasil/messaging/response_factory.rb', line 31

def parse_refresh_response(message)
  if message.ok?
    RefreshResponse.new(message)
  else
    ErrorResponse.new(message)
  end
end

#parse_signout_response(message) ⇒ Response, ErrorResponse

Generates an instance from a response to a signout request.

Parameters:

  • message (HTTP::Message)

    Message received from the server.

Returns:

See Also:



70
71
72
73
74
75
76
# File 'lib/lapis/yggdrasil/messaging/response_factory.rb', line 70

def parse_signout_response(message)
  if message.ok?
    Response.new(message)
  else
    ErrorResponse.new(message)
  end
end

#parse_validate_response(message) ⇒ Response, ErrorResponse

Generates an instance from a response to a validation request.

Parameters:

  • message (HTTP::Message)

    Message received from the server.

Returns:

See Also:



44
45
46
47
48
49
50
# File 'lib/lapis/yggdrasil/messaging/response_factory.rb', line 44

def parse_validate_response(message)
  if message.ok?
    Response.new(message)
  else
    ErrorResponse.new(message)
  end
end