Wynn Netherland changelog.com/posts

Open Graph - Ruby library for Facebook's new API

[Updated]: Thanks to Michael’s correction in the comments below and more caffeine it’s apparent that Michael released two entirely unrelated Facebook gems yesterday. Also, as Mike points out, the example in this case is hypothetical since IMDb does not yet support OpenGraph.

OpenGraph is a way to let web publishers turn ordinary web pages into rich objects in a user’s social graph just by embedding some meta tags on the page:

<html xmlns:og="http://opengraphprotocol.org/schema/">
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="http://ia.media-imdb.com/images/rock.jpg" />

With Michael’s gem, you can now query a site and get this information back:

require 'opengraph'

movie = OpenGraph.fetch(http://www.imdb.com/title/tt0117500')

movie.title # => 'The Rock'
movie.movie? # => true
movie.image # => 'http://ia.media-imdb.com/images/rock.jpg'


[Source on GitHub] [OpenGraph protocol] [Facebook API docs]


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00