Module: SlackWeb

Defined in:
lib/slack_web.rb

Class Method Summary collapse

Class Method Details

.call(options) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/slack_web.rb', line 5

def self.call(options)
  options.fetch(:token)
  method = options.fetch(:method)
  fail unless method.match(/^[a-z]+\.[A-z]+$/)
  options.delete(:method)
  api_url = options[:slack_api_url] || 'https://slack.com/api'
  req = Net::HTTP.post_form URI(api_url + '/' + method), options
  JSON.parse req.body
end