Sha256: 0ef06ff95ae7fb0fbc71dbc3c967700620c12e76a3ae396445babd765f56fc0d
Contents?: true
Size: 939 Bytes
Versions: 8
Compression:
Stored size: 939 Bytes
Contents
module Slack # Defines HTTP request methods module Request # Perform an HTTP GET request def get(path, options={}) request(:get, path, options) end # Perform an HTTP POST request def post(path, options={}) request(:post, path, options) end # Perform an HTTP PUT request def put(path, options={}) request(:put, path, options) end # Perform an HTTP DELETE request def delete(path, options={}) request(:delete, path, options) end private # Perform an HTTP request def request(method, path, options) options.merge!(token: token) response = connection.send(method) do |request| case method when :get, :delete request.url(path, options) when :post, :put request.path = path request.body = options unless options.empty? end end return response.body end end end
Version data entries
8 entries across 8 versions & 1 rubygems