Class: DecisionReview::PdfValidation::Configuration
- Inherits:
-
Configuration
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- Configuration
- DecisionReview::PdfValidation::Configuration
- Defined in:
- lib/decision_review/utilities/pdf_validation/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 decision review API call.
Instance Method Summary collapse
-
#base_path ⇒ String
Base path for PDF validation URL.
-
#connection ⇒ Faraday::Connection
Creates the a connection with parsing json and adding breakers functionality.
-
#service_name ⇒ String
Service name to use in breakers and metrics.
Methods inherited from Configuration
#breakers_error_threshold, #mock_enabled?
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
Class Method Details
permalink .base_request_headers ⇒ Hash
Returns The basic headers required for any decision review API call.
23 24 25 26 27 28 29 30 31 |
# File 'lib/decision_review/utilities/pdf_validation/configuration.rb', line 23 def self.base_request_headers # Can use regular Decision Reviews API key in lower environments return super unless Rails.env.production? # Since we're using the `uploads/validate_document` endpoint under Benefits Intake API, # we need to use their API key. This is pulled from BenefitsIntakeService::Configuration api_key = Settings.benefits_intake_service.api_key || Settings.form526_backup.api_key super.merge('apiKey' => api_key) end |
Instance Method Details
permalink #base_path ⇒ String
Returns Base path for PDF validation URL.
9 10 11 |
# File 'lib/decision_review/utilities/pdf_validation/configuration.rb', line 9 def base_path Settings.decision_review.pdf_validation.url end |
permalink #connection ⇒ Faraday::Connection
Creates the a connection with parsing json and adding breakers functionality.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/decision_review/utilities/pdf_validation/configuration.rb', line 38 def connection @conn ||= Faraday.new(base_path, headers: base_request_headers, request: ) do |faraday| faraday.use :breakers faraday.use Faraday::Response::RaiseError faraday.response :betamocks if mock_enabled? faraday.response :json faraday.adapter Faraday.default_adapter end end |
permalink #service_name ⇒ String
Returns Service name to use in breakers and metrics.
16 17 18 |
# File 'lib/decision_review/utilities/pdf_validation/configuration.rb', line 16 def service_name 'DecisionReview::PDFValidation' end |