class Slack::RtmApi2

class Slack Real Time Messaging API

Constants

VERSION

Attributes

client[W]
rtm_state_data[RW]

Public Class Methods

get_url(options) click to toggle source
# File lib/slack/rtmapi2.rb, line 13
def self.get_url(options)
  body = SlackWeb.call(method: 'rtm.start', token: options[:token])
  URI(body['url'])
end
new(options) click to toggle source
# File lib/slack/rtmapi2.rb, line 18
def initialize(options)
  @token = options.fetch(:token)
  @api_url = options[:slack_api_url] || 'https://slack.com/api'
end

Public Instance Methods

client() click to toggle source
# File lib/slack/rtmapi2.rb, line 29
def client
  @client ||= Slack::RtmApi2::Client.new websocket_url: @websocket_url
end
start_rtm() click to toggle source
# File lib/slack/rtmapi2.rb, line 23
def start_rtm
  @rtm_state_data = SlackWeb.call(method: 'rtm.start', token: @token)
  @websocket_url = URI(@rtm_state_data['url'])
  client
end