class Onebox::Engine::GoogleDocsOnebox

Constants

SHORT_TYPES
SUPPORTED_ENDPOINTS

Private Instance Methods

data() click to toggle source
# File lib/onebox/engine/google_docs_onebox.rb, line 23
def data
  og_data = get_opengraph
  short_type = SHORT_TYPES[match[:endpoint].to_sym]

  description = if Onebox::Helpers.blank?(og_data.description)
    "This #{short_type.to_s.chop.capitalize} is private"
  else
    Onebox::Helpers.truncate(og_data.description, 250)
  end

  {
    link: link,
    title: og_data.title || "Google #{short_type.to_s.capitalize}",
    description: description,
    type: short_type
  }
end
match() click to toggle source
# File lib/onebox/engine/google_docs_onebox.rb, line 41
def match
  @match ||= @url.match(@@matcher)
end