Class: Api::Kiosque::V1::BaseController

Inherits:
ActionController::API
  • Object
show all
Includes:
ElasticApmContext, LogrageCustomLogger
Defined in:
app/controllers/api/kiosque/v1/base_controller.rb

Direct Known Subclasses

ReservationsController

Instance Method Summary collapse

Methods included from LogrageCustomLogger

#append_info_to_payload

Instance Method Details

#current_userObject



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