module PostHTTPS

Public Class Methods

call(url, hash_json) click to toggle source
# File lib/incoming_webhook_notifier/post_https.rb, line 6
def self.call(url, hash_json)
  uri = URI.parse(url)
  req = Net::HTTP::Post.new(uri.to_s)
  req.body = hash_json.to_json
  req['Content-Type'] = 'application/json'

  response = https(uri).request(req)

  response.body
end

Private Class Methods

https(uri) click to toggle source
# File lib/incoming_webhook_notifier/post_https.rb, line 19
def self.https(uri)
  Net::HTTP.new(uri.host, uri.port).tap do |http|
    http.use_ssl = true
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  end
end