Class: Api::Vendor::V1::Getyourguide::BaseController

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ResponseCacheConcern

#my_response_cache

Methods inherited from ApplicationController

#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #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.



9
10
11
# File 'app/controllers/api/vendor/v1/getyourguide/base_controller.rb', line 9

def vendor
  @vendor
end

Instance Method Details

#authenticationObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/api/vendor/v1/getyourguide/base_controller.rb', line 11

def authentication
  authenticate_or_request_with_http_basic do |username, password|
    result = if integration_test_mode?
               authenticate_integration_test_basic_auth(username, password)
             else
               authenticate_vendor_basic_auth(
                 username,
                 password,
                 ENV['GETYOURGUIDE_API_USERNAME'],
                 ENV['GETYOURGUIDE_API_PASSWORD'],
               )
             end

    unless result
      APMErrorHandler.report(
        'GetYourGuide: Authentication failed',
        {
          integration_test_mode: integration_test_mode?,
        },
      )
    end

    result
  end
end