Class: SlackBot::Notify

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/slack_bot/notify.rb

Class Method Summary collapse

Class Method Details

.executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/slack_bot/notify.rb', line 4

def self.execute
  query = {
      token: ::SlackBot.token,
      channel: ::SlackBot.channel,
      text: ::SlackBot.body,
      username: ::SlackBot.bot_name
  }
  uri = Addressable::URI.parse(::SlackBot.endpoint)
  uri.query_values ||= {}
  uri.query_values = uri.query_values.merge(query)

  Net::HTTP.get(URI.parse(uri))
end