Class: GoogleVideo::Video
Overview
Describes a single video file available for viewing on Google Video. Parameters are specified via a hash passed to the object on construction mapping attribute names to their respective values.
Constant Summary collapse
- DEFAULT_WIDTH =
the default width in pixels for the video embed html.
400
- DEFAULT_HEIGHT =
the default height in pixels for the video embed html.
326
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
the prose text describing the video contents.
-
#doc_id ⇒ Object
readonly
the google unique identifier.
-
#duration ⇒ Object
readonly
the duration of the video in prose, e.g.
-
#page_url ⇒ Object
readonly
the full url at which the video is available for viewing.
-
#playlist_entries ⇒ Object
readonly
only available via a details request: a list of PlaylistEntry objects detailed in the “Playlist” of next-up videos displayed on the video detail page.
-
#rank ⇒ Object
readonly
only available via a details request: the current rank of this video on the site.
-
#rank_email ⇒ Object
readonly
only available via a details request: the current rank of this video on the site based on email metrics.
-
#rank_embed ⇒ Object
readonly
only available via a details request: the current rank of this video on the site based on embedded html metrics.
-
#rank_yesterday ⇒ Object
readonly
only available via a details request: the rank of this video on the site yesterday.
-
#rating_count ⇒ Object
readonly
the number of ratings this video has received.
-
#star_count ⇒ Object
readonly
the number of stars all of the video ratings currently average out to, e.g.
-
#thumbnail_image_url ⇒ Object
readonly
the full url to the video thumbnail image.
-
#title ⇒ Object
readonly
the title text describing the video.
-
#upload_date ⇒ Object
readonly
the date at which the video was uploaded.
-
#upload_domain ⇒ Object
readonly
only available via a details request, and then only for some videos: the domain provided by the user who uploaded the video.
-
#upload_user ⇒ Object
readonly
the name of the user who uploaded the video; not always available.
-
#upload_user_url ⇒ Object
readonly
only available via a details request, and then only for some videos: the redirect url through Google Video through which you may reach the uploading user’s website.
-
#video_file_url ⇒ Object
readonly
only available via a details request: the url to the video’s
.gvp
format video file. -
#video_frame_thumbnails ⇒ Object
readonly
only available via a details request: a list of VideoFrameThumbnail objects describing zero or more individual frame stills within the video.
-
#view_count ⇒ Object
readonly
only available via a details request: the total number of views this video has received to date.
-
#view_count_email ⇒ Object
readonly
only available via a details request: the number of views this video has received based on email metrics.
-
#view_count_embed ⇒ Object
readonly
only available via a details request: the number of views this video has received based on embedded html metrics.
-
#view_count_yesterday ⇒ Object
(also: #yesterday_view_count)
readonly
only available via a details request: the number of views this video received yesterday.
Instance Method Summary collapse
-
#embed_html(width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) ⇒ Object
Returns HTML suitable for embedding this video in a web page with the video occupying the specified dimensions.
-
#initialize(params) ⇒ Video
constructor
Constructs a Video with the supplied hash mapping attribute names to their respective values.
-
#rank_delta ⇒ Object
only available via a details request: the change in rank this video has seen since yesterday’s rank: if positive, a move up, if negative, a move down.
Constructor Details
#initialize(params) ⇒ Video
Constructs a Video with the supplied hash mapping attribute names to their respective values.
161 162 163 164 165 166 167 168 169 |
# File 'lib/google-video.rb', line 161 def initialize (params) super(params) # pull the doc id out of the page url if we've got one if (@page_url) @page_url =~ /docid=([^&]+)/ @doc_id = $1.to_i end end |
Instance Attribute Details
#description ⇒ Object (readonly)
the prose text describing the video contents.
63 64 65 |
# File 'lib/google-video.rb', line 63 def description @description end |
#doc_id ⇒ Object (readonly)
the google unique identifier.
66 67 68 |
# File 'lib/google-video.rb', line 66 def doc_id @doc_id end |
#duration ⇒ Object (readonly)
the duration of the video in prose, e.g. “1hr 49min” or “3min”.
69 70 71 |
# File 'lib/google-video.rb', line 69 def duration @duration end |
#page_url ⇒ Object (readonly)
the full url at which the video is available for viewing.
72 73 74 |
# File 'lib/google-video.rb', line 72 def page_url @page_url end |
#playlist_entries ⇒ Object (readonly)
only available via a details request: a list of PlaylistEntry objects detailed in the “Playlist” of next-up videos displayed on the video detail page.
77 78 79 |
# File 'lib/google-video.rb', line 77 def playlist_entries @playlist_entries end |
#rank ⇒ Object (readonly)
only available via a details request: the current rank of this video on the site.
81 82 83 |
# File 'lib/google-video.rb', line 81 def rank @rank end |
#rank_email ⇒ Object (readonly)
only available via a details request: the current rank of this video on the site based on email metrics.
89 90 91 |
# File 'lib/google-video.rb', line 89 def rank_email @rank_email end |
#rank_embed ⇒ Object (readonly)
only available via a details request: the current rank of this video on the site based on embedded html metrics.
93 94 95 |
# File 'lib/google-video.rb', line 93 def @rank_embed end |
#rank_yesterday ⇒ Object (readonly)
only available via a details request: the rank of this video on the site yesterday.
85 86 87 |
# File 'lib/google-video.rb', line 85 def rank_yesterday @rank_yesterday end |
#rating_count ⇒ Object (readonly)
the number of ratings this video has received.
96 97 98 |
# File 'lib/google-video.rb', line 96 def @rating_count end |
#star_count ⇒ Object (readonly)
the number of stars all of the video ratings currently average out to, e.g. 4.5.
100 101 102 |
# File 'lib/google-video.rb', line 100 def star_count @star_count end |
#thumbnail_image_url ⇒ Object (readonly)
the full url to the video thumbnail image.
103 104 105 |
# File 'lib/google-video.rb', line 103 def thumbnail_image_url @thumbnail_image_url end |
#title ⇒ Object (readonly)
the title text describing the video.
106 107 108 |
# File 'lib/google-video.rb', line 106 def title @title end |
#upload_date ⇒ Object (readonly)
the date at which the video was uploaded.
109 110 111 |
# File 'lib/google-video.rb', line 109 def upload_date @upload_date end |
#upload_domain ⇒ Object (readonly)
only available via a details request, and then only for some videos: the domain provided by the user who uploaded the video.
116 117 118 |
# File 'lib/google-video.rb', line 116 def upload_domain @upload_domain end |
#upload_user ⇒ Object (readonly)
the name of the user who uploaded the video; not always available.
112 113 114 |
# File 'lib/google-video.rb', line 112 def upload_user @upload_user end |
#upload_user_url ⇒ Object (readonly)
only available via a details request, and then only for some videos: the redirect url through Google Video through which you may reach the uploading user’s website.
121 122 123 |
# File 'lib/google-video.rb', line 121 def upload_user_url @upload_user_url end |
#video_file_url ⇒ Object (readonly)
only available via a details request: the url to the video’s .gvp
format video file. see en.wikipedia.org/wiki/Google_Video#Google_Video_Player for more information on file formats and the like.
127 128 129 |
# File 'lib/google-video.rb', line 127 def video_file_url @video_file_url end |
#video_frame_thumbnails ⇒ Object (readonly)
only available via a details request: a list of VideoFrameThumbnail objects describing zero or more individual frame stills within the video.
132 133 134 |
# File 'lib/google-video.rb', line 132 def video_frame_thumbnails @video_frame_thumbnails end |
#view_count ⇒ Object (readonly)
only available via a details request: the total number of views this video has received to date.
136 137 138 |
# File 'lib/google-video.rb', line 136 def view_count @view_count end |
#view_count_email ⇒ Object (readonly)
only available via a details request: the number of views this video has received based on email metrics.
147 148 149 |
# File 'lib/google-video.rb', line 147 def view_count_email @view_count_email end |
#view_count_embed ⇒ Object (readonly)
only available via a details request: the number of views this video has received based on embedded html metrics.
151 152 153 |
# File 'lib/google-video.rb', line 151 def @view_count_embed end |
#view_count_yesterday ⇒ Object (readonly) Also known as: yesterday_view_count
only available via a details request: the number of views this video received yesterday.
140 141 142 |
# File 'lib/google-video.rb', line 140 def view_count_yesterday @view_count_yesterday end |
Instance Method Details
#embed_html(width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) ⇒ Object
Returns HTML suitable for embedding this video in a web page with the video occupying the specified dimensions. The generated html matches that which is provided by the Google Video web site embed instructions.
174 175 176 177 178 179 |
# File 'lib/google-video.rb', line 174 def (width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT) <<edoc <embed style="width:#{width}px; height:#{height}px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=#{@doc_id}&hl=en" flashvars=""> </embed> edoc end |
#rank_delta ⇒ Object
only available via a details request: the change in rank this video has seen since yesterday’s rank: if positive, a move up, if negative, a move down.
184 185 186 |
# File 'lib/google-video.rb', line 184 def rank_delta (@rank_yesterday - @rank) end |