Class: Youtube::Video
- Inherits:
-
Object
- Object
- Youtube::Video
- Defined in:
- lib/youtube/video.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#comment_count ⇒ Object
Returns the value of attribute comment_count.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#length_seconds ⇒ Object
Returns the value of attribute length_seconds.
-
#rating_avg ⇒ Object
Returns the value of attribute rating_avg.
-
#rating_count ⇒ Object
Returns the value of attribute rating_count.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
-
#title ⇒ Object
Returns the value of attribute title.
-
#upload_time ⇒ Object
Returns the value of attribute upload_time.
-
#url ⇒ Object
Returns the value of attribute url.
-
#view_count ⇒ Object
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#to_xml ⇒ Object
Return self information as XML format.
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
28 29 30 |
# File 'lib/youtube/video.rb', line 28 def @author end |
#comment_count ⇒ Object
Returns the value of attribute comment_count.
37 38 39 |
# File 'lib/youtube/video.rb', line 37 def comment_count @comment_count end |
#description ⇒ Object
Returns the value of attribute description.
34 35 36 |
# File 'lib/youtube/video.rb', line 34 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
29 30 31 |
# File 'lib/youtube/video.rb', line 29 def id @id end |
#length_seconds ⇒ Object
Returns the value of attribute length_seconds.
31 32 33 |
# File 'lib/youtube/video.rb', line 31 def length_seconds @length_seconds end |
#rating_avg ⇒ Object
Returns the value of attribute rating_avg.
32 33 34 |
# File 'lib/youtube/video.rb', line 32 def @rating_avg end |
#rating_count ⇒ Object
Returns the value of attribute rating_count.
33 34 35 |
# File 'lib/youtube/video.rb', line 33 def @rating_count end |
#tags ⇒ Object
Returns the value of attribute tags.
38 39 40 |
# File 'lib/youtube/video.rb', line 38 def @tags end |
#thumbnail_url ⇒ Object
Returns the value of attribute thumbnail_url.
41 42 43 |
# File 'lib/youtube/video.rb', line 41 def thumbnail_url @thumbnail_url end |
#title ⇒ Object
Returns the value of attribute title.
30 31 32 |
# File 'lib/youtube/video.rb', line 30 def title @title end |
#upload_time ⇒ Object
Returns the value of attribute upload_time.
36 37 38 |
# File 'lib/youtube/video.rb', line 36 def upload_time @upload_time end |
#url ⇒ Object
Returns the value of attribute url.
40 41 42 |
# File 'lib/youtube/video.rb', line 40 def url @url end |
#view_count ⇒ Object
Returns the value of attribute view_count.
35 36 37 |
# File 'lib/youtube/video.rb', line 35 def view_count @view_count end |
Instance Method Details
#to_xml ⇒ Object
Return self information as XML format.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/youtube/video.rb', line 44 def to_xml xml = "<video>\n" instance_variables.each do |attr| value = instance_variable_get(attr).to_s value.gsub!(/<br \/>/, "\n") value.gsub!(/<.*?>/m, '') value.gsub!(/&/m, '&') value.gsub!(/'/m, ''') value.gsub!(/"/m, '"') value.gsub!(/</m, '<') value.gsub!(/>/m, '>') attr.sub!(/@/, '') xml += "<#{attr}>#{value}</#{attr}>\n" end xml += "</video>\n" end |