Module: Googol::Readable
- Included in:
- YoutubeAccount, YoutubeResource
- Defined in:
- lib/googol/readable.rb
Overview
Provides methods to read attributes for public objects (accounts, videos..)
Instance Method Summary collapse
-
#description ⇒ Object
Return the description of a Youtube object.
-
#id ⇒ Object
Return the unique Youtube identifier of a Youtube object.
-
#kind ⇒ Object
Return the kind of the Youtube object (either ‘channel’ or ‘video’).
-
#thumbnail_url(size = :default) ⇒ String
Return the URL of the thumbnail image of the Youtube channel/videp.
-
#title ⇒ Object
Return the title of a Youtube object.
Instance Method Details
#description ⇒ Object
Return the description of a Youtube object
16 17 18 |
# File 'lib/googol/readable.rb', line 16 def description info[:snippet][:description] end |
#id ⇒ Object
Return the unique Youtube identifier of a Youtube object
6 7 8 |
# File 'lib/googol/readable.rb', line 6 def id info[:id] end |
#kind ⇒ Object
Return the kind of the Youtube object (either ‘channel’ or ‘video’)
34 35 36 |
# File 'lib/googol/readable.rb', line 34 def kind info.fetch(:kind, '').split("#").last end |
#thumbnail_url(size = :default) ⇒ String
Return the URL of the thumbnail image of the Youtube channel/videp.
28 29 30 31 |
# File 'lib/googol/readable.rb', line 28 def thumbnail_url(size = :default) size = :default unless [:medium, :high].include? size info[:snippet][:thumbnails][size][:url] end |
#title ⇒ Object
Return the title of a Youtube object
11 12 13 |
# File 'lib/googol/readable.rb', line 11 def title info[:snippet][:title] end |