module Onebox module Engine class GoogleDocsOnebox include Engine def self.supported_endpoints %w(spreadsheets document forms presentation) end matches_regexp /^(https?:)?\/\/(docs\.google\.com)\/(?(#{supported_endpoints.join('|')}))\/d\/((?[\w-]*)).+$/ always_https def to_html if document? "" elsif spreadsheet? "" elsif presentation? "" elsif forms? "" end end protected def spreadsheet? match[:endpoint] == 'spreadsheets' end def document? match[:endpoint] == 'document' end def presentation? match[:endpoint] == 'presentation' end def forms? match[:endpoint] == 'forms' end def key match[:key] end def match @match ||= @url.match(@@matcher) end end end end