Class: Caseflow::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- Caseflow::Configuration
- Defined in:
- lib/caseflow/configuration.rb
Overview
HTTP client configuration for the Service, sets the base path, a default timeout, and a service name for breakers and metrics.
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
-
#app_token ⇒ String
The auth token for the caseflow service.
-
#base_path ⇒ String
Base path for caseflow URLs.
-
#connection ⇒ Faraday::Connection
Creates the a connection with middleware for mapping errors, parsing json, and adding breakers functionality.
-
#mock_enabled? ⇒ Boolean
Should the service use mock data in lower environments.
-
#service_name ⇒ String
Service name to use in breakers and metrics.
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
#app_token ⇒ String
Returns The auth token for the caseflow service.
17 18 19 |
# File 'lib/caseflow/configuration.rb', line 17 def app_token Settings.caseflow.app_token end |
#base_path ⇒ String
Returns Base path for caseflow URLs.
24 25 26 |
# File 'lib/caseflow/configuration.rb', line 24 def base_path Settings.caseflow.host end |
#connection ⇒ Faraday::Connection
Creates the a connection with middleware for mapping errors, parsing json, and adding breakers functionality.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/caseflow/configuration.rb', line 40 def connection Faraday.new(base_path, headers: base_request_headers, request: ) do |faraday| faraday.use :breakers faraday.request :json faraday.response :raise_custom_error, error_prefix: service_name faraday.response :caseflow_errors 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.
56 57 58 |
# File 'lib/caseflow/configuration.rb', line 56 def mock_enabled? [true, 'true'].include?(Settings.caseflow.mock) end |
#service_name ⇒ String
Returns Service name to use in breakers and metrics.
31 32 33 |
# File 'lib/caseflow/configuration.rb', line 31 def service_name 'CaseflowStatus' end |