Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
RealTime::Client has some information(self, team, channels, ...)
Browse files Browse the repository at this point in the history
  • Loading branch information
aki017 committed Mar 18, 2017
1 parent b12ea77 commit ba4a617
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/slack/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def initialize(options={})
include Endpoint

def realtime
url = post("rtm.start")["url"]
RealTime::Client.new(url)
RealTime::Client.new(post("rtm.start"))
end
end
end
15 changes: 13 additions & 2 deletions lib/slack/realtime/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
module Slack
module RealTime
class Client
def initialize(url)
@url = url
def initialize(rtm_start_response)
@response = rtm_start_response
@url = rtm_start_response
@callbacks ||= {}
end

Expand Down Expand Up @@ -36,6 +37,16 @@ def start
end
end
end

def method_missing(method, *args, &block)
return super if @response[method.to_s].nil?
@response[method.to_s]
end

# Delegate to Slack::Client
def respond_to?(method, include_all=false)
return !@response[method.to_s].nil? || super
end
end
end
end

0 comments on commit ba4a617

Please sign in to comment.