Class: Search::Configuration

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

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

Instance Method Details

#base_pathObject



25
26
27
# File 'lib/search/configuration.rb', line 25

def base_path
  Settings.search.url
end

#connectionObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/search/configuration.rb', line 9

def connection
  @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|
    faraday.use      :breakers
    faraday.use      Faraday::Response::RaiseError

    faraday.response :betamocks if mock_enabled?
    faraday.response :snakecase, symbolize: false
    faraday.response :json, content_type: /\bjson/ # ensures only json content types parsed
    faraday.adapter Faraday.default_adapter
  end
end

#mock_enabled?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/search/configuration.rb', line 21

def mock_enabled?
  Settings.search.mock_search || false
end

#service_nameObject



29
30
31
# File 'lib/search/configuration.rb', line 29

def service_name
  'Search/Results'
end