Class: Yt::Models::Status

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

Overview

Contains information about the status of a resource. The details of the status are different for the different types of resources.

Resources with a status are: channels, playlists, playlist items and videos.

Constant Summary collapse

PRIVACY_STATUSES =

Privacy status

%q(private public unlisted)

Instance Attribute Summary collapse

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



17
18
19
# File 'lib/yt/models/status.rb', line 17

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

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



15
16
17
# File 'lib/yt/models/status.rb', line 15

def data
  @data
end

Instance Method Details

#aborted?Boolean?

Returns whether a video upload failed because the upload was aborted.



150
151
152
# File 'lib/yt/models/status.rb', line 150

def aborted?
  failure_reason == 'uploadAborted' if video?
end

#belongs_to_closed_account?Boolean?

Returns whether a video was rejected because the account was closed.



226
227
228
# File 'lib/yt/models/status.rb', line 226

def belongs_to_closed_account?
  rejection_reason == 'uploaderAccountClosed' if video?
end

#belongs_to_suspended_account?Boolean?

Returns whether a video was rejected because the account was suspended.



234
235
236
# File 'lib/yt/models/status.rb', line 234

def belongs_to_suspended_account?
  rejection_reason == 'uploaderAccountSuspended' if video?
end

#claimed?Boolean?

Returns whether a video was rejected because it was claimed.



168
169
170
# File 'lib/yt/models/status.rb', line 168

def claimed?
  rejection_reason == 'claim' if video?
end

#deleted?Boolean?

Returns whether an uploaded video was deleted.



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

def deleted?
  upload_status == 'deleted' if video?
end

#duplicate?Boolean?

Returns whether a video was rejected because it is a duplicate.



184
185
186
# File 'lib/yt/models/status.rb', line 184

def duplicate?
  rejection_reason == 'duplicate' if video?
end

#embeddableObject

Deprecated.

Use #embeddable? instead.



292
293
294
# File 'lib/yt/models/status.rb', line 292

def embeddable
  embeddable?
end

#embeddable?Boolean?

Returns whether the video can be embedded on another website.



289
# File 'lib/yt/models/status.rb', line 289

has_attribute :embeddable?, from: :embeddable

#empty?Boolean?

Returns whether a video upload failed because the file was empty.



125
126
127
# File 'lib/yt/models/status.rb', line 125

def empty?
  failure_reason == 'emptyFile' if video?
end

#failed?Boolean?

Returns whether a video failed to upload. If true, the reason why the video upload failed can be obtained with failure_reason.



66
67
68
# File 'lib/yt/models/status.rb', line 66

def failed?
  upload_status == 'failed' if video?
end

#failure_reasonString?

Returns the reason why a video failed to upload.



102
# File 'lib/yt/models/status.rb', line 102

has_attribute :failure_reason

#has_failed_conversion?Boolean?

Returns whether YouTube was unable to convert an uploaded video.



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

def has_failed_conversion?
  failure_reason == 'conversion' if video?
end

#has_public_stats_viewable?Boolean?

Returns whether the video statistics are publicly viewable.



305
# File 'lib/yt/models/status.rb', line 305

has_attribute :has_public_stats_viewable?, from: :public_stats_viewable

#inappropriate?Boolean?

Returns whether a video was rejected because of inappropriate content.



192
193
194
# File 'lib/yt/models/status.rb', line 192

def inappropriate?
  rejection_reason == 'inappropriate' if video?
end

#infringes_copyright?Boolean?

Returns whether a video was rejected because of copyright infringement.



176
177
178
# File 'lib/yt/models/status.rb', line 176

def infringes_copyright?
  rejection_reason == 'copyright' if video?
end

#infringes_trademark?Boolean?

Returns whether a video was rejected because of trademark infringement.



218
219
220
# File 'lib/yt/models/status.rb', line 218

def infringes_trademark?
  rejection_reason == 'trademark' if video?
end

#invalid?Boolean?

Returns whether a video upload failed because of the file format.



134
135
136
# File 'lib/yt/models/status.rb', line 134

def invalid?
  failure_reason == 'invalidFile' if video?
end

#licenseString?

Returns the video’s license.



263
# File 'lib/yt/models/status.rb', line 263

has_attribute :license

#licensed_as_creative_commons?Boolean?

Returns whether the video uses a Creative Commons license.



270
271
272
# File 'lib/yt/models/status.rb', line 270

def licensed_as_creative_commons?
  license == 'creativeCommon' if video?
end

#licensed_as_standard_youtube?Boolean?

Returns whether the video uses the Standard YouTube license.



279
280
281
# File 'lib/yt/models/status.rb', line 279

def licensed_as_standard_youtube?
  license == 'youtube' if video?
end

#privacy_statusString



27
# File 'lib/yt/models/status.rb', line 27

has_attribute :privacy_status

#private?Boolean



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

def private?
  privacy_status == 'private'
end

#processed?Boolean?

Returns whether an uploaded video is being processed by YouTube.



74
75
76
# File 'lib/yt/models/status.rb', line 74

def processed?
  upload_status == 'processed' if video?
end

#public?Boolean



30
31
32
# File 'lib/yt/models/status.rb', line 30

def public?
  privacy_status == 'public'
end

#public_stats_viewableObject

Deprecated.


308
309
310
# File 'lib/yt/models/status.rb', line 308

def public_stats_viewable
  has_public_stats_viewable?
end

#rejected?Boolean?

Returns whether the video was rejected by YouTube. If true, the reason why the video was rejected can be obtained with rejection_reason.



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

def rejected?
  upload_status == 'rejected' if video?
end

#rejection_reasonString?

Returns the reason why a video was rejected by YouTube.



162
# File 'lib/yt/models/status.rb', line 162

has_attribute :rejection_reason

#scheduled?Boolean?

Returns whether the video is scheduled to be published.



253
254
255
# File 'lib/yt/models/status.rb', line 253

def scheduled?
  private? && publish_at if video?
end

#scheduled_atTime?

Returns the date and time when a video is scheduled to be published.



245
246
247
# File 'lib/yt/models/status.rb', line 245

def scheduled_at
  publish_at if scheduled?
end

#too_long?Boolean?

Returns whether a video was rejected because it is too long.



201
202
203
# File 'lib/yt/models/status.rb', line 201

def too_long?
  rejection_reason == 'length' if video?
end

#too_small?Boolean?

Returns whether a video upload failed because the file was too small.



142
143
144
# File 'lib/yt/models/status.rb', line 142

def too_small?
  failure_reason == 'tooSmall' if video?
end

#unlisted?Boolean



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

def unlisted?
  privacy_status == 'unlisted'
end

#upload_statusString?

Returns the upload status of a video.



51
# File 'lib/yt/models/status.rb', line 51

has_attribute :upload_status

#uploaded?Boolean?

Returns whether a video was successfully uploaded to YouTube.



91
92
93
# File 'lib/yt/models/status.rb', line 91

def uploaded?
  upload_status == 'uploaded' if video?
end

#uses_unsupported_codec?Boolean?

Returns whether a video upload failed because of the codec.



109
110
111
# File 'lib/yt/models/status.rb', line 109

def uses_unsupported_codec?
  failure_reason == 'codec' if video?
end

#violates_terms_of_use?Boolean?

Returns whether a video was rejected because it violates terms of use.



209
210
211
# File 'lib/yt/models/status.rb', line 209

def violates_terms_of_use?
  rejection_reason == 'termsOfUse' if video?
end