Created
May 16, 2014 16:00
-
-
Save danielhopkins/d91c75e14a8d09c78ed9 to your computer and use it in GitHub Desktop.
Revisions
-
Dan Hopkins created this gist
May 16, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env ruby require 'rubygems' require 'json' require 'uri' require 'net/http' json = [ {:foo => "bar"}, {:foo => 'chicken'}, {:foo => 123}, {:foo => 123.00000}, {:bar => "bot"} ] json.each do |body| uri = URI("http://requestb.in/ub1oi4ub") http = Net::HTTP.new(uri.host, uri.port) r = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'}) r.body = JSON.generate(body) response = http.request(r).code puts response end