Class: DebtManagementCenter::DebtsConfiguration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/debt_management_center/debts_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

Instance Method Summary collapse

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

.base_request_headersObject



5
6
7
8
9
10
# File 'lib/debt_management_center/debts_configuration.rb', line 5

def self.base_request_headers
  super.merge(
    'client_id' => Settings.dmc.client_id,
    'client_secret' => Settings.dmc.client_secret
  )
end

Instance Method Details

#base_pathObject



16
17
18
# File 'lib/debt_management_center/debts_configuration.rb', line 16

def base_path
  Settings.dmc.url
end

#connectionObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/debt_management_center/debts_configuration.rb', line 20

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |f|
    f.use :breakers
    f.use Faraday::Response::RaiseError
    f.request :json
    f.response :betamocks if Settings.dmc.mock_debts
    f.response :json
    f.adapter Faraday.default_adapter
  end
end

#service_nameObject



12
13
14
# File 'lib/debt_management_center/debts_configuration.rb', line 12

def service_name
  'Debts'
end