Class: Analysand::SessionResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/analysand/session_response.rb

Overview

Public: Wraps the response from GET /_session.

GET /_session can be a bit surprising. A 200 OK response from _session indicates that the session cookie was well-formed; it doesn’t indicate that the session is valid.

Hence, this class adds a #valid? predicate.

Instance Attribute Summary

Attributes inherited from Response

#body, #response

Instance Method Summary collapse

Methods inherited from Response

#initialize

Methods included from StatusCodePredicates

#code, #conflict?, #not_found?, #success?, #unauthorized?

Methods included from ResponseHeaders

#cookies, #etag, #session_cookie

Constructor Details

This class inherits a constructor from Analysand::Response

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/analysand/session_response.rb', line 12

def valid?
  (uc = body['userCtx']) && uc['name']
end