Class: Yt::Models::Reference

Inherits:
Base
  • Object
show all
Defined in:
lib/yt/models/reference.rb

Overview

Provides methods to interact with YouTube ContentID references.

Constant Summary collapse

STATUSES =

Status

%q(activating active checking computing_fingerprint deleted
duplicate_on_hold inactive live_streaming_processing
urgent_reference_processing)
CONTENT_TYPES =

Content Type

%q(audio video audiovisual)

Instance Method Summary collapse

Methods included from Associations::HasReports

#has_report

Methods included from Associations::HasViewerPercentages

#has_viewer_percentages

Methods included from Associations::HasOne

#has_one

Methods included from Associations::HasMany

#has_many

Methods included from Associations::HasAuthentication

#has_authentication

Constructor Details

#initialize(options = {}) ⇒ Reference

Returns a new instance of Reference.



8
9
10
# File 'lib/yt/models/reference.rb', line 8

def initialize(options = {})
  @data = options[:data]
end

Instance Method Details

#activating?Boolean

Returns whether the reference is pending.

Returns:

  • (Boolean)

    whether the reference is pending.



101
102
103
# File 'lib/yt/models/reference.rb', line 101

def activating?
  status == 'activating'
end

#active?Boolean

Returns whether the reference is active.

Returns:

  • (Boolean)

    whether the reference is active.



106
107
108
# File 'lib/yt/models/reference.rb', line 106

def active?
  status == 'active'
end

#asset_idString

Returns the ID that uniquely identifies the asset that the reference is associated with.

Returns:

  • (String)

    the ID that uniquely identifies the asset that the reference is associated with.



20
21
22
# File 'lib/yt/models/reference.rb', line 20

def asset_id
  @asset_id ||= @data["assetId"]
end

#audio?Boolean

Returns whether the reference covers the audio of the content.

Returns:

  • (Boolean)

    whether the reference covers the audio of the content.



161
162
163
# File 'lib/yt/models/reference.rb', line 161

def audio?
  content_type == 'audio'
end

#audioswap_enabled?boolean

Returns whether or not the reference content is included in YouTube’s AudioSwap program. Set this field’s value to true to indicate that the reference content should be included in YouTube’s AudioSwap program.

Returns:

  • (boolean)

    whether or not the reference content is included in YouTube’s AudioSwap program. Set this field’s value to true to indicate that the reference content should be included in YouTube’s AudioSwap program.



50
51
52
# File 'lib/yt/models/reference.rb', line 50

def audioswap_enabled?
  @audioswap_enabled ||= @data["audioswapEnabled"]
end

#audiovisual?Boolean

Returns whether the reference covers the audiovisual of the content.

Returns:

  • (Boolean)

    whether the reference covers the audiovisual of the content.



173
174
175
# File 'lib/yt/models/reference.rb', line 173

def audiovisual?
  content_type == 'audiovisual'
end

#checking?Boolean

Returns whether the reference is being compared to existing references to identify any reference conflicts that might exist.

Returns:

  • (Boolean)

    whether the reference is being compared to existing references to identify any reference conflicts that might exist.



112
113
114
# File 'lib/yt/models/reference.rb', line 112

def checking?
  status == 'checking'
end

#claim_idString

Returns the claim ID that represents the resulting association between the asset and the video. This field is only present if the reference was created by associating an asset with an existing YouTube video that was uploaded to a YouTube channel linked to your CMS account.

Returns:

  • (String)

    the claim ID that represents the resulting association between the asset and the video. This field is only present if the reference was created by associating an asset with an existing YouTube video that was uploaded to a YouTube channel linked to your CMS account.



42
43
44
# File 'lib/yt/models/reference.rb', line 42

def claim_id
  @claim_id ||= @data["claimId"]
end

#computing_fingerprint?Boolean

Returns whether the reference’s fingerprint is being computed.

Returns:

  • (Boolean)

    whether the reference’s fingerprint is being computed.



118
119
120
# File 'lib/yt/models/reference.rb', line 118

def computing_fingerprint?
  status == 'computing_fingerprint'
end

#content_typeString

Returns whether the reference covers the audio, video, or audiovisual portion of the claimed content. Valid values are: audio, audiovisual, video.

Returns:

  • (String)

    whether the reference covers the audio, video, or audiovisual portion of the claimed content. Valid values are: audio, audiovisual, video.



155
156
157
# File 'lib/yt/models/reference.rb', line 155

def content_type
  @content_type ||= @data["contentType"]
end

#deleted?Boolean

Returns whether the reference is deleted.

Returns:

  • (Boolean)

    whether the reference is deleted.



123
124
125
# File 'lib/yt/models/reference.rb', line 123

def deleted?
  status == 'deleted'
end

#duplicate_leaderString

Returns The ID that uniquely identifies the reference that this reference duplicates. This field is only present if the reference’s status is duplicate_on_hold.

Returns:

  • (String)

    The ID that uniquely identifies the reference that this reference duplicates. This field is only present if the reference’s status is duplicate_on_hold.



83
84
85
# File 'lib/yt/models/reference.rb', line 83

def duplicate_leader
  @duplicate_leader ||= @data["duplicateLeader"]
end

#duplicate_on_hold?Boolean

Returns whether the reference iis a duplicate and is on hold.

Returns:

  • (Boolean)

    whether the reference iis a duplicate and is on hold.



128
129
130
# File 'lib/yt/models/reference.rb', line 128

def duplicate_on_hold?
  status == 'duplicate_on_hold'
end

#idString

Returns the ID that YouTube assigns and uses to uniquely identify the reference.

Returns:

  • (String)

    the ID that YouTube assigns and uses to uniquely identify the reference.



14
15
16
# File 'lib/yt/models/reference.rb', line 14

def id
  @id ||= @data['id']
end

#ignore_fp_match?boolean

Returns should the reference be used to generate claims. Set this value to true to indicate that the reference should not be used to generate claims. This field is only used on AudioSwap references.

Returns:

  • (boolean)

    should the reference be used to generate claims. Set this value to true to indicate that the reference should not be used to generate claims. This field is only used on AudioSwap references.



57
58
59
# File 'lib/yt/models/reference.rb', line 57

def ignore_fp_match?
  @ignore_fp_match ||= @data["ignoreFpMatch"]
end

#inactive?Boolean

Returns whether the reference is inactive.

Returns:

  • (Boolean)

    whether the reference is inactive.



133
134
135
# File 'lib/yt/models/reference.rb', line 133

def inactive?
  status == 'inactive'
end

#lengthFloat

Returns The length of the reference in seconds.

Returns:

  • (Float)

    The length of the reference in seconds



25
26
27
# File 'lib/yt/models/reference.rb', line 25

def length
  @length ||= @data["length"]
end

#live_streaming_processing?Boolean

Returns whether the reference is being processed from a live video stream.

Returns:

  • (Boolean)

    whether the reference is being processed from a live video stream.



139
140
141
# File 'lib/yt/models/reference.rb', line 139

def live_streaming_processing?
  status == 'live_streaming_processing'
end

#statusString

Returns the reference’s status. Valid values are: activating, active, checking, computing_fingerprint, deleted, duplicate_on_hold, inactive, live_streaming_processing, and urgent_reference_processing.

Returns:

  • (String)

    the reference’s status. Valid values are: activating, active, checking, computing_fingerprint, deleted, duplicate_on_hold, inactive, live_streaming_processing, and urgent_reference_processing.



96
97
98
# File 'lib/yt/models/reference.rb', line 96

def status
  @status ||= @data["status"]
end

#status_reasonString

Returns An explanation of how a reference entered its current state. This value is only present if the reference’s status is either inactive or deleted.

Returns:

  • (String)

    An explanation of how a reference entered its current state. This value is only present if the reference’s status is either inactive or deleted.



76
77
78
# File 'lib/yt/models/reference.rb', line 76

def status_reason
  @status_reason ||= @data["statusReason"]
end

#urgent?Boolean

Returns the urgent status of the reference file. Set this value to true to indicate that YouTube should prioritize Content ID processing for a video file. YouTube processes urgent video files before other files that are not marked as urgent. This setting is primarily used for videos of live events or other videos that require time-sensitive processing. The sooner YouTube completes Content ID processing for a video, the sooner YouTube can match user-uploaded videos to that video.

Returns:

  • (Boolean)

    the urgent status of the reference file. Set this value to true to indicate that YouTube should prioritize Content ID processing for a video file. YouTube processes urgent video files before other files that are not marked as urgent. This setting is primarily used for videos of live events or other videos that require time-sensitive processing. The sooner YouTube completes Content ID processing for a video, the sooner YouTube can match user-uploaded videos to that video.



69
70
71
# File 'lib/yt/models/reference.rb', line 69

def urgent?
  @urgent ||= @data["urgent"]
end

#urgent_reference_processing?Boolean

Returns whether the reference is urgent_reference_processing.

Returns:

  • (Boolean)

    whether the reference is urgent_reference_processing.



144
145
146
# File 'lib/yt/models/reference.rb', line 144

def urgent_reference_processing?
  status == 'urgent_reference_processing'
end

#video?Boolean

Returns whether the reference covers the video of the content.

Returns:

  • (Boolean)

    whether the reference covers the video of the content.



167
168
169
# File 'lib/yt/models/reference.rb', line 167

def video?
  content_type == 'video'
end

#video_idString

Returns the ID of the source video. This field is only present if the reference was created by associating an asset with an existing YouTube video that was uploaded to a YouTube channel linked to your CMS account.

Returns:

  • (String)

    the ID of the source video. This field is only present if the reference was created by associating an asset with an existing YouTube video that was uploaded to a YouTube channel linked to your CMS account.



33
34
35
# File 'lib/yt/models/reference.rb', line 33

def video_id
  @video_id ||= @data["videoId"]
end