Module: OembedProviderHelper

Defined in:
lib/oembed_provider_helper.rb

Overview

include this in your relevant helpers to add discoverability link, etc.

Instance Method Summary collapse

Instance Method Details

hardcodes http as protocol http is specified in oembed.com/



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/oembed_provider_helper.rb', line 6

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