class Yt::Models::Rating

@private Provides methods to modify the rating of a video on YouTube. @see developers.google.com/youtube/v3/docs/videos/rate @see developers.google.com/youtube/v3/docs/videos/getRating

Attributes

rating[R]

@return [Symbol, nil] the rating of a video (if present).

Possible values are: +:dislike+, +:like+, +:none+, +:unspecified+.

Public Class Methods

new(options = {}) click to toggle source
# File lib/yt/models/rating.rb, line 14
def initialize(options = {})
  @rating = options[:rating].to_sym if options[:rating]
  @video_id = options[:video_id]
  @auth = options[:auth]
end

Public Instance Methods

set(new_rating) click to toggle source
# File lib/yt/models/rating.rb, line 20
def set(new_rating)
  do_update(params: {rating: new_rating}) {@rating = new_rating}
end

Private Instance Methods

update_params() click to toggle source

@return [Hash] the parameters to submit to YouTube to update a rating. @see developers.google.com/youtube/v3/docs/videos/rate

Calls superclass method Yt::Actions::Update#update_params
# File lib/yt/models/rating.rb, line 28
def update_params
  super.tap do |params|
    params[:method] = :post
    params[:path] = '/youtube/v3/videos/rate'
    params[:params] = {id: @video_id}
  end
end