module Tweetsentiments::Request
Public Instance Methods
delete(path, options={}, raw=false)
click to toggle source
# File lib/tweetsentiments/request.rb, line 12 def delete(path, options={}, raw=false) request(:delete, path, options, raw) end
get(path, options={}, raw=false)
click to toggle source
# File lib/tweetsentiments/request.rb, line 3 def get(path, options={}, raw=false) request(:get, path, options, raw) end
post(path, options={}, raw=false)
click to toggle source
# File lib/tweetsentiments/request.rb, line 6 def post(path, options={}, raw=false) request(:post, path, options, raw) end
put(path, options={}, raw=false)
click to toggle source
# File lib/tweetsentiments/request.rb, line 9 def put(path, options={}, raw=false) request(:put, path, options, raw) end
Private Instance Methods
formatted_path(path)
click to toggle source
# File lib/tweetsentiments/request.rb, line 30 def formatted_path(path) [path, format].compact.join('.') end
request(method, path, options, raw)
click to toggle source
# File lib/tweetsentiments/request.rb, line 17 def request(method, path, options, raw) response = connection(raw).send(method) do |request| case method when :get, :delete request.url(formatted_path(path), options) when :post, :put request.path = formatted_path(path) request.body = options unless options.empty? end end raw ? response : response.body end