Class: YoutubeCaptions::Video
- Inherits:
-
Object
- Object
- YoutubeCaptions::Video
- Defined in:
- lib/youtube-captions/video.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Instance Method Summary collapse
- #available_langs ⇒ Object
- #captions(lang: nil) ⇒ Object
-
#initialize(id:) ⇒ Video
constructor
A new instance of Video.
Constructor Details
#initialize(id:) ⇒ Video
Returns a new instance of Video.
4 5 6 |
# File 'lib/youtube-captions/video.rb', line 4 def initialize(id:) @info = YoutubeCaptions::Info.new(id: parse_youtube_id(id)).call end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
3 4 5 |
# File 'lib/youtube-captions/video.rb', line 3 def info @info end |
Instance Method Details
#available_langs ⇒ Object
12 13 14 |
# File 'lib/youtube-captions/video.rb', line 12 def available_langs info.map { |json| json["languageCode"] } end |
#captions(lang: nil) ⇒ Object
8 9 10 |
# File 'lib/youtube-captions/video.rb', line 8 def (lang: nil) YoutubeCaptions::Captions.new(info: info, lang: lang).call end |