Sha256: ad9d890751ba2c2a26ae4849229b92f1965901ec49fc8f60fcc3431c87959df2
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module Evrythng # Defines HTTP request methods module Request # Perform an HTTP DELETE request def delete(path, params={}, options={}) request(:delete, path, params, options) end # Perform an HTTP GET request def get(path, params={}, options={}) request(:get, path, params, options) end # Perform an HTTP POST request 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 private # Perform an HTTP request def request(method, path, params, options) response = connection(options).send(method) do |request| case method.to_sym when :delete, :get request.url(path, params) when :post, :put request.path = path request.body = params unless params.empty? end end options[:raw] ? response : response.body end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
evrythng-0.1.1 | lib/evrythng/request.rb |
evrythng-0.1.0 | lib/evrythng/request.rb |