Skip to content

Commit fceac8a

Browse files
authored
Add engaged_views to channels and videos (#442)
* Add more traffic source types in the list * Add engaged_views
1 parent 83ce3b8 commit fceac8a

File tree

6 files changed

+21
-1
lines changed

6 files changed

+21
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ doc/
2525
.yardoc/
2626
_site/
2727
TODO.md
28+
29+
spec/cassettes/

lib/yt/collections/reports.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ class Reports < Base
4747
playlist_page: 'YT_PLAYLIST_PAGE',
4848
campaign_card: 'CAMPAIGN_CARD',
4949
end_screen: 'END_SCREEN',
50-
info_card: 'INFO_CARD'
50+
info_card: 'INFO_CARD',
51+
hashtags: 'HASHTAGS',
52+
live_redirect: 'LIVE_REDIRECT',
53+
product_page: 'PRODUCT_PAGE',
54+
shorts: 'SHORTS',
55+
sound_page: 'SOUND_PAGE',
56+
video_remixes: 'VIDEO_REMIXES'
5157
}
5258

5359
# @see https://developers.google.com/youtube/analytics/dimensions#Playback_Location_Dimensions

lib/yt/models/channel.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ def unsubscribe!
133133
# @macro report_by_channel_dimensions
134134
has_report :views, Integer
135135

136+
# @macro report_by_channel_dimensions
137+
has_report :engaged_views, Integer
138+
136139
# @macro report_by_channel_dimensions
137140
has_report :estimated_minutes_watched, Integer
138141

lib/yt/models/video.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ def claim
421421
# @macro report_by_video_dimensions
422422
has_report :views, Integer
423423

424+
# @macro report_by_video_dimensions
425+
has_report :engaged_views, Integer
426+
424427
# @macro report_by_video_dimensions
425428
has_report :estimated_minutes_watched, Integer
426429

spec/requests/as_account/channel_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
# Some reports are only available to Content Owners.
197197
# See content owner test for more details about what the methods return.
198198
expect{channel.views}.not_to raise_error
199+
expect{channel.engaged_views}.not_to raise_error
199200
expect{channel.comments}.not_to raise_error
200201
expect{channel.likes}.not_to raise_error
201202
expect{channel.dislikes}.not_to raise_error

spec/requests/as_account/video_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,10 @@
292292
expect(video.file_type).to be_nil
293293
expect(video.container).to be_nil
294294
end
295+
296+
it 'returns valid reports for video-related metrics' do
297+
expect{video.views}.not_to raise_error
298+
expect{video.engaged_views}.not_to raise_error
299+
end
295300
end
296301
end

0 commit comments

Comments
 (0)