Class: Api::Vendor::V1::Klook::BaseController

Inherits:
ApplicationController show all
Includes:
Concerns::IntegrationTestHelpers, ElasticAPM::SpanHelpers, EncryptableHelper, ResponseCacheConcern
Defined in:
app/controllers/api/vendor/v1/klook/base_controller.rb

Constant Summary collapse

CACHE_NAMESPACE =
'api_vendor_v1_klook_cache'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ResponseCacheConcern

#my_response_cache

Methods included from EncryptableHelper

#decrypt, #encrypt, #generate_signature

Methods inherited from ApplicationController

#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #render_not_found, #routing_error, search_params_key=

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from ControllerHelpers

#check_boolean_param, #get_banners, #inventory_params, #reservation_params

Instance Attribute Details

#vendorObject (readonly)

Returns the value of attribute vendor.



13
14
15
# File 'app/controllers/api/vendor/v1/klook/base_controller.rb', line 13

def vendor
  @vendor
end

Instance Method Details

#authenticationObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/api/vendor/v1/klook/base_controller.rb', line 15

def authentication
  authenticate_or_request_with_http_token do |token, _options|
    @vendor ||= set_vendor!
    return render_unauthorized_error unless @vendor
    return true if integration_test_mode? && integration_test_vendor_application&.uid == token
    return true if @vendor.uid == token

    return render_unauthorized_error
  end
end