class SlackbotFrd::SlackMethods::ReactionsAdd

Public Class Methods

add(token:, name:, channel: nil, timestamp: nil) click to toggle source
# File lib/slackbot_frd/slack_methods/reactions_add.rb, line 10
def self.add(token:, name:, channel: nil, timestamp: nil)
  r = ReactionsAdd.new(token: token, name: name, channel: channel, timestamp: timestamp)
  r.add
end
new(token:, name:, channel: nil, timestamp: nil) click to toggle source
# File lib/slackbot_frd/slack_methods/reactions_add.rb, line 15
def initialize(token:, name:, channel: nil, timestamp: nil)
  @token = token
  @name = name
  @channel = channel
  @timestamp = timestamp
end

Public Instance Methods

add() click to toggle source
# File lib/slackbot_frd/slack_methods/reactions_add.rb, line 22
def add
  body = {
    token: @token,
    name: @name
  }

  if @channel && @timestamp
    body.merge!({
      channel: @channel,
      timestamp: @timestamp
    })
  end

  @response = self.class.post('', :body => body)
  ValidateSlack.response(@response)
  @response
end