Module: Core::Helpers::Sessions
- Included in:
- Controllers::Base
- Defined in:
- lib/core/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
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.
- #session_model ⇒ Object
Instance Method Details
#session ⇒ Arkaan::Authentication::Session
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.
17 18 19 20 21 22 23 |
# File 'lib/core/helpers/sessions.rb', line 17 def session return @session unless @session.nil? check_presence 'session_id' @session = session_model.find_by(token: params['session_id']) @session.nil? ? api_not_found('session_id.unknown') : @session end |
#session_model ⇒ Object
25 26 27 |
# File 'lib/core/helpers/sessions.rb', line 25 def session_model Arkaan::Authentication::Session end |