Module: SlackNotifySimple

Defined in:
lib/slack_notify_simple.rb,
lib/slack_notify_simple/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.call(url:, title:, message:, icon:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/slack_notify_simple.rb', line 6

def self.call(url:, title:, message:, icon:)
  uri = URI(url)
contents = <<-EOS
@channel:
```
#{message}
```
EOS
  hash = {
    "payload"=> {
      "username"    => title,
      "text"        => contents,
      "icon_emoji"  => icon
    }.to_json
  }
  Net::HTTP.post_form(uri, hash)
end