class Restool::Service::RestoolService

Public Class Methods

new(service_config, response_handler) click to toggle source
# File lib/restool/service/restool_service.rb, line 10
def initialize(service_config, response_handler)
  @service_config = service_config
  @response_handler = response_handler
  @remote_client = Restool::Service::RemoteClient.new(service_config.host, service_config.verify_ssl,
                                                      service_config.timeout, service_config.opts)

  define_operations(
    @service_config, method(:make_request), method(:make_request_with_uri_params)
  )
end

Private Instance Methods

make_request(operation, params, headers = {}) click to toggle source

this methods are called directly from the client though the OperationDefiner

# File lib/restool/service/restool_service.rb, line 25
def make_request(operation, params, headers = {})
  path = Restool::Service::UriUtils.build_path(operation)

  Restool::Service::RemoteConnector.execute(
    @remote_client, operation, path, params, headers, @response_handler,
    @service_config.representations, @service_config.basic_auth
  )
end
make_request_with_uri_params(operation, uri_params_values, params, headers = {}) click to toggle source
# File lib/restool/service/restool_service.rb, line 34
def make_request_with_uri_params(operation, uri_params_values, params, headers = {})
  path = Restool::Service::UriUtils.build_path(operation, uri_params_values)

  Restool::Service::RemoteConnector.execute(
    @remote_client, operation, path, params, headers, @response_handler,
    @service_config.representations, @service_config.basic_auth
  )
end