module Kongkit::Client::Request

Public Instance Methods

delete(path, options = {}) click to toggle source

HTTP DELETE request

@param path [String] The API path @param options [Hash] The options @return [Boolean] `true` if successfully respondeds

# File lib/kongkit/client/request.rb, line 39
def delete(path, options = {})
  response = self.class.delete(path, options)
  response.success?
end
get(path, options = {}) click to toggle source

HTTP GET request

@param path [String] The API path @param options [Hash] The options @return [Kongkit::Client::Resource] Resource

# File lib/kongkit/client/request.rb, line 9
def get(path, options = {})
  response = self.class.get(path, options)
  parse(response)
end
patch(path, options = {}) click to toggle source

HTTP PATCH request

@param path [String] The API path @param options [Hash] The options @return [Kongkit::Client::Resource] Resource

# File lib/kongkit/client/request.rb, line 29
def patch(path, options = {})
  response = self.class.patch(path, options)
  parse(response)
end
post(path, options = {}) click to toggle source

HTTP POST request

@param path [String] The API path @param options [Hash] The options @return [Kongkit::Client::Resource] Resource

# File lib/kongkit/client/request.rb, line 19
def post(path, options = {})
  response = self.class.post(path, options)
  parse(response)
end

Private Instance Methods

parse(response) click to toggle source
# File lib/kongkit/client/request.rb, line 46
def parse(response)
  Kongkit::Client::Resource.new(self, JSON.parse(response.body, symbolize_names: true), response.code)
end