Class: Hermitcraft::Video
- Inherits:
-
Object
- Object
- Hermitcraft::Video
- Defined in:
- lib/hermitcraft/video.rb
Overview
This class wraps a video as represented by the Hermitcraft API.
Instance Attribute Summary collapse
-
#comment_count ⇒ Object
readonly
Returns the value of attribute comment_count.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#like_count ⇒ Object
readonly
Returns the value of attribute like_count.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#uploaded_at ⇒ Object
readonly
Returns the value of attribute uploaded_at.
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
-
#view_count ⇒ Object
readonly
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Video
constructor
A new instance of Video.
Constructor Details
#initialize(attributes) ⇒ Video
Returns a new instance of Video.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hermitcraft/video.rb', line 9 def initialize(attributes) @id = attributes['id'] @uploaded_at = Time.parse(attributes['uploaded']) # Sometimes, videos can show up with no uploader. I think this happens # when a Hermit has left Hermitcraft. @uploader = Uploader.new(attributes['uploader']) unless attributes['uploader'].nil? @title = attributes['title'] @duration = attributes['duration'] @like_count = attributes['likeCount'].to_i # hypno wat @view_count = attributes['viewCount'] @comment_count = attributes['commentCount'] end |
Instance Attribute Details
#comment_count ⇒ Object (readonly)
Returns the value of attribute comment_count.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def comment_count @comment_count end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def duration @duration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def id @id end |
#like_count ⇒ Object (readonly)
Returns the value of attribute like_count.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def like_count @like_count end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def title @title end |
#uploaded_at ⇒ Object (readonly)
Returns the value of attribute uploaded_at.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def uploaded_at @uploaded_at end |
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def uploader @uploader end |
#view_count ⇒ Object (readonly)
Returns the value of attribute view_count.
6 7 8 |
# File 'lib/hermitcraft/video.rb', line 6 def view_count @view_count end |