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
# File 'lib/slack-ruby-bot-server/server.rb', line 7

def initialize(attrs = {})
  @team = attrs[:team]
  fail 'Missing team' unless @team
  options = { token: @team.token }
  super(options)
  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



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

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