yt 0.32.5 → 0.33.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -4
- data/CHANGELOG.md +44 -0
- data/README.md +22 -33
- data/YOUTUBE_IT.md +4 -4
- data/lib/yt/actions/list.rb +1 -1
- data/lib/yt/associations/has_reports.rb +9 -14
- data/lib/yt/collections/playlist_items.rb +10 -1
- data/lib/yt/collections/reports.rb +5 -7
- data/lib/yt/models/account.rb +33 -3
- data/lib/yt/models/channel.rb +21 -5
- data/lib/yt/models/content_owner.rb +20 -0
- data/lib/yt/models/playlist.rb +12 -2
- data/lib/yt/models/playlist_item.rb +8 -1
- data/lib/yt/models/resource.rb +74 -3
- data/lib/yt/models/statistics_set.rb +2 -1
- data/lib/yt/models/status.rb +3 -1
- data/lib/yt/models/url.rb +2 -60
- data/lib/yt/models/video.rb +31 -3
- data/lib/yt/request.rb +7 -4
- data/lib/yt/version.rb +1 -1
- data/lib/yt.rb +1 -1
- data/yt.gemspec +5 -2
- metadata +32 -171
- data/spec/collections/claims_spec.rb +0 -62
- data/spec/collections/comment_threads_spec.rb +0 -46
- data/spec/collections/playlist_items_spec.rb +0 -44
- data/spec/collections/playlists_spec.rb +0 -27
- data/spec/collections/policies_spec.rb +0 -30
- data/spec/collections/references_spec.rb +0 -30
- data/spec/collections/reports_spec.rb +0 -30
- data/spec/collections/subscriptions_spec.rb +0 -25
- data/spec/collections/videos_spec.rb +0 -43
- data/spec/constants/geography_spec.rb +0 -16
- data/spec/errors/forbidden_spec.rb +0 -10
- data/spec/errors/missing_auth_spec.rb +0 -24
- data/spec/errors/no_items_spec.rb +0 -10
- data/spec/errors/request_error_spec.rb +0 -44
- data/spec/errors/server_error_spec.rb +0 -10
- data/spec/errors/unauthorized_spec.rb +0 -10
- data/spec/models/account_spec.rb +0 -138
- data/spec/models/annotation_spec.rb +0 -180
- data/spec/models/asset_spec.rb +0 -32
- data/spec/models/channel_spec.rb +0 -127
- data/spec/models/claim_event_spec.rb +0 -62
- data/spec/models/claim_history_spec.rb +0 -27
- data/spec/models/claim_spec.rb +0 -223
- data/spec/models/comment_spec.rb +0 -40
- data/spec/models/comment_thread_spec.rb +0 -93
- data/spec/models/configuration_spec.rb +0 -44
- data/spec/models/content_detail_spec.rb +0 -52
- data/spec/models/content_owner_detail_spec.rb +0 -6
- data/spec/models/file_detail_spec.rb +0 -13
- data/spec/models/live_streaming_detail_spec.rb +0 -6
- data/spec/models/ownership_spec.rb +0 -59
- data/spec/models/player_spec.rb +0 -13
- data/spec/models/playlist_item_spec.rb +0 -120
- data/spec/models/playlist_spec.rb +0 -138
- data/spec/models/policy_rule_spec.rb +0 -63
- data/spec/models/policy_spec.rb +0 -41
- data/spec/models/rating_spec.rb +0 -12
- data/spec/models/reference_spec.rb +0 -249
- data/spec/models/request_spec.rb +0 -204
- data/spec/models/resource_spec.rb +0 -42
- data/spec/models/right_owner_spec.rb +0 -71
- data/spec/models/snippet_spec.rb +0 -13
- data/spec/models/statistics_set_spec.rb +0 -13
- data/spec/models/status_spec.rb +0 -13
- data/spec/models/subscription_spec.rb +0 -30
- data/spec/models/url_spec.rb +0 -78
- data/spec/models/video_category_spec.rb +0 -21
- data/spec/models/video_spec.rb +0 -669
- data/spec/requests/as_account/account_spec.rb +0 -143
- data/spec/requests/as_account/authentications_spec.rb +0 -127
- data/spec/requests/as_account/channel_spec.rb +0 -246
- data/spec/requests/as_account/channels_spec.rb +0 -18
- data/spec/requests/as_account/playlist_item_spec.rb +0 -55
- data/spec/requests/as_account/playlist_spec.rb +0 -218
- data/spec/requests/as_account/thumbnail.jpg +0 -0
- data/spec/requests/as_account/video.mp4 +0 -0
- data/spec/requests/as_account/video_spec.rb +0 -408
- data/spec/requests/as_content_owner/account_spec.rb +0 -29
- data/spec/requests/as_content_owner/advertising_options_set_spec.rb +0 -15
- data/spec/requests/as_content_owner/asset_spec.rb +0 -31
- data/spec/requests/as_content_owner/bulk_report_job_spec.rb +0 -19
- data/spec/requests/as_content_owner/channel_spec.rb +0 -1836
- data/spec/requests/as_content_owner/claim_history_spec.rb +0 -20
- data/spec/requests/as_content_owner/claim_spec.rb +0 -17
- data/spec/requests/as_content_owner/content_owner_spec.rb +0 -370
- data/spec/requests/as_content_owner/match_policy_spec.rb +0 -17
- data/spec/requests/as_content_owner/ownership_spec.rb +0 -25
- data/spec/requests/as_content_owner/playlist_spec.rb +0 -767
- data/spec/requests/as_content_owner/video_group_spec.rb +0 -112
- data/spec/requests/as_content_owner/video_spec.rb +0 -1211
- data/spec/requests/as_server_app/channel_spec.rb +0 -54
- data/spec/requests/as_server_app/comment_spec.rb +0 -22
- data/spec/requests/as_server_app/comment_thread_spec.rb +0 -27
- data/spec/requests/as_server_app/comment_threads_spec.rb +0 -41
- data/spec/requests/as_server_app/playlist_item_spec.rb +0 -30
- data/spec/requests/as_server_app/playlist_spec.rb +0 -33
- data/spec/requests/as_server_app/url_spec.rb +0 -94
- data/spec/requests/as_server_app/video_spec.rb +0 -60
- data/spec/requests/as_server_app/videos_spec.rb +0 -40
- data/spec/requests/unauthenticated/video_spec.rb +0 -14
- data/spec/spec_helper.rb +0 -20
- data/spec/support/fail_matcher.rb +0 -15
- data/spec/support/global_hooks.rb +0 -48
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'yt/models/video_group'
|
3
|
-
require 'yt/models/group_item'
|
4
|
-
|
5
|
-
describe Yt::VideoGroup, :partner do
|
6
|
-
subject(:video_group) { Yt::VideoGroup.new id: id, auth: $content_owner }
|
7
|
-
|
8
|
-
context 'given a channel-group', :partner do
|
9
|
-
context 'managed by the authenticated Content Owner' do
|
10
|
-
let(:id) { ENV['YT_TEST_PARTNER_CHANNEL_GROUP_ID'] }
|
11
|
-
|
12
|
-
specify '.videos loads each video of each channel' do
|
13
|
-
video = video_group.videos.first
|
14
|
-
expect(video.instance_variable_defined? :@snippet).to be true
|
15
|
-
expect(video.instance_variable_defined? :@status).to be true
|
16
|
-
expect(video.instance_variable_defined? :@statistics_set).to be true
|
17
|
-
end
|
18
|
-
|
19
|
-
specify '.channels loads each channel' do
|
20
|
-
channel = video_group.channels.first
|
21
|
-
expect(channel.instance_variable_defined? :@snippet).to be true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'given a video-group', :partner do
|
27
|
-
context 'managed by the authenticated Content Owner' do
|
28
|
-
let(:id) { ENV['YT_TEST_PARTNER_VIDEO_GROUP_ID'] }
|
29
|
-
|
30
|
-
specify 'the title can be retrieved' do
|
31
|
-
expect(video_group.title).to be_a(String)
|
32
|
-
expect(video_group.title).not_to be_empty
|
33
|
-
end
|
34
|
-
|
35
|
-
specify 'the number of videos in the group can be retrieved' do
|
36
|
-
expect(video_group.item_count).to be_an(Integer)
|
37
|
-
expect(video_group.item_count).not_to be_zero
|
38
|
-
end
|
39
|
-
|
40
|
-
specify '.group_items retrieves the group items' do
|
41
|
-
expect(video_group.group_items.count).to be_an(Integer)
|
42
|
-
expect(video_group.group_items.map{|g| g}).to all(be_a Yt::GroupItem)
|
43
|
-
end
|
44
|
-
|
45
|
-
specify '.group_items.includes(:video) eager-loads each video' do
|
46
|
-
item = video_group.group_items.includes(:video).first
|
47
|
-
expect(item.video.instance_variable_defined? :@snippet).to be true
|
48
|
-
expect(item.video.instance_variable_defined? :@status).to be true
|
49
|
-
expect(item.video.instance_variable_defined? :@statistics_set).to be true
|
50
|
-
end
|
51
|
-
|
52
|
-
specify '.videos loads each video' do
|
53
|
-
video = video_group.videos.first
|
54
|
-
expect(video.instance_variable_defined? :@snippet).to be true
|
55
|
-
expect(video.instance_variable_defined? :@status).to be true
|
56
|
-
expect(video.instance_variable_defined? :@statistics_set).to be true
|
57
|
-
end
|
58
|
-
|
59
|
-
specify '.channels loads each channel' do
|
60
|
-
channel = video_group.channels.first
|
61
|
-
expect(channel.instance_variable_defined? :@snippet).to be true
|
62
|
-
end
|
63
|
-
|
64
|
-
describe 'multiple reports can be retrieved at once' do
|
65
|
-
metrics = {views: Integer,
|
66
|
-
estimated_minutes_watched: Integer, comments: Integer, likes: Integer,
|
67
|
-
dislikes: Integer, shares: Integer, subscribers_gained: Integer,
|
68
|
-
subscribers_lost: Integer,
|
69
|
-
videos_added_to_playlists: Integer, videos_removed_from_playlists: Integer,
|
70
|
-
average_view_duration: Integer,
|
71
|
-
card_impressions: Integer, card_clicks: Integer,
|
72
|
-
card_click_rate: Float, card_teaser_impressions: Integer,
|
73
|
-
card_teaser_clicks: Integer, card_teaser_click_rate: Float,
|
74
|
-
average_view_percentage: Float, annotation_clicks: Integer,
|
75
|
-
annotation_click_through_rate: Float,
|
76
|
-
annotation_close_rate: Float, estimated_revenue: Float, ad_impressions: Integer,
|
77
|
-
monetized_playbacks: Integer}
|
78
|
-
|
79
|
-
specify 'by day, and are chronologically sorted' do
|
80
|
-
range = {since: 5.days.ago.to_date, until: 3.days.ago.to_date}
|
81
|
-
result = video_group.reports range.merge(only: metrics, by: :day)
|
82
|
-
metrics.each do |metric, type|
|
83
|
-
expect(result[metric].keys).to all(be_a Date)
|
84
|
-
expect(result[metric].values).to all(be_a type)
|
85
|
-
expect(result[metric].keys.sort).to eq result[metric].keys
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# NOTE: all the other filters also apply, not tested for brevity
|
90
|
-
end
|
91
|
-
|
92
|
-
describe 'viewer_percentage can be grouped by age group' do
|
93
|
-
let(:range) { {since: 1.year.ago.to_date, until: 1.week.ago.to_date} }
|
94
|
-
let(:keys) { range.values }
|
95
|
-
|
96
|
-
specify 'with the :by option set to :age_group' do
|
97
|
-
viewer_percentage = video_group.viewer_percentage range.merge by: :age_group
|
98
|
-
expect(viewer_percentage.keys - %w(65- 35-44 45-54 13-17 25-34 55-64 18-24)).to be_empty
|
99
|
-
expect(viewer_percentage.values).to all(be_instance_of Float)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
context 'not managed by the authenticated Content Owner' do
|
105
|
-
let(:id) { 'ABExJp9gAAA' }
|
106
|
-
|
107
|
-
specify 'views cannot be retrieved' do
|
108
|
-
expect{video_group.views}.to raise_error Yt::Error
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|