Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andresgutgon/2567637 to your computer and use it in GitHub Desktop.
Save andresgutgon/2567637 to your computer and use it in GitHub Desktop.
Simular que Facebook nos notifica de un cambio
#!/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