Class: Yt::Rating

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/rating.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Associations

#has_many

Methods included from Actions::Update

#do_update

Constructor Details

#initialize(options = {}) ⇒ Rating

Returns a new instance of Rating.



7
8
9
10
11
# File 'lib/yt/models/rating.rb', line 7

def initialize(options = {})
  @rating = options[:rating].to_sym if options[:rating]
  @video_id = options[:video_id]
  @auth = options[:auth]
end

Instance Attribute Details

#ratingObject (readonly)

Returns the value of attribute rating.



5
6
7
# File 'lib/yt/models/rating.rb', line 5

def rating
  @rating
end

Instance Method Details

#update(new_rating) ⇒ Object



13
14
15
# File 'lib/yt/models/rating.rb', line 13

def update(new_rating)
  do_update(params: {rating: new_rating}) {@rating = new_rating}
end