Class: RBVIMEO::Video
- Inherits:
-
Object
- Object
- RBVIMEO::Video
- Defined in:
- lib/rbvimeo/video.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#number_of_comments ⇒ Object
readonly
Returns the value of attribute number_of_comments.
-
#number_of_likes ⇒ Object
readonly
Returns the value of attribute number_of_likes.
-
#number_of_plays ⇒ Object
readonly
Returns the value of attribute number_of_plays.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#thumbs ⇒ Object
readonly
Returns the value of attribute thumbs.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#upload_date ⇒ Object
readonly
Returns the value of attribute upload_date.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #comments ⇒ Object
-
#embed(width, height) ⇒ Object
Returns the code to embed the video.
-
#initialize(id, vimeo) ⇒ Video
constructor
Fetches data about a video from the Vimeo site id is the id of the the Vimeo video vimeo is an instance of RBVIMEO::Vimeo.
- #likes ⇒ Object
- #num_comments ⇒ Object
- #plays ⇒ Object
Constructor Details
#initialize(id, vimeo) ⇒ Video
Fetches data about a video from the Vimeo site id is the id of the the Vimeo video vimeo is an instance of RBVIMEO::Vimeo
To load a movie with vimeo id 339189: video = RBVIMEO::Video.new 339189, @vimeo
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbvimeo/video.rb', line 15 def initialize id, vimeo @thumbs = [] @comments = [] @id = id @vimeo = vimeo url = vimeo.generate_url({"method" => "vimeo.videos.getInfo", "video_id" => id, "api_key" => vimeo.api_key}, "read") xml_doc = @vimeo.get_xml(url) return @id = -1 if parse_xml(xml_doc).nil? end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def description @description end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
5 6 7 |
# File 'lib/rbvimeo/video.rb', line 5 def duration @duration end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def height @height end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def id @id end |
#number_of_comments ⇒ Object (readonly)
Returns the value of attribute number_of_comments.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def number_of_comments @number_of_comments end |
#number_of_likes ⇒ Object (readonly)
Returns the value of attribute number_of_likes.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def number_of_likes @number_of_likes end |
#number_of_plays ⇒ Object (readonly)
Returns the value of attribute number_of_plays.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def number_of_plays @number_of_plays end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def owner @owner end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def @tags end |
#thumbs ⇒ Object (readonly)
Returns the value of attribute thumbs.
5 6 7 |
# File 'lib/rbvimeo/video.rb', line 5 def thumbs @thumbs end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def title @title end |
#upload_date ⇒ Object (readonly)
Returns the value of attribute upload_date.
3 4 5 |
# File 'lib/rbvimeo/video.rb', line 3 def upload_date @upload_date end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def url @url end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/rbvimeo/video.rb', line 4 def width @width end |
Instance Method Details
#comments ⇒ Object
41 42 43 44 |
# File 'lib/rbvimeo/video.rb', line 41 def comments get_comments if @comments.empty? return @comments end |
#embed(width, height) ⇒ Object
Returns the code to embed the video
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rbvimeo/video.rb', line 30 def width, height string = <<EOF <object type="application/x-shockwave-flash" width=#{width} height=#{height} data="http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0'&show_byline=0&showportrait=0&color=00ADEF"> <param name="quality" value="best" /> <param name="allowfullscreen" value="false" /> <param name="scale" value="showAll" /> <param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=#{@id}&server=www.vimeo.com&fullscreen=0&show_title=0&show_byline=0&showportrait=0&color=00ADEF" /></object> EOF string.gsub("\n", "") end |
#likes ⇒ Object
46 47 48 |
# File 'lib/rbvimeo/video.rb', line 46 def likes @number_of_likes.to_i end |
#num_comments ⇒ Object
54 55 56 |
# File 'lib/rbvimeo/video.rb', line 54 def num_comments @number_of_comments.to_i end |
#plays ⇒ Object
50 51 52 |
# File 'lib/rbvimeo/video.rb', line 50 def plays @number_of_plays.to_i end |