class Yt::Models::Reference

Provides methods to interact with YouTube ContentID references. @see developers.google.com/youtube/partner/docs/v1/references

Public Class Methods

new(options = {}) click to toggle source
# File lib/yt/models/reference.rb, line 8
def initialize(options = {})
  @data = options[:data]
  @id = options[:id]
  @auth = options[:auth]
end

Public Instance Methods

activating?() click to toggle source

@return [Boolean] whether the reference is pending.

# File lib/yt/models/reference.rb, line 91
def activating?
  status == 'activating'
end
active?() click to toggle source

@return [Boolean] whether the reference is active.

# File lib/yt/models/reference.rb, line 96
def active?
  status == 'active'
end
audio?() click to toggle source

@return [Boolean] whether the reference covers only the audio.

# File lib/yt/models/reference.rb, line 146
def audio?
  content_type == 'audio'
end
audiovisual?() click to toggle source

@return [Boolean] whether the reference covers both audio and video.

# File lib/yt/models/reference.rb, line 156
def audiovisual?
  content_type == 'audiovisual'
end
checking?() click to toggle source

@return [Boolean] whether the reference is being compared to existing

references to identify any reference conflicts that might exist.
# File lib/yt/models/reference.rb, line 102
def checking?
  status == 'checking'
end
computing_fingerprint?() click to toggle source

@return [Boolean] whether the reference’s fingerprint is being

computed.
# File lib/yt/models/reference.rb, line 108
def computing_fingerprint?
  status == 'computing_fingerprint'
end
delete() click to toggle source

Soft-deletes the reference.

@note YouTube API does not provide a delete method for the Reference

resource, but only an +update+ method. Updating the +status+ of a
Reference to "inactive" can be considered a soft-deletion, since it
allows to successively create new references for the same claim.

@return [Boolean] whether the reference is inactive.

# File lib/yt/models/reference.rb, line 21
def delete
  body = {id: id, status: :inactive}
  do_update(body: body) {|data| @data = data}
  inactive?
end
deleted?() click to toggle source

@return [Boolean] whether the reference is deleted.

# File lib/yt/models/reference.rb, line 113
def deleted?
  status == 'deleted'
end
duplicate_on_hold?() click to toggle source

@return [Boolean] whether the reference iis a duplicate and is on hold.

# File lib/yt/models/reference.rb, line 118
def duplicate_on_hold?
  status == 'duplicate_on_hold'
end
inactive?() click to toggle source

@return [Boolean] whether the reference is inactive.

# File lib/yt/models/reference.rb, line 123
def inactive?
  status == 'inactive'
end
live_streaming_processing?() click to toggle source

@return [Boolean] whether the reference is being processed from a live

video stream.
# File lib/yt/models/reference.rb, line 129
def live_streaming_processing?
  status == 'live_streaming_processing'
end
urgent_reference_processing?() click to toggle source

@return [Boolean] whether the reference is urgent_reference_processing.

# File lib/yt/models/reference.rb, line 134
def urgent_reference_processing?
  status == 'urgent_reference_processing'
end
video?() click to toggle source

@return [Boolean] whether the reference covers only the video.

# File lib/yt/models/reference.rb, line 151
def video?
  content_type == 'video'
end

Private Instance Methods

update_params() click to toggle source

@see developers.google.com/youtube/partner/docs/v1/references/update

Calls superclass method Yt::Actions::Update#update_params
# File lib/yt/models/reference.rb, line 163
def update_params
  super.tap do |params|
    params[:expected_response] = Net::HTTPOK
    params[:path] = "/youtube/partner/v1/references/#{id}"
    params[:params] = {on_behalf_of_content_owner: @auth.owner_name}
  end
end