Sha256: 508a83f49a208993bd644a5e1f8a9c96dd6e0516361a2d374141df79e0cbfdaf
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'multi_json' module Reshape module Request def get(path, options={}, raw=false, force_urlencoded=false) request(:get, path, options, raw, force_urlencoded) end def post(path, options={}, raw=false, force_urlencoded=false) request(:post, path, options, raw, force_urlencoded) end def put(path, options={}, raw=false, force_urlencoded=false) request(:put, path, options, raw, force_urlencoded) end def delete(path, options={}, raw=false, force_urlencoded=false) request(:delete, path, options, raw, force_urlencoded) end private def request(method, path, options, raw, force_urlencoded) response = connection(raw, force_urlencoded).send(method) do |request| case method when :delete, :get request.url(path, options) when :patch, :post, :put request.path = path request.body = options unless options.empty? end end if raw response else response.body end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reshape-0.2 | lib/reshape/request.rb |
reshape-0.1.1 | lib/reshape/request.rb |
reshape-0.1 | lib/reshape/request.rb |