Class: YTVideo

Inherits:
Object
  • Object
show all
Defined in:
lib/yt_video.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_countObject (readonly)

Returns the value of attribute comment_count.



3
4
5
# File 'lib/yt_video.rb', line 3

def comment_count
  @comment_count
end

#commentsObject (readonly)

Returns the value of attribute comments.



3
4
5
# File 'lib/yt_video.rb', line 3

def comments
  @comments
end

#comments_uriObject (readonly)

Returns the value of attribute comments_uri.



3
4
5
# File 'lib/yt_video.rb', line 3

def comments_uri
  @comments_uri
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/yt_video.rb', line 4

def description
  @description
end

#durationObject (readonly)

Returns the value of attribute duration.



3
4
5
# File 'lib/yt_video.rb', line 3

def duration
  @duration
end

#favorite_countObject (readonly)

Returns the value of attribute favorite_count.



3
4
5
# File 'lib/yt_video.rb', line 3

def favorite_count
  @favorite_count
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/yt_video.rb', line 3

def id
  @id
end

#keywordsObject

Returns the value of attribute keywords.



4
5
6
# File 'lib/yt_video.rb', line 4

def keywords
  @keywords
end

#player_uriObject (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_atObject (readonly)

Returns the value of attribute published_at.



3
4
5
# File 'lib/yt_video.rb', line 3

def published_at
  @published_at
end

#ratingsObject (readonly)

Returns the value of attribute ratings.



3
4
5
# File 'lib/yt_video.rb', line 3

def ratings
  @ratings
end

#ratings_uriObject (readonly)

Returns the value of attribute ratings_uri.



3
4
5
# File 'lib/yt_video.rb', line 3

def ratings_uri
  @ratings_uri
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/yt_video.rb', line 3

def status
  @status
end

#thumbnailsObject (readonly)

Returns the value of attribute thumbnails.



3
4
5
# File 'lib/yt_video.rb', line 3

def thumbnails
  @thumbnails
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/yt_video.rb', line 4

def title
  @title
end

#updated_atObject (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_countObject (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_xmlObject



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