Sha256: dbf5fe6d2179969a4608fcfc06d3fef36438dda6905ec6140e6a41473e985167

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 Bytes

Contents

# include this in your relevant helpers
# to add discoverability link, etc.
module OembedProviderHelper
  # hardcodes http as protocol
  # http is specified in http://oembed.com/
  def oembed_provider_links
    host_url = request.host
    escaped_request_url = request.url.sub('://', '%3A//')
    html = tag(:link, :rel => "alternate",
               :type => "application/json+oembed",
               :href => "http://#{host_url}/oembed?url=#{escaped_request_url}",
               :title => "JSON oEmbed for #{@title}")
    html += tag(:link, :rel => "alternate",
               :type => "application/xml+oembed",
               :href => "http://#{host_url}/oembed.xml?url=#{escaped_request_url}",
               :title => "XML oEmbed for #{@title}")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oembed_provider-0.1.1 lib/oembed_provider_helper.rb
oembed_provider-0.1.0 lib/oembed_provider_helper.rb