Class: Lighthouse::Facilities::Configuration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/lighthouse/facilities/configuration.rb

Instance Attribute Summary

Attributes inherited from Common::Client::Configuration::Base

#base_request_headers, #open_timeout, #read_timeout, #request_types, #user_agent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Common::Client::Configuration::Base

#breakers_error_threshold, #breakers_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception

Class Method Details

.base_request_headersObject



18
19
20
# File 'lib/lighthouse/facilities/configuration.rb', line 18

def self.base_request_headers
  super.merge('apiKey' => Settings.lighthouse.facilities.api_key)
end

Instance Method Details

#base_pathObject



10
11
12
# File 'lib/lighthouse/facilities/configuration.rb', line 10

def base_path
  Settings.lighthouse.facilities.url
end

#connectionObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/lighthouse/facilities/configuration.rb', line 22

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |conn|
    conn.use :breakers
    conn.request :instrumentation, name: 'lighthouse.facilities.request.faraday'

    # Uncomment this if you want curl command equivalent or response output to log
    # conn.request(:curl, ::Logger.new(STDOUT), :warn) unless Rails.env.production?
    # conn.response(:logger, ::Logger.new(STDOUT), bodies: true) unless Rails.env.production?

    conn.response :raise_custom_error, error_prefix: service_name
    conn.response :lighthouse_facilities_errors

    conn.adapter Faraday.default_adapter
  end
end

#service_nameObject



14
15
16
# File 'lib/lighthouse/facilities/configuration.rb', line 14

def service_name
  'Lighthouse_Facilities'
end