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



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

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

Instance Method Details

#activating?Boolean



94
95
96
# File 'lib/yt/models/reference.rb', line 94

def activating?
  status == 'activating'
end

#active?Boolean



99
100
101
# File 'lib/yt/models/reference.rb', line 99

def active?
  status == 'active'
end

#asset_idString



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

has_attribute :asset_id

#audio?Boolean



152
153
154
# File 'lib/yt/models/reference.rb', line 152

def audio?
  content_type == 'audio'
end

#audioswap_enabled?boolean



55
# File 'lib/yt/models/reference.rb', line 55

has_attribute :audioswap_enabled?, from: :audioswap_enabled

#audiovisual?Boolean



164
165
166
# File 'lib/yt/models/reference.rb', line 164

def audiovisual?
  content_type == 'audiovisual'
end

#checking?Boolean



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

def checking?
  status == 'checking'
end

#claim_idString



49
# File 'lib/yt/models/reference.rb', line 49

has_attribute :claim_id

#computing_fingerprint?Boolean



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

def computing_fingerprint?
  status == 'computing_fingerprint'
end

#content_typeString



148
# File 'lib/yt/models/reference.rb', line 148

has_attribute :content_type

#deleteBoolean

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.

Soft-deletes the reference.



21
22
23
24
25
# 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?Boolean



116
117
118
# File 'lib/yt/models/reference.rb', line 116

def deleted?
  status == 'deleted'
end

#duplicate_leaderString



80
# File 'lib/yt/models/reference.rb', line 80

has_attribute :duplicate_leader

#duplicate_on_hold?Boolean



121
122
123
# File 'lib/yt/models/reference.rb', line 121

def duplicate_on_hold?
  status == 'duplicate_on_hold'
end

#idString



29
# File 'lib/yt/models/reference.rb', line 29

has_attribute :id

#ignore_fp_match?boolean



60
# File 'lib/yt/models/reference.rb', line 60

has_attribute :ignore_fp_match?, from: :ignore_fp_match

#inactive?Boolean



126
127
128
# File 'lib/yt/models/reference.rb', line 126

def inactive?
  status == 'inactive'
end

#lengthFloat



36
# File 'lib/yt/models/reference.rb', line 36

has_attribute :length

#live_streaming_processing?Boolean



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

def live_streaming_processing?
  status == 'live_streaming_processing'
end

#statusString



91
# File 'lib/yt/models/reference.rb', line 91

has_attribute :status

#status_reasonString



75
# File 'lib/yt/models/reference.rb', line 75

has_attribute :status_reason

#urgent?Boolean



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

has_attribute :urgent?, from: :urgent

#urgent_reference_processing?Boolean



137
138
139
# File 'lib/yt/models/reference.rb', line 137

def urgent_reference_processing?
  status == 'urgent_reference_processing'
end

#video?Boolean



158
159
160
# File 'lib/yt/models/reference.rb', line 158

def video?
  content_type == 'video'
end

#video_idString



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

has_attribute :video_id