Class: Yt::Models::Claim

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

Overview

Provides methods to interact with YouTube ContentID claims.

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 = {}) ⇒ Claim

Returns a new instance of Claim.



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

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

Instance Method Details

#active?Boolean

Returns whether the claim is active.

Returns:

  • (Boolean)

    whether the claim is active.



40
41
42
# File 'lib/yt/models/claim.rb', line 40

def active?
  status == 'active'
end

#appealed?Boolean

Returns whether the claim is appealed.

Returns:

  • (Boolean)

    whether the claim is appealed.



45
46
47
# File 'lib/yt/models/claim.rb', line 45

def appealed?
  status == 'appealed'
end

#asset_idString

Returns the unique YouTube asset ID that identifies the asset associated with the claim.

Returns:

  • (String)

    the unique YouTube asset ID that identifies the asset associated with the claim.



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

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

#audio?Boolean

Returns whether the covers the audio of the content.

Returns:

  • (Boolean)

    whether the covers the audio of the content.



87
88
89
# File 'lib/yt/models/claim.rb', line 87

def audio?
  content_type == 'audio'
end

#audiovisual?Boolean

Returns whether the covers the audiovisual of the content.

Returns:

  • (Boolean)

    whether the covers the audiovisual of the content.



97
98
99
# File 'lib/yt/models/claim.rb', line 97

def audiovisual?
  content_type == 'audiovisual'
end

#block_outside_ownership?Boolean

Return whether the video should be blocked where not explicitly owned.

Returns:

  • (Boolean)

    whether the claimed video should be blocked anywhere it is not explicitly owned. For example, if you upload a video for an asset that you own in the United States and Canada, and you claim the video with a usage policy to monetize the video everywhere. Since the policy is only applied in countries where you own the asset, YouTube will actually monetize the video in the United States and Canada. By default, the video will still be viewable in other countries even though it will not be monetized in those countries. However, if you set this property to true, then the video will be monetized in the United States and Canada and blocked in all other countries.



117
118
119
# File 'lib/yt/models/claim.rb', line 117

def block_outside_ownership?
  @block_outside_ownership ||= @data["blockOutsideOwnership"]
end

#content_typeString

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

Returns:

  • (String)

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



82
83
84
# File 'lib/yt/models/claim.rb', line 82

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

#created_atTime

Returns the date and time that the claim was created.

Returns:

  • (Time)

    the date and time that the claim was created.



102
103
104
# File 'lib/yt/models/claim.rb', line 102

def created_at
  @created_at ||= Time.parse @data["timeCreated"]
end

#disputed?Boolean

Returns whether the claim is disputed.

Returns:

  • (Boolean)

    whether the claim is disputed.



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

def disputed?
  status == 'disputed'
end

#has_unknown_status?Boolean

Returns whether the claim status is unknown.

Returns:

  • (Boolean)

    whether the claim status is unknown.



75
76
77
# File 'lib/yt/models/claim.rb', line 75

def has_unknown_status?
  status == 'unknown'
end

#idString

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

Returns:

  • (String)

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



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

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

#inactive?Boolean

Returns whether the claim is inactive.

Returns:

  • (Boolean)

    whether the claim is inactive.



55
56
57
# File 'lib/yt/models/claim.rb', line 55

def inactive?
  status == 'inactive'
end

#pending?Boolean

Returns whether the claim is pending.

Returns:

  • (Boolean)

    whether the claim is pending.



60
61
62
# File 'lib/yt/models/claim.rb', line 60

def pending?
  status == 'pending'
end

#potential?Boolean

Returns whether the claim is potential.

Returns:

  • (Boolean)

    whether the claim is potential.



65
66
67
# File 'lib/yt/models/claim.rb', line 65

def potential?
  status == 'potential'
end

#statusString

Note:

When updating a claim, you can update its status from active to inactive to effectively release the claim, but the API does not support other updates to a claim’s status.

Returns the claim’s status. Valid values are: active, appealed, disputed, inactive, pending, potential, takedown, unknown.

Returns:

  • (String)

    the claim’s status. Valid values are: active, appealed, disputed, inactive, pending, potential, takedown, unknown.



35
36
37
# File 'lib/yt/models/claim.rb', line 35

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

#takedown?Boolean

Returns whether the claim is takedown.

Returns:

  • (Boolean)

    whether the claim is takedown.



70
71
72
# File 'lib/yt/models/claim.rb', line 70

def takedown?
  status == 'takedown'
end

#video?Boolean

Returns whether the covers the video of the content.

Returns:

  • (Boolean)

    whether the covers the video of the content.



92
93
94
# File 'lib/yt/models/claim.rb', line 92

def video?
  content_type == 'video'
end

#video_idString

Returns the unique YouTube video ID that identifies the video associated with the claim.

Returns:

  • (String)

    the unique YouTube video ID that identifies the video associated with the claim.



26
27
28
# File 'lib/yt/models/claim.rb', line 26

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