Sha256: ddc202a883cdbdd5102dbdc86c60a765b2156d255104942ecfe385fb31f4a6da
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal module Kruger class Client module Request # Make a HTTP get request # # @param url [String] The path, relative to {#api_endpoint} # @param options [Hash] Query and header params for request # @return [Kruger::Client::Response] def get(url, options = {}) request :get, url, options end # Make a HTTP post request # # @param url [String] The path, relative to {#api_endpoint} # @param options [Hash] Body and header params for request # @return [Kruger::Client::Response] def post(url, options = {}) request :post, url, options end # Make a HTTP PUT request # # @param url [String] The path, relative to {#api_endpoint} # @param options [Hash] Body and header params for request # @return [Kruger::Client::Response] def put(url, options = {}) request :put, url, options end # Make a HTTP PATCH request # # @param url [String] The path, relative to {#api_endpoint} # @param options [Hash] Body and header params for request # @return [Kruger::Client::Response] def patch(url, options = {}) request :patch, url, options end private def request(method, path, options = {}) response = self.class.send(method, path, body: options) Response.new(response) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kruger-0.1.1 | lib/kruger/client/request.rb |
kruger-0.1.0 | lib/kruger/client/request.rb |