Sha256: 97dbf254ffd5b438045428215fb6fdb6145d3ce9b1c697ddf53251aa0e1b79da
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require 'multi_json' module GettyConnect module Request def delete(path, options={}, use_ssl=false) request(:delete, path, options, use_ssl) end def get(path, options={}, use_ssl=false) request(:get, path, options, use_ssl) end def patch(path, options={}, use_ssl=false) request(:patch, path, options, use_ssl) end def post(path, options={}, use_ssl=false) request(:post, path, options, use_ssl) end def put(path, options={}, use_ssl=false) request(:put, path, options, use_ssl) end private def request(method, path, options, use_ssl) response = connection(use_ssl).send(method) do |request| case method when :delete, :get request.url(path, options) when :patch, :post, :put request.path = path request.body = MultiJson.dump(options) unless options.empty? else request.body = options unless options.empty? end end response.body end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
getty_connect-0.0.4 | lib/getty_connect/request.rb |
getty_connect-0.0.3 | lib/getty_connect/request.rb |