Module: Virtuatable::Helpers::Sessions
- Included in:
- Controllers::Base
- Defined in:
- lib/virtuatable/helpers/sessions.rb
Overview
This helper gives access to methods about user’s session on the API.
Instance Method Summary collapse
-
#session ⇒ Arkaan::Authentication::Session
Returns the session of the user requesting the API.
-
#session! ⇒ Object
Checks the session of the user requesting the API and returns an error if it either not exists with the given token, or the token is not given.
Instance Method Details
#session ⇒ Arkaan::Authentication::Session
Returns the session of the user requesting the API.
10 11 12 |
# File 'lib/virtuatable/helpers/sessions.rb', line 10 def session Arkaan::Authentication::Session.where(token: params['session_id']).first end |
#session! ⇒ Object
Checks the session of the user requesting the API and returns an error if it either not exists with the given token, or the token is not given.
21 22 23 24 25 26 |
# File 'lib/virtuatable/helpers/sessions.rb', line 21 def session! check_presence 'session_id' api_not_found 'session_id.unknown' if session.nil? session end |