Class: CARMA::Client::MuleSoftConfiguration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/carma/client/mule_soft_configuration.rb

Instance Attribute Summary

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

#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_pathString (private)

Returns:

  • (String)


39
40
41
# File 'lib/carma/client/mule_soft_configuration.rb', line 39

def base_path
  "#{settings.host}/va-carma-caregiver-papi/api/"
end

#base_request_headersObject



6
7
8
9
10
11
# File 'lib/carma/client/mule_soft_configuration.rb', line 6

def base_request_headers
  super.merge({
                client_id: settings.client_id,
                client_secret: settings.client_secret
              })
end

#connectionObject



13
14
15
16
17
18
19
# File 'lib/carma/client/mule_soft_configuration.rb', line 13

def connection
  Faraday.new(base_path) do |conn|
    conn.use :breakers
    conn.request :instrumentation, name: service_name
    conn.adapter Faraday.default_adapter
  end
end

#service_nameObject



21
22
23
# File 'lib/carma/client/mule_soft_configuration.rb', line 21

def service_name
  self.class.name
end

#settingsConfig::Options

Returns:

  • (Config::Options)


32
33
34
# File 'lib/carma/client/mule_soft_configuration.rb', line 32

def settings
  Settings.form_10_10cg.carma.mulesoft
end

#timeoutInteger

setting. Defaults to 10 if unset.

Returns:

  • (Integer)

    Value given by configuration key ‘form_10_10cg.carma.mulesoft.timeout`



27
28
29
# File 'lib/carma/client/mule_soft_configuration.rb', line 27

def timeout
  settings.key?(:timeout) ? settings.timeout : 10
end