Class: Api::Kiosque::V1::BaseController
- Inherits:
-
ActionController::API
- Object
- ActionController::API
- Api::Kiosque::V1::BaseController
- Includes:
- ElasticApmContext, LogrageCustomLogger
- Defined in:
- app/controllers/api/kiosque/v1/base_controller.rb
Direct Known Subclasses
Instance Method Summary collapse
- #current_user ⇒ Object
- #identity_cache_memoization(&block) ⇒ Object
- #set_app_language(&action) ⇒ Object
Methods included from LogrageCustomLogger
Instance Method Details
#current_user ⇒ Object
29 30 31 |
# File 'app/controllers/api/kiosque/v1/base_controller.rb', line 29 def current_user doorkeeper_token.resource_owner end |
#identity_cache_memoization(&block) ⇒ Object
11 12 13 |
# File 'app/controllers/api/kiosque/v1/base_controller.rb', line 11 def identity_cache_memoization(&block) IdentityCache.cache.with_memoization(&block) end |
#set_app_language(&action) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/api/kiosque/v1/base_controller.rb', line 15 def set_app_language(&action) lang_header = 'X-HH-Language' lang = request.headers[lang_header] || request.headers[lang_header.downcase] if lang locale = MyLocaleManager.parse(lang) I18n.with_locale(locale) do Globalize.with_locale(locale, &action) end else yield end true end |