Class: YTVideo
- Inherits:
-
Object
- Object
- YTVideo
- Defined in:
- lib/yt_video.rb
Instance Attribute Summary collapse
-
#comment_count ⇒ Object
readonly
Returns the value of attribute comment_count.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#comments_uri ⇒ Object
readonly
Returns the value of attribute comments_uri.
-
#description ⇒ Object
Returns the value of attribute description.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#favorite_count ⇒ Object
readonly
Returns the value of attribute favorite_count.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#keywords ⇒ Object
Returns the value of attribute keywords.
-
#player_uri ⇒ Object
readonly
Returns the value of attribute player_uri.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
-
#ratings ⇒ Object
readonly
Returns the value of attribute ratings.
-
#ratings_uri ⇒ Object
readonly
Returns the value of attribute ratings_uri.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#thumbnails ⇒ Object
readonly
Returns the value of attribute thumbnails.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#view_count ⇒ Object
readonly
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#initialize(data) ⇒ YTVideo
constructor
A new instance of YTVideo.
- #to_xml ⇒ Object
Constructor Details
#initialize(data) ⇒ YTVideo
Returns a new instance of YTVideo.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/yt_video.rb', line 6 def initialize(data) @id = data[:id] @title = data[:title] @description = data[:description] @keywords = data[:keywords] @duration = data[:duration] @player_uri = data[:player_uri] @ratings_uri = data[:ratings_uri] @comments_uri = data[:comments_uri] @published_at = data[:published_at] @updated_at = data[:updated_at] @thumbnails = data[:thumbnails] @view_count = data[:view_count] @favorite_count = data[:favorite_count] @comment_count = data[:comment_count] @ratings = data[:ratings] @comments = data[:comments] @status = data[:status] @thumbnails = data[:thumbnails] end |
Instance Attribute Details
#comment_count ⇒ Object (readonly)
Returns the value of attribute comment_count.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def comment_count @comment_count end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def comments @comments end |
#comments_uri ⇒ Object (readonly)
Returns the value of attribute comments_uri.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def comments_uri @comments_uri end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/yt_video.rb', line 4 def description @description end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def duration @duration end |
#favorite_count ⇒ Object (readonly)
Returns the value of attribute favorite_count.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def favorite_count @favorite_count end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def id @id end |
#keywords ⇒ Object
Returns the value of attribute keywords.
4 5 6 |
# File 'lib/yt_video.rb', line 4 def keywords @keywords end |
#player_uri ⇒ Object (readonly)
Returns the value of attribute player_uri.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def player_uri @player_uri end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def published_at @published_at end |
#ratings ⇒ Object (readonly)
Returns the value of attribute ratings.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def @ratings end |
#ratings_uri ⇒ Object (readonly)
Returns the value of attribute ratings_uri.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def @ratings_uri end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def status @status end |
#thumbnails ⇒ Object (readonly)
Returns the value of attribute thumbnails.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def thumbnails @thumbnails end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/yt_video.rb', line 4 def title @title end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def updated_at @updated_at end |
#view_count ⇒ Object (readonly)
Returns the value of attribute view_count.
3 4 5 |
# File 'lib/yt_video.rb', line 3 def view_count @view_count end |
Instance Method Details
#to_xml ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/yt_video.rb', line 27 def to_xml data = <<-XMLSTOP <?xml version="1.0"?> <entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <media:group> <media:title type="plain">#{@title}</media:title> <media:description type="plain">#{@description}</media:description> <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Tech</media:category> <media:keywords>#{@keywords}</media:keywords> </media:group> </entry> XMLSTOP return data end |