class BoxcarClient::Agent
Public Class Methods
new(url, data)
click to toggle source
# File lib/boxcar_client/agent.rb, line 3 def initialize(url, data) @url = url @data = data end
Public Instance Methods
post()
click to toggle source
# File lib/boxcar_client/agent.rb, line 8 def post uri = URI(@url) request = Net::HTTP::Post.new(uri.to_s) request.set_form_data(@data) begin response = Net::HTTP.start(uri.hostname, uri.port).request(request) response_handler response rescue end end
Private Instance Methods
response_handler(response)
click to toggle source
# File lib/boxcar_client/agent.rb, line 21 def response_handler(response) case response when Net::HTTPSuccess "OK" else response.value end end