Class: BubBot::Slack::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/bub_bot/slack/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, client) ⇒ Response

Returns a new instance of Response.



4
5
6
7
# File 'lib/bub_bot/slack/response.rb', line 4

def initialize(options, client)
  @text = options.is_a?(String) ? options : options[:text]
  @client = client
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/bub_bot/slack/response.rb', line 2

def text
  @text
end

Instance Method Details

#channelObject



18
19
20
# File 'lib/bub_bot/slack/response.rb', line 18

def channel
  BubBot.configuration.slack_channel
end

#deliverObject



9
10
11
12
13
14
15
16
# File 'lib/bub_bot/slack/response.rb', line 9

def deliver
  body = {
    text: text,
    username: BubBot.configuration.bot_name
  }
  # TODO: configure channel
  @client.chat_postMessage(channel: '#' + channel, text: text, as_user: true)
end