Sha256: 5938dcb72a1df103079eb3b1ad0fcf5c8e3b5af484a77b06d3b86852b2a76656
Contents?: true
Size: 965 Bytes
Versions: 2
Compression:
Stored size: 965 Bytes
Contents
module Open311 class Client module Request def get(path, options={}, raw=false) request(:get, path, options, raw) end def post(path, options={}, raw=false) request(:post, path, options, raw) end def put(path, options={}, raw=false) request(:put, path, options, raw) end def delete(path, options={}, raw=false) request(:delete, path, options, raw) end private 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 end end raw ? response : response.body end def formatted_path(path) [path, format].compact.join('.') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open311-0.0.1 | lib/open311/client/request.rb |
open311-0.0.0 | lib/open311/client/request.rb |