class Relay::Ops::WebHook
Attributes
http[R]
uri[R]
Public Class Methods
client(url)
click to toggle source
# File lib/relay/ops/web_hook.rb, line 20 def self.client(url) new(url) end
new(url)
click to toggle source
# File lib/relay/ops/web_hook.rb, line 6 def initialize(url) @uri = URI.parse(url).freeze @http = Net::HTTP.new(@uri.host, @uri.port) @http.use_ssl = @uri.is_a?(URI::HTTPS) end
Public Instance Methods
post(params)
click to toggle source
# File lib/relay/ops/web_hook.rb, line 12 def post(params) http.start do request = Net::HTTP::Post.new(uri.path) request.set_form_data(payload: params.to_json) http.request(request) end end