lib/gems/request.rb in gems-0.0.6 vs lib/gems/request.rb in gems-0.0.7

- old
+ new

@@ -1,15 +1,29 @@ module Gems module Request + def delete(path, options={}, format=format) + request(:delete, path, options, format) + end + def get(path, options={}, format=format) request(:get, path, options, format) end + def post(path, options={}, format=format) + request(:post, path, options, format) + end + private def request(method, path, options, format) response = connection(format).send(method) do |request| - request.url(formatted_path(path, format), options) + case method + when :delete, :get + request.url(formatted_path(path, format), options) + when :post + request.path = formatted_path(path, format) + request.body = options unless options.empty? + end end response.body end def formatted_path(path, format)