Class: SlackbotFrd::SlackMethods::ChatDelete

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/slackbot_frd/slack_methods/chat_delete.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, channel:, timestamp:) ⇒ ChatDelete

Returns a new instance of ChatDelete.



15
16
17
18
19
# File 'lib/slackbot_frd/slack_methods/chat_delete.rb', line 15

def initialize(token:, channel:, timestamp:)
  @token = token
  @channel = channel
  @timestamp = timestamp
end

Class Method Details

.delete(token:, channel:, timestamp:) ⇒ Object



10
11
12
13
# File 'lib/slackbot_frd/slack_methods/chat_delete.rb', line 10

def self.delete(token:, channel:, timestamp:)
  r = ChatDelete.new(token: token, channel: channel, timestamp: timestamp)
  r.delete
end

Instance Method Details

#deleteObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/slackbot_frd/slack_methods/chat_delete.rb', line 21

def delete
  body = {
    token: @token,
    channel: @channel,
    ts: @timestamp,
  }

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