class Yt::Models::Claim
Provides methods to interact with YouTube ContentID claims. @see developers.google.com/youtube/partner/docs/v1/claims
Attributes
Public Class Methods
Source
# File lib/yt/models/claim.rb, line 10 def initialize(options = {}) @data = options[:data] @id = options[:id] @auth = options[:auth] @asset = options[:asset] if options[:asset] end
Public Instance Methods
Source
# File lib/yt/models/claim.rb, line 67 def active? status == 'active' end
@return [Boolean] whether the claim is active.
Source
# File lib/yt/models/claim.rb, line 72 def appealed? status == 'appealed' end
@return [Boolean] whether the claim is appealed.
Source
# File lib/yt/models/claim.rb, line 134 def asset @asset end
@return [Yt::Models::Asset] the asset of the claim
Source
# File lib/yt/models/claim.rb, line 114 def audio? content_type == 'audio' end
@return [Boolean] whether the claim covers only the audio.
Source
# File lib/yt/models/claim.rb, line 124 def audiovisual? content_type == 'audiovisual' end
@return [Boolean] whether the claim covers both audio and video.
Source
# File lib/yt/models/claim.rb, line 37 def delete body = {status: :inactive} do_patch(body: body) {|data| @data = data} inactive? end
Soft-deletes the claim. @note YouTube API does not provide a delete
method for the Asset
resource, but only an +update+ method. Updating the +status+ of a Asset to "inactive" can be considered a soft-deletion.
@return [Boolean] whether the claim is inactive.
Source
# File lib/yt/models/claim.rb, line 77 def disputed? status == 'disputed' end
@return [Boolean] whether the claim is disputed.
Source
# File lib/yt/models/claim.rb, line 102 def has_unknown_status? status == 'unknown' end
@return [Boolean] whether the claim status is unknown.
Source
# File lib/yt/models/claim.rb, line 82 def inactive? status == 'inactive' end
@return [Boolean] whether the claim is inactive.
Source
# File lib/yt/models/claim.rb, line 87 def pending? status == 'pending' end
@return [Boolean] whether the claim is pending.
Source
# File lib/yt/models/claim.rb, line 92 def potential? status == 'potential' end
@return [Boolean] whether the claim is potential.
Source
# File lib/yt/models/claim.rb, line 129 def source @data.fetch('origin', {})['source'] end
@return [String] the source of the claim
Source
# File lib/yt/models/claim.rb, line 97 def takedown? status == 'takedown' end
@return [Boolean] whether the claim is takedown.
Source
# File lib/yt/models/claim.rb, line 22 def update(attributes = {}) underscore_keys! attributes do_patch body: attributes true end
Updates the attributes of a claim. @note If you are submitting an update request, and your request does
not specify a value for a property that already has a value, the property's existing value will be deleted.
@return [Boolean] whether the claim was successfully updated.
Source
# File lib/yt/models/claim.rb, line 119 def video? content_type == 'video' end
@return [Boolean] whether the claim covers only the video.
Private Instance Methods
Source
# File lib/yt/models/claim.rb, line 169 def patch_params super.tap do |params| params[:expected_response] = Net::HTTPOK params[:path] = "/youtube/partner/v1/claims/#{id}" params[:params] = {on_behalf_of_content_owner: @auth.owner_name} end end
@see developers.google.com/youtube/partner/docs/v1/claims/update
Yt::Actions::Patch#patch_params