kylejginavan / youtube_it

An object-oriented Ruby wrapper for the YouTube GData API
http://groups.google.com/group/ruby-youtube-library
595 stars 223 forks source link

'term' and 'label' are not defined for 'category' #82

Closed serv closed 12 years ago

serv commented 12 years ago

To replicate this,

  1. Set client.
  2. Find video using url.
video = client.video_by("YOUTUBE_VIDEO_URL")
video.categories # => [#<YouTubeIt::Model::Category:0x007fef11139428 @term="Music", @label="Music">] 
video.categories.term # => NoMethodError: undefined method `term' for #<Array:0x007fef11137948>
video.categories.label # => NoMethodError: undefined method `label' for #<Array:0x007fef11137948>
chebyte commented 12 years ago

the problem is that the categories is an array so you have to do the following:

video.categories.first.label

or

video.categories.first.term

cheers!