Created
May 1, 2012 12:14
-
-
Save andresgutgon/2567637 to your computer and use it in GitHub Desktop.
Simular que Facebook nos notifica de un cambio
This file contains 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 characters
#!/usr/bin/env ruby | |
require 'uri' | |
require 'json' | |
require 'net/http' | |
uri = URI.parse("http://localhost:3000/call_back_url") | |
post_params = { | |
:object => "user", | |
:entry => [ | |
{:uid => 248656665, :id => 248656665, :time => 1335867574, :changed_fields => ["feed"]}, | |
{:uid => 248656665, :id => 248656665, :time => 1335867574, :changed_fields => ["feed"]} | |
] | |
} | |
req = Net::HTTP::Post.new(uri.path) | |
req.body = JSON.generate(post_params) | |
req["Content-Type"] = "application/json" | |
http = Net::HTTP.new(uri.host, uri.port) | |
response = http.start {|htt| htt.request(req)} | |
puts response.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment