Class: BenefitsIntakeService::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- BenefitsIntakeService::Configuration
- Defined in:
- lib/benefits_intake_service/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
-
.base_request_headers ⇒ Hash
The basic headers required for any Lighthouse API call.
Instance Method Summary collapse
-
#base_path ⇒ String
Base path.
- #breakers_error_threshold ⇒ Object
-
#connection ⇒ Faraday::Connection
Creates a connection with json parsing and breaker functionality.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#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_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 |
# File 'lib/benefits_intake_service/configuration.rb', line 8 def initialize super Settings.benefits_intake_service.api_key ||= Settings.form526_backup.api_key Settings.benefits_intake_service.url ||= Settings.form526_backup.url end |
Class Method Details
.base_request_headers ⇒ Hash
Returns The basic headers required for any Lighthouse API call.
33 34 35 |
# File 'lib/benefits_intake_service/configuration.rb', line 33 def self.base_request_headers super.merge('apikey' => Settings.benefits_intake_service.api_key) end |
Instance Method Details
#base_path ⇒ String
Returns Base path.
19 20 21 |
# File 'lib/benefits_intake_service/configuration.rb', line 19 def base_path Settings.benefits_intake_service.url end |
#breakers_error_threshold ⇒ Object
63 64 65 |
# File 'lib/benefits_intake_service/configuration.rb', line 63 def breakers_error_threshold 80 # breakers will be tripped if error rate reaches 80% over a two minute period. end |
#connection ⇒ Faraday::Connection
Creates a connection with json parsing and breaker functionality.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/benefits_intake_service/configuration.rb', line 42 def connection @conn ||= Faraday.new(base_path, headers: base_request_headers, request: ) do |faraday| faraday.use :breakers faraday.use Faraday::Response::RaiseError faraday.request :multipart faraday.request :json 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.
59 60 61 |
# File 'lib/benefits_intake_service/configuration.rb', line 59 def mock_enabled? Settings.benefits_intake_service.mock || false end |
#service_name ⇒ String
Returns Service name to use in breakers and metrics.
26 27 28 |
# File 'lib/benefits_intake_service/configuration.rb', line 26 def service_name 'BenefitsIntakeService' end |