Class: BipClaims::Configuration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/bip_claims/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



5
6
7
# File 'lib/bip_claims/configuration.rb', line 5

def base_path
  Settings.bip.claims.url
end

#connectionFaraday::Connection

Creates the a connection with middleware for mapping errors, parsing json, and adding breakers functionality.

Returns:

  • (Faraday::Connection)

    a Faraday connection instance.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bip_claims/configuration.rb', line 18

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

    faraday.response :raise_custom_error, error_prefix: service_name
    faraday.response :betamocks if mock_enabled?
    faraday.response :json
    faraday.adapter Faraday.default_adapter
  end
end

#mock_enabled?Boolean

Returns Should the service use mock data in lower environments.

Returns:

  • (Boolean)

    Should the service use mock data in lower environments.



33
34
35
# File 'lib/bip_claims/configuration.rb', line 33

def mock_enabled?
  [true, 'true'].include?(Settings.bip.claims.mock)
end

#service_nameObject



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

def service_name
  'BipClaims'
end