Sha256: eaea9c401cccb6377f780ca5a5c7b310bcb5d19172e096d0214796ebaf709f58
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Rhymba # Defines HTTP request methods module Request # Perform an HTTP GET request def get(path, options={}) request(:get, path, options) end # Perform an HTTP POST request def post(path, options={}) request(:post, path, options) end # Perform an HTTP PUT request def put(path, options={}) request(:put, path, options) end # Perform an HTTP DELETE request def delete(path, options={}) request(:delete, path, options) end private # Perform an HTTP request def request(method, path, options) response = connection.send(method) do |request| case method when :get, :delete request.url(path, options) when :post, :put request.path = path request.headers['access_token'] = self.access_token request.headers['access_secret'] = self.access_secret request.headers = request.headers.merge(post_header) request.body = options unless options.empty? end end return response.body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhymba-api-0.0.1 | lib/rhymba/request.rb |