Class: Restify::Client Private

Inherits:
Object
  • Object
show all
Defined in:
lib/restify/client.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

RESERVED_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Keys that should not be extracted from options to expand URI templates.

[:data]

Instance Method Summary collapse

Instance Method Details

#request(method, path, opts = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Request given path with given method.

Returns an obligation that will return a collection or resource or fail with a response error depending on response from server.



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/restify/client.rb', line 70

def request(method, path, opts = {})
  data    = opts.fetch(:data, opts)
  request = Request.new method: method, uri: base.join(path.to_s), data: data

  ::Restify.adapter.call(request).then do |response|
    if response.success?
      handle_success response
    else
      handle_error response
    end
  end
end