2012-04-16 18:17:11 +00:00
|
|
|
module HTTPHelpers
|
|
|
|
|
|
|
|
attr_accessor :default_params
|
|
|
|
|
|
|
|
def add_default_params(params)
|
|
|
|
default_params.merge!(params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def do_request(type, base_url, url, params)
|
|
|
|
request_method = type.downcase.to_sym
|
2012-04-24 16:36:25 +00:00
|
|
|
send(request_method, "#{base_url}/#{url}", default_params.merge(params))
|
2012-04-16 18:17:11 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def default_params
|
|
|
|
@default_params ||= {}
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
World(HTTPHelpers)
|