Class: Slackened::HTTP

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/slackened/http.rb

Overview

Post the message

Constant Summary collapse

HEADERS =
{
  'Content-Type' => 'application/json'
}.freeze

Class Method Summary collapse

Class Method Details

.post(blocks: [], headers: {}, url: Slackened.configuration.webhook_url) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/slackened/http.rb', line 20

def post(blocks: [], headers: {}, url: Slackened.configuration.webhook_url)

  body = JSON.dump({ blocks: })

  uri = URI(url)

  Net::HTTP.post(uri, body, HEADERS.merge(headers))
end