Class: Chip::Configuration
- Inherits:
-
Common::Client::Configuration::REST
- Object
- Common::Client::Configuration::Base
- Common::Client::Configuration::REST
- Chip::Configuration
- Defined in:
- lib/chip/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
-
#connection ⇒ Faraday::Connection
Creates a Faraday connection with middleware for mapping errors, and adding breakers functionality.
-
#service_name ⇒ String
Service name.
-
#settings ⇒ Config::Options
Chip settings object.
-
#valid_tenant?(tenant_name:, tenant_id:) ⇒ Boolean
Validate that the tenant_id matches the tenant_name.
Methods inherited from Common::Client::Configuration::Base
#base_path, #breakers_error_threshold, #breakers_exception_handler, #breakers_matcher, #breakers_service, #create_new_breakers_service, #current_module, #request_options, #service_exception
Instance Method Details
#connection ⇒ Faraday::Connection
Creates a Faraday connection with middleware for mapping errors, and adding breakers functionality.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/chip/configuration.rb', line 37 def connection @conn ||= Faraday.new(url:) do |faraday| faraday.use :breakers faraday.request :json faraday.response :chip_error faraday.response :betamocks if settings.mock faraday.adapter Faraday.default_adapter end end |
#service_name ⇒ String
Returns service name.
19 20 21 |
# File 'lib/chip/configuration.rb', line 19 def service_name 'Chip' end |
#settings ⇒ Config::Options
Returns Chip settings object.
10 11 12 |
# File 'lib/chip/configuration.rb', line 10 def settings Settings.chip end |
#valid_tenant?(tenant_name:, tenant_id:) ⇒ Boolean
Validate that the tenant_id matches the tenant_name
28 29 30 |
# File 'lib/chip/configuration.rb', line 28 def valid_tenant?(tenant_name:, tenant_id:) settings[tenant_name]&.tenant_id == tenant_id end |