Class: Yt::Models::Rating

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

Overview

Provides methods to modify the rating of a video on YouTube.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Associations::HasReports

#has_report

Methods included from Associations::HasOne

#has_one

Methods included from Associations::HasMany

#has_many

Methods included from Associations::HasAuthentication

#has_authentication

Constructor Details

#initialize(options = {}) ⇒ Rating

Returns a new instance of Rating.



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

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

Instance Attribute Details

#ratingSymbol? (readonly)

Returns the rating of a video (if present). Valid values are: :dislike, :like, :none, :unspecified.

Returns:

  • (Symbol, nil)

    the rating of a video (if present). Valid values are: :dislike, :like, :none, :unspecified



11
12
13
# File 'lib/yt/models/rating.rb', line 11

def rating
  @rating
end

Instance Method Details

#update(new_rating) ⇒ Object



19
20
21
# File 'lib/yt/models/rating.rb', line 19

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