Sha256: 453a92b2f468867a8627743d38ee753d5b48528a7c8bb34b196bb0c7c0988b48

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

module OembedProviderEngine
  # 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
oembed_provider_engine-0.2.0 app/helpers/oembed_provider_engine/oembed_provider_helper.rb
oembed_provider_engine-0.1.0 app/helpers/oembed_provider_engine/oembed_provider_helper.rb
oembed_provider_engine-0.0.1 app/helpers/oembed_provider_engine/oembed_provider_helper.rb