Sha256: 78f24b6e99414def2e78fd5967c141ec679048775f91384bc9619a6c3da72318

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

module SlackRubyBot
  class App < Server
    def initialize(options = {})
      SlackRubyBot.configure do |config|
        config.token = ENV['SLACK_API_TOKEN'] || fail("Missing ENV['SLACK_API_TOKEN'].")
        config.aliases = ENV['SLACK_RUBY_BOT_ALIASES'].split(' ') if ENV['SLACK_RUBY_BOT_ALIASES']
      end
      Slack.configure do |config|
        config.token = SlackRubyBot.config.token
      end
      super
    end

    def config
      SlackRubyBot.config
    end

    def self.instance
      @instance ||= new
    end

    private

    def auth!
      super
      SlackRubyBot.configure do |config|
        config.url = client.auth['url']
        config.team = client.auth['team']
        config.user = client.auth['user']
        config.team_id = client.auth['team_id']
        config.user_id = client.auth['user_id']
      end
    end

    def reset!
      super
      SlackRubyBot.configure do |config|
        config.url = nil
        config.team = nil
        config.user = nil
        config.team_id = nil
        config.user_id = nil
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
slack-ruby-bot-bhe-0.5.5.3 lib/slack-ruby-bot/app.rb
slack-ruby-bot-0.6.2 lib/slack-ruby-bot/app.rb
slack-ruby-bot-0.6.1 lib/slack-ruby-bot/app.rb
slack-ruby-bot-0.6.0 lib/slack-ruby-bot/app.rb
slack-ruby-bot-0.5.5 lib/slack-ruby-bot/app.rb
slack-ruby-bot-0.5.4 lib/slack-ruby-bot/app.rb