Module: Parse::API::Sessions
- Included in:
- Client
- Defined in:
- lib/parse/api/sessions.rb
Overview
Defines the Session class interface for the Parse REST API
Instance Method Summary collapse
-
#fetch_session(session_token, **opts) ⇒ Parse::Response
Fetch a session record for a given session token.
Instance Method Details
#fetch_session(session_token, **opts) ⇒ Parse::Response
Fetch a session record for a given session token.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/parse/api/sessions.rb', line 15 def fetch_session(session_token, **opts) # The positional token is passed as the explicit per-call token so an # ambient `Parse.with_session` token or a client-bound token cannot # replace it and return another user's session. session_token = session_token.session_token if session_token.respond_to?(:session_token) opts = opts.merge({ use_master_key: false, cache: false, session_token: session_token.to_s }) headers = { Parse::Protocol::SESSION_TOKEN => session_token.to_s } response = request :get, "#{SESSION_PATH_PREFIX}/me", headers: headers, opts: opts response.parse_class = Parse::Model::CLASS_SESSION response end |