Module: YouTubeImages
- Defined in:
- lib/youtube_images.rb
Defined Under Namespace
Classes: IncorrectYouTubeID
Class Method Summary collapse
Class Method Details
.For(id_or_url, secure = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/youtube_images.rb', line 7 def self.For(id_or_url, secure=false) id = id_or_url[/[\w]+$/] raise IncorrectYouTubeID if id.nil? || (id.length < 11) url_prefix = url_constructor(secure, id) { default: "#{url_prefix}/default.jpg", medium: "#{url_prefix}/hqdefault.jpg", high: "#{url_prefix}/mqdefault.jpg", maximum: "#{url_prefix}/maxresdefault.jpg" } end |