Class: YouTubeG::Model::Video
- Defined in:
- lib/youtube_g/model/video.rb
Defined Under Namespace
Classes: Format
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#html_content ⇒ Object
readonly
Returns the value of attribute html_content.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#media_content ⇒ Object
readonly
YouTubeG::Model::Content records describing the individual media content data available for this video.
-
#noembed ⇒ Object
readonly
Returns the value of attribute noembed.
-
#player_url ⇒ Object
readonly
Returns the value of attribute player_url.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
-
#racy ⇒ Object
readonly
Returns the value of attribute racy.
-
#rating ⇒ Object
readonly
Returns the value of attribute rating.
-
#statistics ⇒ Object
readonly
Returns the value of attribute statistics.
-
#thumbnails ⇒ Object
readonly
YouTubeG::Model::Thumbnail records.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#video_id ⇒ Object
readonly
Returns the value of attribute video_id.
-
#view_count ⇒ Object
readonly
Returns the value of attribute view_count.
Instance Method Summary collapse
- #can_embed? ⇒ Boolean
- #default_media_content ⇒ Object
- #embed_html(width = 425, height = 350) ⇒ Object
- #embed_url ⇒ Object
-
#unique_id ⇒ Object
For convenience, the video_id with the URL stripped out, useful for searching for the video again without having to store it anywhere.
Methods inherited from Record
Constructor Details
This class inherits a constructor from YouTubeG::Record
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
52 53 54 |
# File 'lib/youtube_g/model/video.rb', line 52 def @author end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
48 49 50 |
# File 'lib/youtube_g/model/video.rb', line 48 def categories @categories end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
39 40 41 |
# File 'lib/youtube_g/model/video.rb', line 39 def duration @duration end |
#html_content ⇒ Object (readonly)
Returns the value of attribute html_content.
51 52 53 |
# File 'lib/youtube_g/model/video.rb', line 51 def html_content @html_content end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
49 50 51 |
# File 'lib/youtube_g/model/video.rb', line 49 def keywords @keywords end |
#media_content ⇒ Object (readonly)
YouTubeG::Model::Content records describing the individual media content data available for this video. Most, but not all, videos offer this.
56 57 58 |
# File 'lib/youtube_g/model/video.rb', line 56 def media_content @media_content end |
#noembed ⇒ Object (readonly)
Returns the value of attribute noembed.
40 41 42 |
# File 'lib/youtube_g/model/video.rb', line 40 def @noembed end |
#player_url ⇒ Object (readonly)
Returns the value of attribute player_url.
59 60 61 |
# File 'lib/youtube_g/model/video.rb', line 59 def player_url @player_url end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
41 42 43 |
# File 'lib/youtube_g/model/video.rb', line 41 def position @position end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
46 47 48 |
# File 'lib/youtube_g/model/video.rb', line 46 def published_at @published_at end |
#racy ⇒ Object (readonly)
Returns the value of attribute racy.
42 43 44 |
# File 'lib/youtube_g/model/video.rb', line 42 def racy @racy end |
#rating ⇒ Object (readonly)
Returns the value of attribute rating.
60 61 62 |
# File 'lib/youtube_g/model/video.rb', line 60 def @rating end |
#statistics ⇒ Object (readonly)
Returns the value of attribute statistics.
43 44 45 |
# File 'lib/youtube_g/model/video.rb', line 43 def statistics @statistics end |
#thumbnails ⇒ Object (readonly)
YouTubeG::Model::Thumbnail records
58 59 60 |
# File 'lib/youtube_g/model/video.rb', line 58 def thumbnails @thumbnails end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
50 51 52 |
# File 'lib/youtube_g/model/video.rb', line 50 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
47 48 49 |
# File 'lib/youtube_g/model/video.rb', line 47 def updated_at @updated_at end |
#video_id ⇒ Object (readonly)
Returns the value of attribute video_id.
45 46 47 |
# File 'lib/youtube_g/model/video.rb', line 45 def video_id @video_id end |
#view_count ⇒ Object (readonly)
Returns the value of attribute view_count.
61 62 63 |
# File 'lib/youtube_g/model/video.rb', line 61 def view_count @view_count end |
Instance Method Details
#can_embed? ⇒ Boolean
77 78 79 |
# File 'lib/youtube_g/model/video.rb', line 77 def not @noembed end |
#default_media_content ⇒ Object
81 82 83 |
# File 'lib/youtube_g/model/video.rb', line 81 def default_media_content @media_content.find { |c| c.is_default? } end |
#embed_html(width = 425, height = 350) ⇒ Object
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/youtube_g/model/video.rb', line 85 def (width = 425, height = 350) <<EDOC <object width="#{width}" height="#{height}"> <param name="movie" value="#{}"></param> <param name="wmode" value="transparent"></param> <embed src="#{}" type="application/x-shockwave-flash" wmode="transparent" width="#{width}" height="#{height}"></embed> </object> EDOC end |
#embed_url ⇒ Object
96 97 98 |
# File 'lib/youtube_g/model/video.rb', line 96 def @player_url.sub('watch?', '').sub('=', '/') end |
#unique_id ⇒ Object
For convenience, the video_id with the URL stripped out, useful for searching for the video again without having to store it anywhere. A regular query search, with this id will return the same video. gdata.youtube.com/feeds/videos/ZTUVgYoeN_o
73 74 75 |
# File 'lib/youtube_g/model/video.rb', line 73 def unique_id video_id.match(/videos\/([^<]+)/).captures.first end |