Sha256: ccbcd37673def724f1c76be082e817da3722fb1acd7ffa6b62b906ce14e033be
Contents?: true
Size: 737 Bytes
Versions: 2
Compression:
Stored size: 737 Bytes
Contents
# encoding: utf-8 require_relative 'slack-rtmapi/client' require_relative 'slack-rtmapi/version' require_relative 'slack_web' require 'json' require 'net/http' class SlackRTM attr_writer :client attr_accessor :rtm_state_data def self.get_url(options) body = SlackWeb.call(method: 'rtm.start', token: options[:token]) URI(body['url']) end def initialize(options) @token = options.fetch(:token) @api_url = options[:slack_api_url] || 'https://slack.com/api' end def start_rtm @rtm_state_data = SlackWeb.call(method: 'rtm.start', token: @token) @websocket_url = URI(@rtm_state_data['url']) client end def client @client ||= SlackRTM::Client.new websocket_url: @websocket_url end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slack-rtmapi-fork-0.9.1 | lib/slack-rtmapi.rb |
slack-rtmapi-fork-1.0.0.rc5 | lib/slack-rtmapi.rb |