class OembedProxy::GoogleDocument

Google Docs Fauxembed

Constants

GOOGLE_DOCUMENT_REGEX

Public Instance Methods

get_data(url, _other_params = {}) click to toggle source
# File lib/oembed_proxy/google_document.rb, line 12
def get_data(url, _other_params = {})
  return nil unless handles_url? url

  oembed = {}

  oembed['type'] = 'rich'
  oembed['version'] = '1.0'

  oembed['provider_name'] = 'Google Apps Documents'
  oembed['provider_url'] = 'https://docs.google.com/document/‎'

  oembed['html'] = '<iframe class="google-docs document" width="100%" height="500" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src="' + url + '"></iframe>'
  oembed['width'] = 500
  oembed['height'] = 500

  oembed
end
handles_url?(url) click to toggle source
# File lib/oembed_proxy/google_document.rb, line 8
def handles_url?(url)
  !(url =~ GOOGLE_DOCUMENT_REGEX).nil?
end