Module: Yt::Associations::HasViewerPercentages

Included in:
Models::Base
Defined in:
lib/yt/associations/has_viewer_percentages.rb

Overview

Provides methods to access the viewer percentage reports of a resource.

YouTube resources with viewer percentage reports are: channels and videos.

Instance Method Summary collapse

Instance Method Details

#has_viewer_percentagesObject

Defines two public instance methods to access the viewer percentages of a resource for a specific metric.

Examples:

Adds viewer_percentages and viewer_percentage on Channel.

class Channel < Resource
  has_viewer_percentages
end


29
30
31
32
33
34
# File 'lib/yt/associations/has_viewer_percentages.rb', line 29

def has_viewer_percentages
  require 'yt/collections/viewer_percentages'

  define_viewer_percentages_method
  define_viewer_percentage_method
end