Class: Dato::Local::FieldType::Video

Inherits:
Object
  • Object
show all
Defined in:
lib/dato/local/field_type/video.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Video

Returns a new instance of Video.



13
14
15
# File 'lib/dato/local/field_type/video.rb', line 13

def initialize(attributes)
  @attributes = attributes
end

Class Method Details

.parse(value, _repo) ⇒ Object



9
10
11
# File 'lib/dato/local/field_type/video.rb', line 9

def self.parse(value, _repo)
  new(value)
end

Instance Method Details

#heightObject



33
34
35
# File 'lib/dato/local/field_type/video.rb', line 33

def height
  @attributes[:height]
end

#iframe_embed(width = nil, height = nil) ⇒ Object



49
50
51
# File 'lib/dato/local/field_type/video.rb', line 49

def iframe_embed(width = nil, height = nil)
  VideoEmbed.embed(url, { width: width, height: height }.compact)
end

#providerObject



37
38
39
# File 'lib/dato/local/field_type/video.rb', line 37

def provider
  @attributes[:provider]
end

#provider_uidObject



45
46
47
# File 'lib/dato/local/field_type/video.rb', line 45

def provider_uid
  @attributes[:provider_uid]
end

#provider_urlObject



41
42
43
# File 'lib/dato/local/field_type/video.rb', line 41

def provider_url
  @attributes[:provider_url]
end

#thumbnail_urlObject



21
22
23
# File 'lib/dato/local/field_type/video.rb', line 21

def thumbnail_url
  @attributes[:thumbnail_url]
end

#titleObject



25
26
27
# File 'lib/dato/local/field_type/video.rb', line 25

def title
  @attributes[:title]
end

#urlObject



17
18
19
# File 'lib/dato/local/field_type/video.rb', line 17

def url
  @attributes[:url]
end

#widthObject



29
30
31
# File 'lib/dato/local/field_type/video.rb', line 29

def width
  @attributes[:width]
end