module Slack::Connection
Public Instance Methods
connection()
click to toggle source
# File lib/slack/connection.rb, line 19 def connection _connection = Faraday.new(@api_endpoint, @connection_options) _connection.headers = {'Accept' => @default_media_type, 'User-Agent' => @user_agent} _connection end
get(method)
click to toggle source
# File lib/slack/connection.rb, line 3 def get(method) response = connection.get method, { token: @token } if response.success? response else raise UnknownResponseCode, "Unexpected #{response.code}" end end
post(method, payload)
click to toggle source
# File lib/slack/connection.rb, line 13 def post(method, payload) response = connection.post do |req| req.url method, payload.to_hash end end