Class: ArticleJSON::Utils::OEmbedResolver::YoutubeVideo

Inherits:
Base
  • Object
show all
Defined in:
lib/article_json/utils/o_embed_resolver/youtube_video.rb

Instance Method Summary collapse

Methods inherited from Base

build, #initialize, #oembed_data, resolver_by_embed_type, #unavailable_message

Constructor Details

This class inherits a constructor from ArticleJSON::Utils::OEmbedResolver::Base

Instance Method Details

#nameString

Human readable name of the resolver

Returns:

  • (String)


7
8
9
# File 'lib/article_json/utils/o_embed_resolver/youtube_video.rb', line 7

def name
  'Youtube video'
end

#oembed_urlString

The URL for the oembed API call

Returns:

  • (String)


13
14
15
# File 'lib/article_json/utils/o_embed_resolver/youtube_video.rb', line 13

def oembed_url
  "https://www.youtube.com/oembed?format=json&url=#{source_url}"
end

#source_urlString

The video URL of the element

Returns:

  • (String)


19
20
21
# File 'lib/article_json/utils/o_embed_resolver/youtube_video.rb', line 19

def source_url
  "https://www.youtube.com/watch?v=#{@element.embed_id}"
end