Last Updated: February 25, 2016
·
1.338K
· soulim

oEmbed client on Ruby

oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.

I've created oembed gem. This library helps to you build a client for any oEmbed provider.

require 'oembed'

class SpeakerDeck
  include Oembed::Client

  # oEmbed endpoint URI
  def endpoint_uri
    'http://speakerdeck.com/oembed.json'
  end
end

# Create client and fetch data
client = SpeakerDeck.new
client.fetch('https://speakerdeck.com/u/soulim/p/rails')

The method #fetch will return a hash with oEmded data.

Read more...