Class: Lighthouse::VeteransHealth::Configuration

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

Instance Attribute Summary

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

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

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

Instance Method Details

#base_pathObject



9
10
11
# File 'lib/lighthouse/veterans_health/configuration.rb', line 9

def base_path
  Settings.lighthouse.veterans_health.url
end

#connectionObject



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

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|
    faraday.use :breakers
    faraday.use Faraday::Response::RaiseError

    # This is necessary to pass multiple date query params to Lighthouse
    # e.g. "date=foo&date=bar"
    faraday.options.params_encoder = Faraday::FlatParamsEncoder

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

    faraday.response :json

    faraday.response :betamocks if Settings.lighthouse.veterans_health.use_mocks
    faraday.adapter Faraday.default_adapter
  end
end

#rsa_keyObject



17
18
19
# File 'lib/lighthouse/veterans_health/configuration.rb', line 17

def rsa_key
  @key ||= OpenSSL::PKey::RSA.new(File.read(Settings.lighthouse.veterans_health.fast_tracker.api_key))
end

#service_nameObject



13
14
15
# File 'lib/lighthouse/veterans_health/configuration.rb', line 13

def service_name
  'Lighthouse_VeteransHealth'
end