Permalink
Browse files

[Add] Thumbnail.name attribute

  • Loading branch information...
1 parent 5523994 commit 91210056d988c351e06add1a9e01da8974725fcd @mihu mihu committed Oct 1, 2012
Showing with 6 additions and 1 deletion.
  1. +3 −0 lib/youtube_it/model/thumbnail.rb
  2. +2 −1 lib/youtube_it/parser.rb
  3. +1 −0 test/test_video_feed_parser.rb
@@ -12,6 +12,9 @@ class Thumbnail < YouTubeIt::Record
# *String*:: Specifies the time offset at which the frame shown in the thumbnail image appears in the video.
attr_reader :time
+
+ # *String*:: Specified type of the thumbnail, attribute yt:name in feed
+ attr_reader :name
end
end
end
View
@@ -473,7 +473,8 @@ def parse_entry(entry)
:url => thumb_element["url"],
:height => thumb_element["height"].to_i,
:width => thumb_element["width"].to_i,
- :time => thumb_element["time"])
+ :time => thumb_element["time"],
+ :name => thumb_element["name"])
end
rating_element = entry.at_xpath("gd:rating")
@@ -128,6 +128,7 @@ def test_should_parse_thumbnails_correctly
assert_equal "00:02:58", thumbnail.time
assert_equal "http://i.ytimg.com/vi/AbC123DeFgH/default.jpg", thumbnail.url
assert_equal 120, thumbnail.width
+ assert_equal 'default', thumbnail.name
end
end

0 comments on commit 9121005

Please sign in to comment.