Class: Yt::Models::ContentDetail
- Defined in:
- lib/yt/models/content_detail.rb
Overview
Encapsulates information about the video content, including the length of the video and an indication of whether captions are available.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#captioned? ⇒ Boolean
Whether captions are available for the video.
-
#duration ⇒ Integer
The duration of the video (in seconds).
-
#hd? ⇒ Boolean
Whether the video is available in high definition.
-
#initialize(options = {}) ⇒ ContentDetail
constructor
A new instance of ContentDetail.
-
#licensed? ⇒ Boolean
Whether the video represents licensed content, which means that the content has been claimed by a YouTube content partner.
-
#stereoscopic? ⇒ Boolean
Whether the video is available in 3D.
Methods included from Associations::HasReports
Methods included from Associations::HasViewerPercentages
Methods included from Associations::HasOne
Methods included from Associations::HasMany
Methods included from Associations::HasAuthentication
Constructor Details
#initialize(options = {}) ⇒ ContentDetail
Returns a new instance of ContentDetail.
11 12 13 |
# File 'lib/yt/models/content_detail.rb', line 11 def initialize( = {}) @data = [:data] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/yt/models/content_detail.rb', line 9 def data @data end |
Instance Method Details
#captioned? ⇒ Boolean
Returns whether captions are available for the video.
31 32 33 |
# File 'lib/yt/models/content_detail.rb', line 31 has_attribute :captioned?, from: :caption do || == 'true' end |
#duration ⇒ Integer
Returns the duration of the video (in seconds).
16 17 18 |
# File 'lib/yt/models/content_detail.rb', line 16 has_attribute :duration, default: 0 do |value| to_seconds value end |
#hd? ⇒ Boolean
Returns whether the video is available in high definition.
26 27 28 |
# File 'lib/yt/models/content_detail.rb', line 26 has_attribute :hd?, from: :definition do |definition| definition == 'hd' end |
#licensed? ⇒ Boolean
Returns whether the video represents licensed content, which means that the content has been claimed by a YouTube content partner.
37 |
# File 'lib/yt/models/content_detail.rb', line 37 has_attribute :licensed?, default: false, from: :licensed_content |
#stereoscopic? ⇒ Boolean
Returns whether the video is available in 3D.
21 22 23 |
# File 'lib/yt/models/content_detail.rb', line 21 has_attribute :stereoscopic?, from: :dimension do |dimension| dimension == '3d' end |