class Yt::Collections::SubscribedChannels

Provides methods to interact with the list of channels a resource is subscribed to.

Resources with subscribed channels are: {Yt::Models::Channel channels}.

Private Instance Methods

attributes_for_new_item(data) click to toggle source
# File lib/yt/collections/subscribed_channels.rb, line 14
def attributes_for_new_item(data)
  snippet = data.fetch 'snippet', {}
  resource = snippet.fetch 'resourceId', {}
  {id: resource['channelId'], snippet: snippet, auth: @auth}
end
channels_params() click to toggle source

@private @note Subscribers overwrites channel_params since the query

is slightly different.
# File lib/yt/collections/subscribed_channels.rb, line 29
def channels_params
  {}.tap do |params|
    params[:max_results] = 50
    params[:part] = 'snippet'
    params[:channel_id] = @parent.id
    apply_where_params! params
  end
end
list_params() click to toggle source

@return [Hash] the parameters to submit to YouTube to list subscribers. @see developers.google.com/youtube/v3/docs/subscriptions/list

Calls superclass method Yt::Collections::Channels#list_params
# File lib/yt/collections/subscribed_channels.rb, line 22
def list_params
  super.tap{|params| params[:path] = '/youtube/v3/subscriptions'}
end
resource_class() click to toggle source

@private @note Subscribers overwrites list_resources since the objects to

instatiate belongs to Channel class not Subscriber.
# File lib/yt/collections/subscribed_channels.rb, line 41
def resource_class
  Yt::Models::Channel
end