Sha256: 5dba9c4e4835f2bd86861e0bddf0b01fb634cbfbb7b7eb28ab2bf322659976ed
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 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 unless options.empty? end end raw ? response : response.body end def formatted_path(path) [path, format].compact.join('.') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
open311-0.1.2 | lib/open311/client/request.rb |
open311-0.1.1 | lib/open311/client/request.rb |
open311-0.1.0 | lib/open311/client/request.rb |