Class: MarkdownVideos::Services::YoutubeService

Inherits:
ServiceBase
  • Object
show all
Defined in:
lib/markdown_videos/services/youtube_service.rb

Instance Attribute Summary

Attributes inherited from ServiceBase

#alt_text, #class_name, #markdown_url, #markdown_url_data, #resource_id, #wrapper

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ServiceBase

#html_attributes, #html_dom_properties, #initialize, #render, #service_url, support, #to_html

Constructor Details

This class inherits a constructor from MarkdownVideos::Services::ServiceBase

Class Method Details

.regexpObject



5
6
7
# File 'lib/markdown_videos/services/youtube_service.rb', line 5

def self.regexp
  /^(https?:\/\/(?:youtu.be\/|www.youtube.com\/(?:watch\?v=|embed\/))([\w\-]{4,16})\??([\w\-\=]+)?)$/
end

Instance Method Details

#heightObject



13
14
15
# File 'lib/markdown_videos/services/youtube_service.rb', line 13

def height
  315
end

#urlObject



17
18
19
# File 'lib/markdown_videos/services/youtube_service.rb', line 17

def url
  "https://www.youtube.com/embed/#{resource_id}"
end

#url_parametersObject



21
22
23
# File 'lib/markdown_videos/services/youtube_service.rb', line 21

def url_parameters
  [:start]
end

#widthObject



9
10
11
# File 'lib/markdown_videos/services/youtube_service.rb', line 9

def width
  560
end