Class: Yt::Collections::ChannelSections
- Defined in:
- lib/yt/collections/channel_sections.rb
Overview
Provides methods for a collection of YouTube channel sections.
Resources with channel_sections is channels.
Instance Method Summary collapse
- #attributes_for_new_item(data) ⇒ Object
- #channel_sections_params ⇒ Object
-
#list_params ⇒ Hash
The parameters to submit to YouTube to list channel sections.
Methods inherited from Base
#includes, #initialize, of, #where
Constructor Details
This class inherits a constructor from Yt::Collections::Base
Instance Method Details
#attributes_for_new_item(data) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/yt/collections/channel_sections.rb', line 11 def attributes_for_new_item(data) {}.tap do |attributes| attributes[:id] = data['id'] attributes[:snippet] = data['snippet'] attributes[:content_details] = data['contentDetails'] end end |
#channel_sections_params ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/yt/collections/channel_sections.rb', line 28 def channel_sections_params {}.tap do |params| params[:part] = 'snippet' params.merge! @parent.channel_sections_params if @parent # TODO: when to mine, when to on_behalf_of_content_owner # if @parent.auth # if @parent.auth.owner_name # params[:on_behalf_of_content_owner] = @parent.auth.owner_name # else # params[:mine] = true # end # end params end end |
#list_params ⇒ Hash
Returns the parameters to submit to YouTube to list channel sections.
21 22 23 24 25 26 |
# File 'lib/yt/collections/channel_sections.rb', line 21 def list_params super.tap do |params| params[:params] = channel_sections_params params[:path] = '/youtube/v3/channelSections' end end |