class Slackoff::HTTPS

Public Class Methods

new(uri) click to toggle source

URI should already be encoded as a ruby URI

# File lib/slackoff.rb, line 25
def initialize(uri)
  @uri = uri
end

Public Instance Methods

send(post) click to toggle source

body is a hash of data

# File lib/slackoff.rb, line 30
def send(post)
  http = Net::HTTP.new(@uri.host, @uri.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(@uri.request_uri)
  request.body = post.to_json

  response = http.request request

  response
end