Class: Form526BackupSubmission::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- Form526BackupSubmission::Configuration
- Defined in:
- lib/form526_backup_submission/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.
-
#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
Class Method Details
.base_request_headers ⇒ Hash
Returns The basic headers required for any Lighthouse API call.
27 28 29 |
# File 'lib/form526_backup_submission/configuration.rb', line 27 def self.base_request_headers super.merge('apikey' => Settings.form526_backup.api_key) end |
Instance Method Details
#base_path ⇒ String
Returns Base path.
13 14 15 |
# File 'lib/form526_backup_submission/configuration.rb', line 13 def base_path Settings.form526_backup.url end |
#breakers_error_threshold ⇒ Object
57 58 59 |
# File 'lib/form526_backup_submission/configuration.rb', line 57 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.
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/form526_backup_submission/configuration.rb', line 36 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.
53 54 55 |
# File 'lib/form526_backup_submission/configuration.rb', line 53 def mock_enabled? Settings.form526_backup.mock || false end |
#service_name ⇒ String
Returns Service name to use in breakers and metrics.
20 21 22 |
# File 'lib/form526_backup_submission/configuration.rb', line 20 def service_name 'Form526BackupSubmission' end |