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

Instance Method Details

#descriptionObject

Return the description of a Youtube object



16
17
18
# File 'lib/googol/readable.rb', line 16

def description
  info[:snippet][:description]
end

#idObject

Return the unique Youtube identifier of a Youtube object



6
7
8
# File 'lib/googol/readable.rb', line 6

def id
  info[:id]
end

#kindObject

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.

Parameters:

  • size (Hash) (defaults to: :default)

    a customizable set of options

Options Hash (size):

  • :default (Symbol)

    The size of the thumbnail. Valid values are: :default (channel: 88px x 88px, video: 120px x 90px) :medium (channel: 240px x 240px, video: 320px x 180px) :high (channel: 800px x 800px, video: 480px x 360px)

Returns:

  • (String)

    The thumbnail URL



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

#titleObject

Return the title of a Youtube object



11
12
13
# File 'lib/googol/readable.rb', line 11

def title
  info[:snippet][:title]
end