module JustGiving::Request
Public Instance Methods
get(path, options={})
click to toggle source
# File lib/just_giving/request.rb, line 3 def get(path, options={}) request(:get, path, options) end
head(path, options={})
click to toggle source
# File lib/just_giving/request.rb, line 11 def head(path, options={}) request(:head, path, options) end
post(path, options={})
click to toggle source
# File lib/just_giving/request.rb, line 15 def post(path, options={}) request(:post, path, options) end
put(path, options={})
click to toggle source
# File lib/just_giving/request.rb, line 7 def put(path, options={}) request(:put, path, options) end
Private Instance Methods
request(method, path, options)
click to toggle source
# File lib/just_giving/request.rb, line 21 def request(method, path, options) basic_auth = options.delete(:basic_auth) response = connection(basic_auth).send(method) do |request| case method.to_sym when :get, :head request.url(path, options) when :put, :post request.path = path request.body = options unless options.empty? end end case response.status when 400 #Return errors if 400 JustGiving::Response.new(response.body) else response.body end end