class SlackMessenger::Message
Public Class Methods
new(options = {})
click to toggle source
# File lib/slack_messenger/message.rb, line 3 def initialize(options = {}) @text = options[:text] || "" if options.has_key? :attachments @attachments = options[:attachments].is_a?(Array) ? options[:attachments] : [options[:attachments]] end end
Public Instance Methods
as_json()
click to toggle source
# File lib/slack_messenger/message.rb, line 15 def as_json hash = {text: @text} hash[:attachments] = @attachments.map(&:as_json) unless @attachments.nil? || @attachments.empty? hash end
send!(override_api = nil)
click to toggle source
# File lib/slack_messenger/message.rb, line 11 def send! override_api = nil Api.send(self, override_api) end