Skip to content

Instantly share code, notes, and snippets.

@danielhopkins
Created May 16, 2014 16:00
Show Gist options
  • Save danielhopkins/d91c75e14a8d09c78ed9 to your computer and use it in GitHub Desktop.
Save danielhopkins/d91c75e14a8d09c78ed9 to your computer and use it in GitHub Desktop.
for nate.rb
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment