Class: SlackRubyBotServer::Server

Inherits:
SlackRubyBot::Server
  • Object
show all
Defined in:
lib/slack-ruby-bot-server/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Server

Returns a new instance of Server.



7
8
9
10
11
12
13
14
# File 'lib/slack-ruby-bot-server/server.rb', line 7

def initialize(attrs = {})
  attrs = attrs.dup
  @team = attrs.delete(:team)
  raise 'Missing team' unless @team
  attrs[:token] = @team.token
  super(attrs)
  client.owner = @team
end

Instance Attribute Details

#teamObject

Returns the value of attribute team.



5
6
7
# File 'lib/slack-ruby-bot-server/server.rb', line 5

def team
  @team
end

Instance Method Details

#restart!(wait = 1) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/slack-ruby-bot-server/server.rb', line 16

def restart!(wait = 1)
  # when an integration is disabled, a live socket is closed, which causes the default behavior of the client to restart
  # it would keep retrying without checking for account_inactive or such, we want to restart via service which will disable an inactive team
  logger.info "#{team.name}: socket closed, restarting ..."
  SlackRubyBotServer::Service.instance.restart! team, self, wait
  client.owner = team
end