yt 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/CHANGELOG.md +13 -0
- data/README.md +8 -461
- data/lib/yt/actions/base.rb +1 -0
- data/lib/yt/associations/has_attribute.rb +2 -0
- data/lib/yt/associations/has_authentication.rb +2 -0
- data/lib/yt/associations/has_many.rb +1 -0
- data/lib/yt/associations/has_one.rb +1 -0
- data/lib/yt/associations/has_reports.rb +24 -18
- data/lib/yt/collections/authentications.rb +1 -0
- data/lib/yt/collections/content_details.rb +1 -0
- data/lib/yt/collections/content_owner_details.rb +1 -0
- data/lib/yt/collections/file_details.rb +1 -0
- data/lib/yt/collections/ids.rb +1 -0
- data/lib/yt/collections/live_streaming_details.rb +1 -0
- data/lib/yt/collections/players.rb +1 -0
- data/lib/yt/collections/ratings.rb +1 -0
- data/lib/yt/collections/reports.rb +25 -16
- data/lib/yt/collections/resources.rb +1 -0
- data/lib/yt/collections/resumable_sessions.rb +1 -0
- data/lib/yt/collections/snippets.rb +1 -0
- data/lib/yt/collections/statistics_sets.rb +1 -0
- data/lib/yt/collections/statuses.rb +1 -0
- data/lib/yt/collections/subscriptions.rb +1 -0
- data/lib/yt/collections/user_infos.rb +1 -0
- data/lib/yt/models/account.rb +28 -26
- data/lib/yt/models/base.rb +1 -0
- data/lib/yt/models/channel.rb +38 -38
- data/lib/yt/models/content_detail.rb +1 -0
- data/lib/yt/models/content_owner_detail.rb +1 -0
- data/lib/yt/models/device_flow.rb +1 -0
- data/lib/yt/models/file_detail.rb +1 -0
- data/lib/yt/models/iterator.rb +1 -0
- data/lib/yt/models/live_streaming_detail.rb +1 -0
- data/lib/yt/models/player.rb +1 -0
- data/lib/yt/models/playlist.rb +19 -19
- data/lib/yt/models/playlist_item.rb +12 -12
- data/lib/yt/models/rating.rb +1 -0
- data/lib/yt/models/resource.rb +8 -2
- data/lib/yt/models/resumable_session.rb +1 -0
- data/lib/yt/models/snippet.rb +1 -0
- data/lib/yt/models/statistics_set.rb +1 -0
- data/lib/yt/models/status.rb +1 -6
- data/lib/yt/models/subscription.rb +1 -0
- data/lib/yt/models/timestamp.rb +1 -0
- data/lib/yt/models/url.rb +1 -0
- data/lib/yt/models/user_info.rb +1 -0
- data/lib/yt/models/video.rb +70 -70
- data/lib/yt/models/video_category.rb +1 -0
- data/lib/yt/request.rb +1 -0
- data/lib/yt/version.rb +1 -1
- data/spec/collections/reports_spec.rb +1 -1
- data/spec/requests/as_content_owner/channel_spec.rb +210 -14
- data/spec/requests/as_content_owner/playlist_spec.rb +68 -8
- data/spec/requests/as_content_owner/video_spec.rb +213 -16
- data/spec/requests/as_server_app/channel_spec.rb +27 -7
- data/spec/requests/as_server_app/playlist_spec.rb +25 -4
- data/spec/requests/as_server_app/video_spec.rb +26 -5
- metadata +1 -3
- data/spec/requests/as_server_app/resource_spec.rb +0 -46
data/lib/yt/models/iterator.rb
CHANGED
data/lib/yt/models/player.rb
CHANGED
data/lib/yt/models/playlist.rb
CHANGED
@@ -9,36 +9,36 @@ module Yt
|
|
9
9
|
### SNIPPET ###
|
10
10
|
|
11
11
|
# @!attribute [r] title
|
12
|
-
#
|
12
|
+
# @return [String] the playlist’s title.
|
13
13
|
delegate :title, to: :snippet
|
14
14
|
|
15
15
|
# @!attribute [r] description
|
16
|
-
#
|
16
|
+
# @return [String] the playlist’s description.
|
17
17
|
delegate :description, to: :snippet
|
18
18
|
|
19
|
-
# Returns the URL of the playlist’s thumbnail.
|
20
19
|
# @!method thumbnail_url(size = :default)
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
20
|
+
# Returns the URL of the playlist’s thumbnail.
|
21
|
+
# @param [Symbol, String] size The size of the playlist’s thumbnail.
|
22
|
+
# @return [String] if +size+ is +default+, the URL of a 120x90px image.
|
23
|
+
# @return [String] if +size+ is +medium+, the URL of a 320x180px image.
|
24
|
+
# @return [String] if +size+ is +high+, the URL of a 480x360px image.
|
25
|
+
# @return [nil] if the +size+ is not +default+, +medium+ or +high+.
|
26
26
|
delegate :thumbnail_url, to: :snippet
|
27
27
|
|
28
28
|
# @!attribute [r] published_at
|
29
|
-
#
|
29
|
+
# @return [Time] the date and time that the playlist was created.
|
30
30
|
delegate :published_at, to: :snippet
|
31
31
|
|
32
32
|
# @!attribute [r] channel_id
|
33
|
-
#
|
33
|
+
# @return [String] the ID of the channel that the playlist belongs to.
|
34
34
|
delegate :channel_id, to: :snippet
|
35
35
|
|
36
36
|
# @!attribute [r] channel_title
|
37
|
-
#
|
37
|
+
# @return [String] the title of the channel that the playlist belongs to.
|
38
38
|
delegate :channel_title, to: :snippet
|
39
39
|
|
40
40
|
# @!attribute [r] tags
|
41
|
-
#
|
41
|
+
# @return [Array<String>] the list of tags attached to the playlist.
|
42
42
|
delegate :tags, to: :snippet
|
43
43
|
|
44
44
|
### ACTIONS (UPLOAD, UPDATE, DELETE) ###
|
@@ -152,25 +152,25 @@ module Yt
|
|
152
152
|
### ANALYTICS ###
|
153
153
|
|
154
154
|
# @macro report_by_playlist_dimensions
|
155
|
-
has_report :views
|
155
|
+
has_report :views, Integer
|
156
156
|
|
157
157
|
# @macro report_by_playlist_dimensions
|
158
|
-
has_report :estimated_minutes_watched
|
158
|
+
has_report :estimated_minutes_watched, Float
|
159
159
|
|
160
160
|
# @macro report_by_gender_and_age_group
|
161
|
-
has_report :viewer_percentage
|
161
|
+
has_report :viewer_percentage, Float
|
162
162
|
|
163
163
|
# @macro report_by_day
|
164
|
-
has_report :average_view_duration
|
164
|
+
has_report :average_view_duration, Float
|
165
165
|
|
166
166
|
# @macro report_by_day
|
167
|
-
has_report :playlist_starts
|
167
|
+
has_report :playlist_starts, Integer
|
168
168
|
|
169
169
|
# @macro report_by_day
|
170
|
-
has_report :average_time_in_playlist
|
170
|
+
has_report :average_time_in_playlist, Float
|
171
171
|
|
172
172
|
# @macro report_by_day
|
173
|
-
has_report :views_per_playlist_start
|
173
|
+
has_report :views_per_playlist_start, Float
|
174
174
|
|
175
175
|
### PRIVATE API ###
|
176
176
|
|
@@ -9,36 +9,36 @@ module Yt
|
|
9
9
|
### SNIPPET ###
|
10
10
|
|
11
11
|
# @!attribute [r] title
|
12
|
-
#
|
12
|
+
# @return [String] the item’s title.
|
13
13
|
delegate :title, to: :snippet
|
14
14
|
|
15
15
|
# @!attribute [r] description
|
16
|
-
#
|
16
|
+
# @return [String] the item’s description.
|
17
17
|
delegate :description, to: :snippet
|
18
18
|
|
19
|
-
# Returns the URL of the item’s thumbnail.
|
20
19
|
# @!method thumbnail_url(size = :default)
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
20
|
+
# Returns the URL of the item’s thumbnail.
|
21
|
+
# @param [Symbol, String] size The size of the item’s thumbnail.
|
22
|
+
# @return [String] if +size+ is +default+, the URL of a 120x90px image.
|
23
|
+
# @return [String] if +size+ is +medium+, the URL of a 320x180px image.
|
24
|
+
# @return [String] if +size+ is +high+, the URL of a 480x360px image.
|
25
|
+
# @return [nil] if the +size+ is not +default+, +medium+ or +high+.
|
26
26
|
delegate :thumbnail_url, to: :snippet
|
27
27
|
|
28
28
|
# @!attribute [r] published_at
|
29
|
-
#
|
29
|
+
# @return [Time] the time that the item was added to the playlist.
|
30
30
|
delegate :published_at, to: :snippet
|
31
31
|
|
32
32
|
# @!attribute [r] channel_id
|
33
|
-
#
|
33
|
+
# @return [String] the ID of the channel that the item belongs to.
|
34
34
|
delegate :channel_id, to: :snippet
|
35
35
|
|
36
36
|
# @!attribute [r] channel_title
|
37
|
-
#
|
37
|
+
# @return [String] the title of the channel that the item belongs to.
|
38
38
|
delegate :channel_title, to: :snippet
|
39
39
|
|
40
40
|
# @!attribute [r] playlist_id
|
41
|
-
#
|
41
|
+
# @return [String] the ID of the playlist that the item is in.
|
42
42
|
delegate :playlist_id, to: :snippet
|
43
43
|
|
44
44
|
# @return [String] the ID of the video referred by the item.
|
data/lib/yt/models/rating.rb
CHANGED
@@ -2,6 +2,7 @@ require 'yt/models/base'
|
|
2
2
|
|
3
3
|
module Yt
|
4
4
|
module Models
|
5
|
+
# @private
|
5
6
|
# Provides methods to modify the rating of a video on YouTube.
|
6
7
|
# @see https://developers.google.com/youtube/v3/docs/videos/rate
|
7
8
|
# @see https://developers.google.com/youtube/v3/docs/videos/getRating
|
data/lib/yt/models/resource.rb
CHANGED
@@ -6,6 +6,7 @@ require 'yt/models/url'
|
|
6
6
|
module Yt
|
7
7
|
module Models
|
8
8
|
class Resource < Base
|
9
|
+
# @private
|
9
10
|
attr_reader :auth
|
10
11
|
|
11
12
|
### ID ###
|
@@ -18,8 +19,9 @@ module Yt
|
|
18
19
|
|
19
20
|
has_one :status
|
20
21
|
|
21
|
-
#
|
22
|
-
#
|
22
|
+
# @!attribute [r] privacy_status
|
23
|
+
# @return [String] the privacy status of the resource. Possible values
|
24
|
+
# are: +'private'+, +'public'+, +'unlisted'+.
|
23
25
|
delegate :privacy_status, to: :status
|
24
26
|
|
25
27
|
# @return [Boolean] whether the resource is public.
|
@@ -39,6 +41,7 @@ module Yt
|
|
39
41
|
|
40
42
|
has_one :snippet
|
41
43
|
|
44
|
+
# @private
|
42
45
|
def initialize(options = {})
|
43
46
|
@url = URL.new(options[:url]) if options[:url]
|
44
47
|
@id = options[:id] || (@url.id if @url)
|
@@ -47,14 +50,17 @@ module Yt
|
|
47
50
|
@status = Status.new(data: options[:status]) if options[:status]
|
48
51
|
end
|
49
52
|
|
53
|
+
# @private
|
50
54
|
def kind
|
51
55
|
@url ? @url.kind.to_s : self.class.to_s.demodulize.underscore
|
52
56
|
end
|
53
57
|
|
58
|
+
# @private
|
54
59
|
def username
|
55
60
|
@url.username if @url
|
56
61
|
end
|
57
62
|
|
63
|
+
# @private
|
58
64
|
def update(attributes = {})
|
59
65
|
underscore_keys! attributes
|
60
66
|
body = build_update_body attributes
|
data/lib/yt/models/snippet.rb
CHANGED
@@ -2,6 +2,7 @@ require 'yt/models/description'
|
|
2
2
|
|
3
3
|
module Yt
|
4
4
|
module Models
|
5
|
+
# @private
|
5
6
|
# Provides methods to interact with the snippet of YouTube resources.
|
6
7
|
# @see https://developers.google.com/youtube/v3/docs/channels#resource
|
7
8
|
# @see https://developers.google.com/youtube/v3/docs/videos#resource
|
data/lib/yt/models/status.rb
CHANGED
@@ -2,6 +2,7 @@ require 'yt/models/timestamp'
|
|
2
2
|
|
3
3
|
module Yt
|
4
4
|
module Models
|
5
|
+
# @private
|
5
6
|
# Contains information about the status of a resource. The details of the
|
6
7
|
# status are different for the different types of resources.
|
7
8
|
#
|
@@ -26,12 +27,6 @@ module Yt
|
|
26
27
|
has_attribute :embeddable
|
27
28
|
has_attribute :public_stats_viewable
|
28
29
|
has_attribute :publish_at, type: Time
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def video?
|
33
|
-
upload_status.present?
|
34
|
-
end
|
35
30
|
end
|
36
31
|
end
|
37
32
|
end
|
data/lib/yt/models/timestamp.rb
CHANGED
data/lib/yt/models/url.rb
CHANGED
data/lib/yt/models/user_info.rb
CHANGED
data/lib/yt/models/video.rb
CHANGED
@@ -9,37 +9,37 @@ module Yt
|
|
9
9
|
### SNIPPET ###
|
10
10
|
|
11
11
|
# @!attribute [r] title
|
12
|
-
#
|
12
|
+
# @return [String] the video’s title.
|
13
13
|
delegate :title, to: :snippet
|
14
14
|
|
15
15
|
# @!attribute [r] description
|
16
|
-
#
|
16
|
+
# @return [String] the video’s description.
|
17
17
|
delegate :description, to: :snippet
|
18
18
|
|
19
|
-
# Returns the URL of the video’s thumbnail.
|
20
19
|
# @!method thumbnail_url(size = :default)
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
20
|
+
# Returns the URL of the video’s thumbnail.
|
21
|
+
# @param [Symbol, String] size The size of the video’s thumbnail.
|
22
|
+
# @return [String] if +size+ is +default+, the URL of a 120x90px image.
|
23
|
+
# @return [String] if +size+ is +medium+, the URL of a 320x180px image.
|
24
|
+
# @return [String] if +size+ is +high+, the URL of a 480x360px image.
|
25
|
+
# @return [nil] if the +size+ is not +default+, +medium+ or +high+.
|
26
26
|
delegate :thumbnail_url, to: :snippet
|
27
27
|
|
28
28
|
# @!attribute [r] published_at
|
29
|
-
#
|
29
|
+
# @return [Time] the date and time that the video was published.
|
30
30
|
delegate :published_at, to: :snippet
|
31
31
|
|
32
32
|
# @!attribute [r] channel_id
|
33
|
-
#
|
33
|
+
# @return [String] the ID of the channel that the video belongs to.
|
34
34
|
delegate :channel_id, to: :snippet
|
35
35
|
|
36
36
|
# @!attribute [r] channel_title
|
37
|
-
#
|
37
|
+
# @return [String] the title of the channel that the video belongs to.
|
38
38
|
delegate :channel_title, to: :snippet
|
39
39
|
|
40
40
|
# @!attribute [r] live_broadcast_content
|
41
|
-
#
|
42
|
-
#
|
41
|
+
# @return [String] the type of live broadcast that the video contains.
|
42
|
+
# Possible values are: +'live'+, +'none'+, +'upcoming'+.
|
43
43
|
delegate :live_broadcast_content, to: :snippet
|
44
44
|
|
45
45
|
# @return [Array<String>] the list of tags attached to the video.
|
@@ -187,8 +187,8 @@ module Yt
|
|
187
187
|
end
|
188
188
|
|
189
189
|
# @!attribute [r] license
|
190
|
-
#
|
191
|
-
#
|
190
|
+
# @return [String] the video’s license. Possible values are:
|
191
|
+
# +'creativeCommon'+, +'youtube'+.
|
192
192
|
delegate :license, to: :status
|
193
193
|
|
194
194
|
# @return [Boolean] whether the video uses the Standard YouTube license.
|
@@ -223,7 +223,7 @@ module Yt
|
|
223
223
|
has_one :content_detail
|
224
224
|
|
225
225
|
# @!attribute [r] duration
|
226
|
-
#
|
226
|
+
# @return [Integer] the duration of the video (in seconds).
|
227
227
|
delegate :duration, to: :content_detail
|
228
228
|
|
229
229
|
# @return [Boolean] whether the video is available in 3D.
|
@@ -252,16 +252,16 @@ module Yt
|
|
252
252
|
has_one :file_detail
|
253
253
|
|
254
254
|
# @!attribute [r] file_size
|
255
|
-
#
|
255
|
+
# @return [Integer] the size of the uploaded file (in bytes).
|
256
256
|
delegate :file_size, to: :file_detail
|
257
257
|
|
258
258
|
# @!attribute [r] file_type
|
259
|
-
#
|
260
|
-
#
|
259
|
+
# @return [String] the type of file uploaded. May be one of:
|
260
|
+
# archive, audio, document, image, other, project, video.
|
261
261
|
delegate :file_type, to: :file_detail
|
262
262
|
|
263
263
|
# @!attribute [r] container
|
264
|
-
#
|
264
|
+
# @return [String] the video container of the uploaded file. (e.g. 'mov').
|
265
265
|
delegate :container, to: :file_detail
|
266
266
|
|
267
267
|
|
@@ -317,49 +317,49 @@ module Yt
|
|
317
317
|
has_one :advertising_options_set
|
318
318
|
|
319
319
|
# @!attribute [r] ad_formats
|
320
|
-
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
#
|
320
|
+
# @return [Array<String>] the list of ad formats that the video is
|
321
|
+
# allowed to show. Possible values are: +'long'+, +'overlay'+,
|
322
|
+
# +'standard_instream'+, +'third_party'+, +'trueview_inslate'+,
|
323
|
+
# +'trueview_instream'+.
|
324
324
|
delegate :ad_formats, to: :advertising_options_set
|
325
325
|
|
326
326
|
### LIVE STREAMING DETAILS ###
|
327
327
|
|
328
328
|
has_one :live_streaming_detail
|
329
329
|
|
330
|
-
# The time when a live broadcast started.
|
331
330
|
# @!attribute [r] actual_start_time
|
332
|
-
#
|
333
|
-
#
|
331
|
+
# The time when a live broadcast started.
|
332
|
+
# @return [Time] if the broadcast has begun, the time it actually started.
|
333
|
+
# @return [nil] if the broadcast has not begun or video is not live.
|
334
334
|
delegate :actual_start_time, to: :live_streaming_detail
|
335
335
|
|
336
|
-
# The time when a live broadcast ended.
|
337
336
|
# @!attribute [r] actual_end_time
|
338
|
-
#
|
339
|
-
#
|
337
|
+
# The time when a live broadcast ended.
|
338
|
+
# @return [Time] if the broadcast is over, the time it actually ended.
|
339
|
+
# @return [nil] if the broadcast is not over or video is not live.
|
340
340
|
delegate :actual_end_time, to: :live_streaming_detail
|
341
341
|
|
342
|
-
# The time when a live broadcast is scheduled to start.
|
343
342
|
# @!attribute [r] scheduled_start_time
|
344
|
-
#
|
345
|
-
#
|
343
|
+
# The time when a live broadcast is scheduled to start.
|
344
|
+
# @return [Time] the time that the broadcast is scheduled to begin.
|
345
|
+
# @return [nil] if video is not live.
|
346
346
|
delegate :scheduled_start_time, to: :live_streaming_detail
|
347
347
|
|
348
|
-
# The time when a live broadcast is scheduled to end.
|
349
348
|
# @!attribute [r] scheduled_end_time
|
350
|
-
#
|
351
|
-
# scheduled to end
|
352
|
-
#
|
353
|
-
#
|
349
|
+
# The time when a live broadcast is scheduled to end.
|
350
|
+
# @return [Time] if the broadcast is scheduled to end, the time it is
|
351
|
+
# scheduled to end.
|
352
|
+
# @return [nil] if the broadcast is scheduled to continue indefinitely
|
353
|
+
# or the video is not live.
|
354
354
|
delegate :scheduled_end_time, to: :live_streaming_detail
|
355
355
|
|
356
|
-
# The number of current viewers of a live broadcast.
|
357
356
|
# @!attribute [r] concurrent_viewers
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
#
|
357
|
+
# The number of current viewers of a live broadcast.
|
358
|
+
# @return [Integer] if the broadcast has current viewers and the
|
359
|
+
# broadcast owner has not hidden the viewcount for the video, the
|
360
|
+
# number of viewers currently watching the broadcast.
|
361
|
+
# @return [nil] if the broadcast has ended or the broadcast owner has
|
362
|
+
# hidden the viewcount for the video or the video is not live.
|
363
363
|
delegate :concurrent_viewers, to: :live_streaming_detail
|
364
364
|
|
365
365
|
### ASSOCIATIONS ###
|
@@ -373,88 +373,88 @@ module Yt
|
|
373
373
|
### ANALYTICS ###
|
374
374
|
|
375
375
|
# @macro report_by_video_dimensions
|
376
|
-
has_report :views
|
376
|
+
has_report :views, Integer
|
377
377
|
|
378
378
|
# @macro report_by_video_dimensions
|
379
|
-
has_report :estimated_minutes_watched
|
379
|
+
has_report :estimated_minutes_watched, Float
|
380
380
|
|
381
381
|
# @macro report_by_gender_and_age_group
|
382
|
-
has_report :viewer_percentage
|
382
|
+
has_report :viewer_percentage, Float
|
383
383
|
|
384
384
|
# @macro report_by_day
|
385
|
-
has_report :comments
|
385
|
+
has_report :comments, Integer
|
386
386
|
|
387
387
|
# @macro report_by_day
|
388
|
-
has_report :likes
|
388
|
+
has_report :likes, Integer
|
389
389
|
|
390
390
|
# @macro report_by_day
|
391
|
-
has_report :dislikes
|
391
|
+
has_report :dislikes, Integer
|
392
392
|
|
393
393
|
# @macro report_by_day
|
394
|
-
has_report :shares
|
394
|
+
has_report :shares, Integer
|
395
395
|
|
396
396
|
# @note This is not the total number of subscribers gained by the video’s
|
397
397
|
# channel, but the subscribers gained *from* the video’s page.
|
398
398
|
# @macro report_by_day
|
399
|
-
has_report :subscribers_gained
|
399
|
+
has_report :subscribers_gained, Integer
|
400
400
|
|
401
401
|
# @note This is not the total number of subscribers lost by the video’s
|
402
402
|
# channel, but the subscribers lost *from* the video’s page.
|
403
403
|
# @macro report_by_day
|
404
|
-
has_report :subscribers_lost
|
404
|
+
has_report :subscribers_lost, Integer
|
405
405
|
|
406
406
|
# @macro report_by_day
|
407
|
-
has_report :favorites_added
|
407
|
+
has_report :favorites_added, Integer
|
408
408
|
|
409
409
|
# @macro report_by_day
|
410
|
-
has_report :favorites_removed
|
410
|
+
has_report :favorites_removed, Integer
|
411
411
|
|
412
412
|
# @macro report_by_day
|
413
|
-
has_report :average_view_duration
|
413
|
+
has_report :average_view_duration, Float
|
414
414
|
|
415
415
|
# @macro report_by_day
|
416
|
-
has_report :average_view_percentage
|
416
|
+
has_report :average_view_percentage, Float
|
417
417
|
|
418
418
|
# @macro report_by_day
|
419
|
-
has_report :annotation_clicks
|
419
|
+
has_report :annotation_clicks, Integer
|
420
420
|
|
421
421
|
# @macro report_by_day
|
422
|
-
has_report :annotation_click_through_rate
|
422
|
+
has_report :annotation_click_through_rate, Float
|
423
423
|
|
424
424
|
# @macro report_by_day
|
425
|
-
has_report :annotation_close_rate
|
425
|
+
has_report :annotation_close_rate, Float
|
426
426
|
|
427
427
|
# @macro report_by_day
|
428
|
-
has_report :earnings
|
428
|
+
has_report :earnings, Float
|
429
429
|
|
430
430
|
# @macro report_by_day
|
431
|
-
has_report :impressions
|
431
|
+
has_report :impressions, Integer
|
432
432
|
|
433
433
|
# @macro report_by_day
|
434
|
-
has_report :monetized_playbacks
|
434
|
+
has_report :monetized_playbacks, Integer
|
435
435
|
|
436
436
|
### STATISTICS ###
|
437
437
|
|
438
438
|
has_one :statistics_set
|
439
439
|
|
440
440
|
# @!attribute [r] view_count
|
441
|
-
#
|
441
|
+
# @return [Integer] the number of times the video has been viewed.
|
442
442
|
delegate :view_count, to: :statistics_set
|
443
443
|
|
444
444
|
# @!attribute [r] like_count
|
445
|
-
#
|
445
|
+
# @return [Integer] the number of users who liked the video.
|
446
446
|
delegate :like_count, to: :statistics_set
|
447
447
|
|
448
448
|
# @!attribute [r] dislike_count
|
449
|
-
#
|
449
|
+
# @return [Integer] the number of users who disliked the video.
|
450
450
|
delegate :dislike_count, to: :statistics_set
|
451
451
|
|
452
452
|
# @!attribute [r] favorite_count
|
453
|
-
#
|
453
|
+
# @return [Integer] the number of users who marked the video as favorite.
|
454
454
|
delegate :favorite_count, to: :statistics_set
|
455
455
|
|
456
456
|
# @!attribute [r] comment_count
|
457
|
-
#
|
457
|
+
# @return [Integer] the number of comments for the video.
|
458
458
|
delegate :comment_count, to: :statistics_set
|
459
459
|
|
460
460
|
### PLAYER ###
|
@@ -462,8 +462,8 @@ module Yt
|
|
462
462
|
has_one :player
|
463
463
|
|
464
464
|
# @!attribute [r] embed_html
|
465
|
-
#
|
466
|
-
#
|
465
|
+
# @return [String] the HTML code of an <iframe> tag that embeds a
|
466
|
+
# player that will play the video.
|
467
467
|
delegate :embed_html, to: :player
|
468
468
|
|
469
469
|
### ACTIONS (UPLOAD, UPDATE, DELETE) ###
|
data/lib/yt/request.rb
CHANGED
@@ -11,6 +11,7 @@ require 'yt/errors/server_error'
|
|
11
11
|
require 'yt/errors/unauthorized'
|
12
12
|
|
13
13
|
module Yt
|
14
|
+
# @private
|
14
15
|
# A wrapper around Net::HTTP to send HTTP requests to any web API and
|
15
16
|
# return their result or raise an error if the result is unexpected.
|
16
17
|
# The basic way to use Request is by calling +run+ on an instance.
|
data/lib/yt/version.rb
CHANGED
@@ -9,7 +9,7 @@ describe Yt::Collections::Reports do
|
|
9
9
|
let(:msg) { {response_body: {error: {errors: [error]}}}.to_json }
|
10
10
|
|
11
11
|
describe '#within' do
|
12
|
-
let(:result) { reports.within Range.new(5.days.ago, 4.days.ago), :day }
|
12
|
+
let(:result) { reports.within Range.new(5.days.ago, 4.days.ago), :day, Float }
|
13
13
|
context 'given the request raises error 400 with "Invalid Query" message' do
|
14
14
|
let(:reason) { 'badRequest' }
|
15
15
|
let(:message) { 'Invalid query. Query did not conform to the expectations' }
|