Sha256: 8447db9a36161331e5fdb8409994b888e83edc83761fef508cb549d44ddfbd4f

Contents?: true

Size: 400 Bytes

Versions: 2

Compression:

Stored size: 400 Bytes

Contents

# encoding: utf-8

require 'json'
require 'net/http'

module SlackWeb
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slack-rtmapi-fork-0.9.1 lib/slack_web.rb
slack-rtmapi-fork-1.0.0.rc5 lib/slack_web.rb