Sha256: e9d47f75e42fe7e14daa508ed85c27cd588b345b0a2d92ecd197b2fc274ce03c
Contents?: true
Size: 1.08 KB
Versions: 13
Compression:
Stored size: 1.08 KB
Contents
module Cashstar # Defines HTTP request methods module Request # Perform an HTTP GET request def get(path, params={}, options={}) request(:get, path, params, options) end def post(path, params={}, options={}) request(:post, path, params, options) end # Perform an HTTP PUT request def put(path, params={}, options={}) request(:put, path, params, options) end # Perform an HTTP DELETE request def delete(path, params={}, options={}) request(:delete, path, params, options) end private # Perform an HTTP request def request(method, path, params, options) response = connection(options).send(method) do |request| case method.to_sym when :get, :delete request.url(path, params) when :post, :put request.path = path request.body = params unless params.empty? end end options[:raw] ? response : response.body end def formatted_path(path, options={}) #[path, options.fetch(:format, format)].compact.join('.') end end end
Version data entries
13 entries across 13 versions & 2 rubygems