module Rhymba::Request
Defines HTTP request methods
Public Instance Methods
delete(path, options={})
click to toggle source
Perform an HTTP DELETE request
# File lib/rhymba/request.rb, line 20 def delete(path, options={}) request(:delete, path, options) end
get(path, options={})
click to toggle source
Perform an HTTP GET request
# File lib/rhymba/request.rb, line 5 def get(path, options={}) request(:get, path, options) end
post(path, options={})
click to toggle source
Perform an HTTP POST request
# File lib/rhymba/request.rb, line 10 def post(path, options={}) request(:post, path, options) end
put(path, options={})
click to toggle source
Perform an HTTP PUT request
# File lib/rhymba/request.rb, line 15 def put(path, options={}) request(:put, path, options) end
Private Instance Methods
request(method, path, options)
click to toggle source
Perform an HTTP request
# File lib/rhymba/request.rb, line 27 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