Class: GI::Configuration

Inherits:
Common::Client::Configuration::REST show all
Defined in:
lib/gi/configuration.rb

Direct Known Subclasses

Lce::Configuration, SearchConfiguration

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



14
15
16
# File 'lib/gi/configuration.rb', line 14

def base_path
  "#{Settings.gids.url}/"
end

#connectionObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/gi/configuration.rb', line 22

def connection
  Faraday.new(base_path, headers: base_request_headers, request: request_options) do |conn|
    conn.use :breakers
    conn.request :json
    # Uncomment this out for generating curl output
    # conn.request :curl, ::Logger.new(STDOUT), :warn

    # conn.response :logger, ::Logger.new(STDOUT), bodies: true
    conn.response :betamocks if use_mocks?
    conn.response :snakecase
    conn.response :raise_custom_error, error_prefix: service_name
    conn.response :gids_errors
    conn.response :json_parser

    conn.adapter Faraday.default_adapter
  end
end

#service_nameObject



18
19
20
# File 'lib/gi/configuration.rb', line 18

def service_name
  'GI'
end

#use_mocks?Boolean

To be overridden in gi/lce/configuration

Returns:

  • (Boolean)


41
42
43
# File 'lib/gi/configuration.rb', line 41

def use_mocks?
  false
end