Class: Redtube::Video
Instance Attribute Summary collapse
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#id ⇒ Object
Returns the value of attribute id.
-
#rating ⇒ Object
Returns the value of attribute rating.
-
#ratings ⇒ Object
Returns the value of attribute ratings.
-
#thumb ⇒ Object
Returns the value of attribute thumb.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
-
#views ⇒ Object
Returns the value of attribute views.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(video) ⇒ Video
constructor
A new instance of Video.
Methods inherited from Base
elements_by_query, find_by_query, get, name
Constructor Details
#initialize(video) ⇒ Video
Returns a new instance of Video.
13 14 15 16 |
# File 'lib/redtube/video.rb', line 13 def initialize(video) @id = video["video_id"] %w(duration views rating ratings title url thumb).each { |name| send "#{name}=", video[name] } end |
Instance Attribute Details
#duration ⇒ Object
Returns the value of attribute duration.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def duration @duration end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def id @id end |
#rating ⇒ Object
Returns the value of attribute rating.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def @rating end |
#ratings ⇒ Object
Returns the value of attribute ratings.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def @ratings end |
#thumb ⇒ Object
Returns the value of attribute thumb.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def thumb @thumb end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def url @url end |
#views ⇒ Object
Returns the value of attribute views.
3 4 5 |
# File 'lib/redtube/video.rb', line 3 def views @views end |
Class Method Details
.find(id) ⇒ Object
5 6 7 |
# File 'lib/redtube/video.rb', line 5 def self.find(id) find_by_query("getVideoById&video_id=#{id}").first end |
.search(term) ⇒ Object
9 10 11 |
# File 'lib/redtube/video.rb', line 9 def self.search(term) find_by_query "searchVideos&search=#{term}" end |