From f34537b04de05c06172f80f612c8dfe45046dc78 Mon Sep 17 00:00:00 2001 From: Kang-Kyu Lee Date: Fri, 4 Apr 2025 15:01:58 -0700 Subject: [PATCH 1/2] Add more traffic source types in the list --- lib/yt/collections/reports.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/yt/collections/reports.rb b/lib/yt/collections/reports.rb index bb0bd720..7be86ba5 100644 --- a/lib/yt/collections/reports.rb +++ b/lib/yt/collections/reports.rb @@ -47,7 +47,13 @@ class Reports < Base playlist_page: 'YT_PLAYLIST_PAGE', campaign_card: 'CAMPAIGN_CARD', end_screen: 'END_SCREEN', - info_card: 'INFO_CARD' + info_card: 'INFO_CARD', + hashtags: 'HASHTAGS', + live_redirect: 'LIVE_REDIRECT', + product_page: 'PRODUCT_PAGE', + shorts: 'SHORTS', + sound_page: 'SOUND_PAGE', + video_remixes: 'VIDEO_REMIXES' } # @see https://developers.google.com/youtube/analytics/dimensions#Playback_Location_Dimensions From d262045af80fba05da3b98e7e8497835a98391e9 Mon Sep 17 00:00:00 2001 From: Kang-Kyu Lee Date: Tue, 20 May 2025 11:24:49 -0700 Subject: [PATCH 2/2] Add engaged_views --- .gitignore | 2 ++ lib/yt/models/channel.rb | 3 +++ lib/yt/models/video.rb | 3 +++ spec/requests/as_account/channel_spec.rb | 1 + spec/requests/as_account/video_spec.rb | 5 +++++ 5 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 7681afc0..024d41c0 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ doc/ .yardoc/ _site/ TODO.md + +spec/cassettes/ diff --git a/lib/yt/models/channel.rb b/lib/yt/models/channel.rb index af7591a2..a32acad2 100644 --- a/lib/yt/models/channel.rb +++ b/lib/yt/models/channel.rb @@ -133,6 +133,9 @@ def unsubscribe! # @macro report_by_channel_dimensions has_report :views, Integer + # @macro report_by_channel_dimensions + has_report :engaged_views, Integer + # @macro report_by_channel_dimensions has_report :estimated_minutes_watched, Integer diff --git a/lib/yt/models/video.rb b/lib/yt/models/video.rb index eff3d7be..630ef9d2 100644 --- a/lib/yt/models/video.rb +++ b/lib/yt/models/video.rb @@ -421,6 +421,9 @@ def claim # @macro report_by_video_dimensions has_report :views, Integer + # @macro report_by_video_dimensions + has_report :engaged_views, Integer + # @macro report_by_video_dimensions has_report :estimated_minutes_watched, Integer diff --git a/spec/requests/as_account/channel_spec.rb b/spec/requests/as_account/channel_spec.rb index e93fcbfd..ca580fa2 100644 --- a/spec/requests/as_account/channel_spec.rb +++ b/spec/requests/as_account/channel_spec.rb @@ -196,6 +196,7 @@ # Some reports are only available to Content Owners. # See content owner test for more details about what the methods return. expect{channel.views}.not_to raise_error + expect{channel.engaged_views}.not_to raise_error expect{channel.comments}.not_to raise_error expect{channel.likes}.not_to raise_error expect{channel.dislikes}.not_to raise_error diff --git a/spec/requests/as_account/video_spec.rb b/spec/requests/as_account/video_spec.rb index 4bc80ce9..6bbe3450 100644 --- a/spec/requests/as_account/video_spec.rb +++ b/spec/requests/as_account/video_spec.rb @@ -292,5 +292,10 @@ expect(video.file_type).to be_nil expect(video.container).to be_nil end + + it 'returns valid reports for video-related metrics' do + expect{video.views}.not_to raise_error + expect{video.engaged_views}.not_to raise_error + end end end