Class: Spina::Embeds::Vimeo

Inherits:
Base
  • Object
show all
Defined in:
app/models/spina/embeds/vimeo.rb

Constant Summary collapse

REGEX =
/(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/

Instance Method Summary collapse

Methods included from TrixConversion

#to_trix_attachment, #wrap_with_embed_tag

Methods included from Spina::Embeddable

#initialize, #to_fields_path

Instance Method Details

#idObject



13
14
15
# File 'app/models/spina/embeds/vimeo.rb', line 13

def id
  REGEX.match(url).try(:[], 5)
end

#remote_titleObject

Get title from Vimeo API (remote call)



18
19
20
# File 'app/models/spina/embeds/vimeo.rb', line 18

def remote_title
  get_vimeo_json&.dig(0, "title")
end

#to_trix_partial_pathObject



22
23
24
# File 'app/models/spina/embeds/vimeo.rb', line 22

def to_trix_partial_path
  "spina/embeds/vimeos/thumbnail"
end