yt 0.23.2 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/yt/associations/has_reports.rb +6 -1
- data/lib/yt/collections/reports.rb +4 -2
- data/lib/yt/models/channel.rb +2 -2
- data/lib/yt/models/playlist.rb +2 -2
- data/lib/yt/models/video.rb +2 -2
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_content_owner/channel_spec.rb +26 -8
- data/spec/requests/as_content_owner/playlist_spec.rb +28 -9
- data/spec/requests/as_content_owner/video_spec.rb +27 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8721162ba728a25aa9a61c6d2ba3072fb3facad
|
4
|
+
data.tar.gz: 425cfa108f9ac55f82794e8d54c701713af6e7ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774ce5a0883ffa386db4329ede3e5e078bd1bfcd2b248791ee738c0b5a33404db56f60868a29214d473ab96a2129101e4988902bb39e0a82752caf1af4addcaf
|
7
|
+
data.tar.gz: 6a90e32f14edea3ce523c3e66bd7f5b8e7a7c073d2efa76595975ef22df86776b191a4279c6c5eb8c5f20b2f58abd28e790988efbec128c0a85dec68153bd783
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,19 @@ For more information about changelogs, check
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
8
8
|
|
9
|
+
## 0.24.0 - 2015-05-21
|
10
|
+
|
11
|
+
**How to upgrade**
|
12
|
+
|
13
|
+
If your code expects the `estimated_minutes_watched`
|
14
|
+
or the `average_view_duration` report to return a `Float`, beware that they now
|
15
|
+
return an `Integer` (since that is what YouTube returns).
|
16
|
+
In case you still need to parse a float, just append `.to_f` to the result.
|
17
|
+
|
18
|
+
* [ENHANCEMENT] Return Integer on `estimated_minutes_watched` reports
|
19
|
+
* [ENHANCEMENT] Return Integer on `average_view_duration` reports
|
20
|
+
* [FEATURE] New `by: :referrer` option for reports.
|
21
|
+
|
9
22
|
## 0.23.2 - 2015-05-20
|
10
23
|
|
11
24
|
* [FEATURE] Accept `:includes` in reports by video, related video and playlist to preload parts.
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ To install on your system, run
|
|
41
41
|
|
42
42
|
To use inside a bundled Ruby project, add this line to the Gemfile:
|
43
43
|
|
44
|
-
gem 'yt', '~> 0.
|
44
|
+
gem 'yt', '~> 0.24.0'
|
45
45
|
|
46
46
|
Since the gem follows [Semantic Versioning](http://semver.org),
|
47
47
|
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
|
@@ -18,7 +18,7 @@ module Yt
|
|
18
18
|
# @return [Hash<Symbol, Hash>] the reports for each metric specified.
|
19
19
|
# @example Get the views and estimated minutes watched by day for last week:
|
20
20
|
# resource.reports only: [:views, :estimated_minutes_watched] since: 1.week.ago, by: :day
|
21
|
-
# # => {views: {Wed, 8 May 2014 => 12, Thu, 9 May 2014 => 34, …}, estimated_minutes_watched: {Wed, 8 May 2014 => 9
|
21
|
+
# # => {views: {Wed, 8 May 2014 => 12, Thu, 9 May 2014 => 34, …}, estimated_minutes_watched: {Wed, 8 May 2014 => 9, Thu, 9 May 2014 => 6, …}}
|
22
22
|
|
23
23
|
# @!macro [new] report
|
24
24
|
# Returns the $1 grouped by the given dimension.
|
@@ -105,6 +105,11 @@ module Yt
|
|
105
105
|
# # => {"fullscreen" => 33.0, "good music" => 12.0, …}
|
106
106
|
# @return [Hash<String, $2>] if grouped by search term, the
|
107
107
|
# $1 for each search term that led viewers to the content.
|
108
|
+
# @example Get yesterday’s $1 by URL that referred to the resource:
|
109
|
+
# resource.$1 since: 1.day.ago, until: 1.day.ago, by: :referrer
|
110
|
+
# # => {"Google Search" => 33.0, "ytimg.com" => 12.0, …}
|
111
|
+
# @return [Hash<String, $2>] if grouped by search term, the
|
112
|
+
# $1 for each search term that led viewers to the content.
|
108
113
|
# @example Get yesterday’s $1 by device type:
|
109
114
|
# resource.$1 since: 1.day.ago, until: 1.day.ago, by: :device_type
|
110
115
|
# # => {mobile: 133.0, tv: 412.0, …}
|
@@ -12,6 +12,7 @@ module Yt
|
|
12
12
|
hash[:embedded_player_location] = {name: 'insightPlaybackLocationDetail', parse: ->(url, *values) {@metrics.keys.zip(values.map{|v| {url => v}}).to_h} }
|
13
13
|
hash[:related_video] = {name: 'insightTrafficSourceDetail', parse: ->(video_id, *values) { @metrics.keys.zip(values.map{|v| {video_id => v}}).to_h} }
|
14
14
|
hash[:search_term] = {name: 'insightTrafficSourceDetail', parse: ->(search_term, *values) {@metrics.keys.zip(values.map{|v| {search_term => v}}).to_h} }
|
15
|
+
hash[:referrer] = {name: 'insightTrafficSourceDetail', parse: ->(url, *values) {@metrics.keys.zip(values.map{|v| {url => v}}).to_h} }
|
15
16
|
hash[:video] = {name: 'video', parse: ->(video_id, *values) { @metrics.keys.zip(values.map{|v| {video_id => v}}).to_h} }
|
16
17
|
hash[:playlist] = {name: 'playlist', parse: ->(playlist_id, *values) { @metrics.keys.zip(values.map{|v| {playlist_id => v}}).to_h} }
|
17
18
|
hash[:device_type] = {name: 'deviceType', parse: ->(type, *values) {@metrics.keys.zip(values.map{|v| {type.downcase.to_sym => v}}).to_h} }
|
@@ -115,8 +116,8 @@ module Yt
|
|
115
116
|
params['dimensions'] = DIMENSIONS[@dimension][:name] unless @dimension == :range
|
116
117
|
params['max-results'] = 10 if @dimension == :video
|
117
118
|
params['max-results'] = 200 if @dimension == :playlist
|
118
|
-
params['max-results'] = 25 if @dimension.in? [:embedded_player_location, :related_video, :search_term]
|
119
|
-
params['sort'] = "-#{@metrics.keys.join(',').to_s.camelize(:lower)}" if @dimension.in? [:video, :playlist, :embedded_player_location, :related_video, :search_term]
|
119
|
+
params['max-results'] = 25 if @dimension.in? [:embedded_player_location, :related_video, :search_term, :referrer]
|
120
|
+
params['sort'] = "-#{@metrics.keys.join(',').to_s.camelize(:lower)}" if @dimension.in? [:video, :playlist, :embedded_player_location, :related_video, :search_term, :referrer]
|
120
121
|
params[:filters] = ((params[:filters] || '').split(';') + ["country==US"]).compact.uniq.join(';') if @dimension == :state && !@state
|
121
122
|
params[:filters] = ((params[:filters] || '').split(';') + ["country==#{@country}"]).compact.uniq.join(';') if @country && !@state
|
122
123
|
params[:filters] = ((params[:filters] || '').split(';') + ["province==US-#{@state}"]).compact.uniq.join(';') if @state
|
@@ -124,6 +125,7 @@ module Yt
|
|
124
125
|
params[:filters] = ((params[:filters] || '').split(';') + ['insightPlaybackLocationType==EMBEDDED']).compact.uniq.join(';') if @dimension == :embedded_player_location
|
125
126
|
params[:filters] = ((params[:filters] || '').split(';') + ['insightTrafficSourceType==RELATED_VIDEO']).compact.uniq.join(';') if @dimension == :related_video
|
126
127
|
params[:filters] = ((params[:filters] || '').split(';') + ['insightTrafficSourceType==YT_SEARCH']).compact.uniq.join(';') if @dimension == :search_term
|
128
|
+
params[:filters] = ((params[:filters] || '').split(';') + ['insightTrafficSourceType==EXT_URL']).compact.uniq.join(';') if @dimension == :referrer
|
127
129
|
end
|
128
130
|
end
|
129
131
|
|
data/lib/yt/models/channel.rb
CHANGED
@@ -112,7 +112,7 @@ module Yt
|
|
112
112
|
has_report :uniques, Integer
|
113
113
|
|
114
114
|
# @macro report_by_channel_dimensions
|
115
|
-
has_report :estimated_minutes_watched,
|
115
|
+
has_report :estimated_minutes_watched, Integer
|
116
116
|
|
117
117
|
# @macro report_by_gender_and_age_group
|
118
118
|
has_report :viewer_percentage, Float
|
@@ -142,7 +142,7 @@ module Yt
|
|
142
142
|
has_report :favorites_removed, Integer
|
143
143
|
|
144
144
|
# @macro report_by_day_and_state
|
145
|
-
has_report :average_view_duration,
|
145
|
+
has_report :average_view_duration, Integer
|
146
146
|
|
147
147
|
# @macro report_by_day_and_state
|
148
148
|
has_report :average_view_percentage, Float
|
data/lib/yt/models/playlist.rb
CHANGED
@@ -157,13 +157,13 @@ module Yt
|
|
157
157
|
has_report :views, Integer
|
158
158
|
|
159
159
|
# @macro report_by_playlist_dimensions
|
160
|
-
has_report :estimated_minutes_watched,
|
160
|
+
has_report :estimated_minutes_watched, Integer
|
161
161
|
|
162
162
|
# @macro report_by_gender_and_age_group
|
163
163
|
has_report :viewer_percentage, Float
|
164
164
|
|
165
165
|
# @macro report_by_day_and_state
|
166
|
-
has_report :average_view_duration,
|
166
|
+
has_report :average_view_duration, Integer
|
167
167
|
|
168
168
|
# @macro report_by_day_and_state
|
169
169
|
has_report :playlist_starts, Integer
|
data/lib/yt/models/video.rb
CHANGED
@@ -381,7 +381,7 @@ module Yt
|
|
381
381
|
has_report :uniques, Integer
|
382
382
|
|
383
383
|
# @macro report_by_video_dimensions
|
384
|
-
has_report :estimated_minutes_watched,
|
384
|
+
has_report :estimated_minutes_watched, Integer
|
385
385
|
|
386
386
|
# @macro report_by_gender_and_age_group
|
387
387
|
has_report :viewer_percentage, Float
|
@@ -415,7 +415,7 @@ module Yt
|
|
415
415
|
has_report :favorites_removed, Integer
|
416
416
|
|
417
417
|
# @macro report_by_day_and_state
|
418
|
-
has_report :average_view_duration,
|
418
|
+
has_report :average_view_duration, Integer
|
419
419
|
|
420
420
|
# @macro report_by_day_and_state
|
421
421
|
has_report :average_view_percentage, Float
|
data/lib/yt/version.rb
CHANGED
@@ -12,10 +12,10 @@ describe Yt::Channel, :partner do
|
|
12
12
|
|
13
13
|
describe 'multiple reports can be retrieved at once' do
|
14
14
|
metrics = {views: Integer, uniques: Integer,
|
15
|
-
estimated_minutes_watched:
|
15
|
+
estimated_minutes_watched: Integer, comments: Integer, likes: Integer,
|
16
16
|
dislikes: Integer, shares: Integer, subscribers_gained: Integer,
|
17
17
|
subscribers_lost: Integer, favorites_added: Integer,
|
18
|
-
favorites_removed: Integer, average_view_duration:
|
18
|
+
favorites_removed: Integer, average_view_duration: Integer,
|
19
19
|
average_view_percentage: Float, annotation_clicks: Integer,
|
20
20
|
annotation_click_through_rate: Float,
|
21
21
|
annotation_close_rate: Float, earnings: Float, impressions: Integer,
|
@@ -89,7 +89,7 @@ describe Yt::Channel, :partner do
|
|
89
89
|
|
90
90
|
{views: Integer, comments: Integer, likes: Integer, dislikes: Integer,
|
91
91
|
subscribers_gained: Integer, subscribers_lost: Integer,
|
92
|
-
estimated_minutes_watched:
|
92
|
+
estimated_minutes_watched: Integer, average_view_duration: Integer,
|
93
93
|
annotation_clicks: Integer, annotation_click_through_rate: Float,
|
94
94
|
favorites_added: Integer, favorites_removed: Integer,
|
95
95
|
average_view_percentage: Float, impressions: Integer,
|
@@ -347,6 +347,15 @@ describe Yt::Channel, :partner do
|
|
347
347
|
end
|
348
348
|
end
|
349
349
|
|
350
|
+
describe 'views can be grouped by referrer' do
|
351
|
+
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
352
|
+
|
353
|
+
specify 'with the :by option set to :referrer' do
|
354
|
+
views = channel.views range.merge by: :referrer
|
355
|
+
expect(views.keys).to all(be_a String)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
350
359
|
describe 'views can be grouped by video' do
|
351
360
|
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
352
361
|
|
@@ -1024,6 +1033,15 @@ describe Yt::Channel, :partner do
|
|
1024
1033
|
end
|
1025
1034
|
end
|
1026
1035
|
|
1036
|
+
describe 'estimated minutes watched can be grouped by referrer' do
|
1037
|
+
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
1038
|
+
|
1039
|
+
specify 'with the :by option set to :referrer' do
|
1040
|
+
estimated_minutes_watched = channel.estimated_minutes_watched range.merge by: :referrer
|
1041
|
+
expect(estimated_minutes_watched.keys).to all(be_a String)
|
1042
|
+
end
|
1043
|
+
end
|
1044
|
+
|
1027
1045
|
describe 'estimated minutes watched can be grouped by video' do
|
1028
1046
|
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
1029
1047
|
|
@@ -1048,7 +1066,7 @@ describe Yt::Channel, :partner do
|
|
1048
1066
|
specify 'with the :by option set to :device_type' do
|
1049
1067
|
estimated_minutes_watched = channel.estimated_minutes_watched range.merge by: :device_type
|
1050
1068
|
expect(estimated_minutes_watched.keys).to all(be_instance_of Symbol)
|
1051
|
-
expect(estimated_minutes_watched.values).to all(
|
1069
|
+
expect(estimated_minutes_watched.values).to all(be_an Integer)
|
1052
1070
|
end
|
1053
1071
|
end
|
1054
1072
|
|
@@ -1059,7 +1077,7 @@ describe Yt::Channel, :partner do
|
|
1059
1077
|
minutes = channel.estimated_minutes_watched range.merge by: :country
|
1060
1078
|
expect(minutes.keys).to all(be_a String)
|
1061
1079
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
1062
|
-
expect(minutes.values).to all(
|
1080
|
+
expect(minutes.values).to all(be_an Integer)
|
1063
1081
|
end
|
1064
1082
|
end
|
1065
1083
|
|
@@ -1070,7 +1088,7 @@ describe Yt::Channel, :partner do
|
|
1070
1088
|
minutes = channel.estimated_minutes_watched range.merge by: :state
|
1071
1089
|
expect(minutes.keys).to all(be_a String)
|
1072
1090
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
1073
|
-
expect(minutes.values).to all(
|
1091
|
+
expect(minutes.values).to all(be_an Integer)
|
1074
1092
|
end
|
1075
1093
|
end
|
1076
1094
|
|
@@ -1159,7 +1177,7 @@ describe Yt::Channel, :partner do
|
|
1159
1177
|
duration = channel.average_view_duration range.merge by: :country
|
1160
1178
|
expect(duration.keys).to all(be_a String)
|
1161
1179
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
1162
|
-
expect(duration.values).to all(
|
1180
|
+
expect(duration.values).to all(be_an Integer)
|
1163
1181
|
end
|
1164
1182
|
end
|
1165
1183
|
|
@@ -1170,7 +1188,7 @@ describe Yt::Channel, :partner do
|
|
1170
1188
|
duration = channel.average_view_duration range.merge by: :state
|
1171
1189
|
expect(duration.keys).to all(be_a String)
|
1172
1190
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
1173
|
-
expect(duration.values).to all(
|
1191
|
+
expect(duration.values).to all(be_an Integer)
|
1174
1192
|
end
|
1175
1193
|
end
|
1176
1194
|
|
@@ -11,8 +11,8 @@ describe Yt::Playlist, :partner do
|
|
11
11
|
let(:id) { ENV['YT_TEST_PARTNER_PLAYLIST_ID'] }
|
12
12
|
|
13
13
|
describe 'multiple reports can be retrieved at once' do
|
14
|
-
metrics = {views: Integer, estimated_minutes_watched:
|
15
|
-
average_view_duration:
|
14
|
+
metrics = {views: Integer, estimated_minutes_watched: Integer,
|
15
|
+
average_view_duration: Integer, playlist_starts: Integer,
|
16
16
|
average_time_in_playlist: Float, views_per_playlist_start: Float}
|
17
17
|
|
18
18
|
specify 'by day' do
|
@@ -37,8 +37,9 @@ describe Yt::Playlist, :partner do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
{views: Integer, estimated_minutes_watched:
|
41
|
-
|
40
|
+
{views: Integer, estimated_minutes_watched: Integer,
|
41
|
+
average_view_duration: Integer, playlist_starts: Integer,
|
42
|
+
average_time_in_playlist: Float,
|
42
43
|
views_per_playlist_start: Float}.each do |metric, type|
|
43
44
|
describe "#{metric} can be retrieved for a range of days" do
|
44
45
|
let(:date_in) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
|
@@ -226,6 +227,15 @@ describe Yt::Playlist, :partner do
|
|
226
227
|
end
|
227
228
|
end
|
228
229
|
|
230
|
+
describe 'views can be grouped by referrer' do
|
231
|
+
let(:range) { {since: ENV['YT_TEST_PARTNER_PLAYLIST_DATE']} }
|
232
|
+
|
233
|
+
specify 'with the :by option set to :referrer' do
|
234
|
+
views = playlist.views range.merge by: :referrer
|
235
|
+
expect(views.keys).to all(be_a String)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
229
239
|
describe 'views can be grouped by video' do
|
230
240
|
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
231
241
|
|
@@ -358,6 +368,15 @@ describe Yt::Playlist, :partner do
|
|
358
368
|
end
|
359
369
|
end
|
360
370
|
|
371
|
+
describe 'estimated minutes watched can be grouped by referrer' do
|
372
|
+
let(:range) { {since: ENV['YT_TEST_PARTNER_PLAYLIST_DATE']} }
|
373
|
+
|
374
|
+
specify 'with the :by option set to :referrer' do
|
375
|
+
minutes = playlist.estimated_minutes_watched range.merge by: :referrer
|
376
|
+
expect(minutes.keys).to all(be_a String)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
361
380
|
describe 'estimated minutes watched can be grouped by video' do
|
362
381
|
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
363
382
|
|
@@ -382,7 +401,7 @@ describe Yt::Playlist, :partner do
|
|
382
401
|
specify 'with the :by option set to :device_type' do
|
383
402
|
minutes = playlist.estimated_minutes_watched range.merge by: :device_type
|
384
403
|
expect(minutes.keys).to all(be_instance_of Symbol)
|
385
|
-
expect(minutes.values).to all(
|
404
|
+
expect(minutes.values).to all(be_an Integer)
|
386
405
|
end
|
387
406
|
end
|
388
407
|
|
@@ -393,7 +412,7 @@ describe Yt::Playlist, :partner do
|
|
393
412
|
minutes = playlist.estimated_minutes_watched range.merge by: :country
|
394
413
|
expect(minutes.keys).to all(be_a String)
|
395
414
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
396
|
-
expect(minutes.values).to all(
|
415
|
+
expect(minutes.values).to all(be_an Integer)
|
397
416
|
end
|
398
417
|
end
|
399
418
|
|
@@ -404,7 +423,7 @@ describe Yt::Playlist, :partner do
|
|
404
423
|
minutes = playlist.estimated_minutes_watched range.merge by: :state
|
405
424
|
expect(minutes.keys).to all(be_a String)
|
406
425
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
407
|
-
expect(minutes.values).to all(
|
426
|
+
expect(minutes.values).to all(be_an Integer)
|
408
427
|
end
|
409
428
|
end
|
410
429
|
|
@@ -511,7 +530,7 @@ describe Yt::Playlist, :partner do
|
|
511
530
|
duration = playlist.average_view_duration range.merge by: :country
|
512
531
|
expect(duration.keys).to all(be_a String)
|
513
532
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
514
|
-
expect(duration.values).to all(
|
533
|
+
expect(duration.values).to all(be_an Integer)
|
515
534
|
end
|
516
535
|
end
|
517
536
|
|
@@ -522,7 +541,7 @@ describe Yt::Playlist, :partner do
|
|
522
541
|
duration = playlist.average_view_duration range.merge by: :state
|
523
542
|
expect(duration.keys).to all(be_a String)
|
524
543
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
525
|
-
expect(duration.values).to all(
|
544
|
+
expect(duration.values).to all(be_an Integer)
|
526
545
|
end
|
527
546
|
end
|
528
547
|
|
@@ -76,7 +76,7 @@ describe Yt::Video, :partner do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
{views: Integer, comments: Integer, dislikes: Integer,
|
79
|
-
estimated_minutes_watched:
|
79
|
+
estimated_minutes_watched: Integer, average_view_duration: Integer,
|
80
80
|
average_view_percentage: Float, impressions: Integer,
|
81
81
|
subscribers_lost: Integer, subscribers_gained: Integer, likes: Integer,
|
82
82
|
monetized_playbacks: Integer, earnings: Float}.each do |metric, type|
|
@@ -99,7 +99,7 @@ describe Yt::Video, :partner do
|
|
99
99
|
{views: Integer, comments: Integer, likes: Integer, dislikes: Integer,
|
100
100
|
shares: Integer, subscribers_gained: Integer, subscribers_lost: Integer,
|
101
101
|
favorites_added: Integer,
|
102
|
-
estimated_minutes_watched:
|
102
|
+
estimated_minutes_watched: Integer, average_view_duration: Integer,
|
103
103
|
average_view_percentage: Float, impressions: Integer,
|
104
104
|
monetized_playbacks: Integer, annotation_clicks: Integer,
|
105
105
|
annotation_click_through_rate: Float, annotation_close_rate: Float,
|
@@ -196,10 +196,10 @@ describe Yt::Video, :partner do
|
|
196
196
|
|
197
197
|
describe 'multiple reports can be retrieved at once' do
|
198
198
|
metrics = {views: Integer, uniques: Integer,
|
199
|
-
estimated_minutes_watched:
|
199
|
+
estimated_minutes_watched: Integer, comments: Integer, likes: Integer,
|
200
200
|
dislikes: Integer, shares: Integer, subscribers_gained: Integer,
|
201
201
|
subscribers_lost: Integer, favorites_added: Integer,
|
202
|
-
favorites_removed: Integer, average_view_duration:
|
202
|
+
favorites_removed: Integer, average_view_duration: Integer,
|
203
203
|
average_view_percentage: Float, annotation_clicks: Integer,
|
204
204
|
annotation_click_through_rate: Float,
|
205
205
|
annotation_close_rate: Float, earnings: Float, impressions: Integer,
|
@@ -339,6 +339,15 @@ describe Yt::Video, :partner do
|
|
339
339
|
end
|
340
340
|
end
|
341
341
|
|
342
|
+
describe 'views can be grouped by referrer' do
|
343
|
+
let(:range) { {since: ENV['YT_TEST_PARTNER_VIDEO_DATE']} }
|
344
|
+
|
345
|
+
specify 'with the :by option set to :referrer' do
|
346
|
+
views = video.views range.merge by: :referrer
|
347
|
+
expect(views.keys).to all(be_a String)
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
342
351
|
describe 'views can be grouped by device type' do
|
343
352
|
let(:range) { {since: ENV['YT_TEST_PARTNER_VIDEO_DATE']} }
|
344
353
|
|
@@ -661,13 +670,22 @@ describe Yt::Video, :partner do
|
|
661
670
|
end
|
662
671
|
end
|
663
672
|
|
673
|
+
describe 'estimated minutes watched can be grouped by referrer' do
|
674
|
+
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
675
|
+
|
676
|
+
specify 'with the :by option set to :referrer' do
|
677
|
+
estimated_minutes_watched = video.estimated_minutes_watched range.merge by: :referrer
|
678
|
+
expect(estimated_minutes_watched.keys).to all(be_a String)
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
664
682
|
describe 'estimated minutes watched can be grouped by device type' do
|
665
683
|
let(:range) { {since: 4.days.ago, until: 3.days.ago} }
|
666
684
|
|
667
685
|
specify 'with the :by option set to :device_type' do
|
668
686
|
estimated_minutes_watched = video.estimated_minutes_watched range.merge by: :device_type
|
669
687
|
expect(estimated_minutes_watched.keys).to all(be_instance_of Symbol)
|
670
|
-
expect(estimated_minutes_watched.values).to all(
|
688
|
+
expect(estimated_minutes_watched.values).to all(be_an Integer)
|
671
689
|
end
|
672
690
|
end
|
673
691
|
|
@@ -678,7 +696,7 @@ describe Yt::Video, :partner do
|
|
678
696
|
minutes = video.estimated_minutes_watched range.merge by: :country
|
679
697
|
expect(minutes.keys).to all(be_a String)
|
680
698
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
681
|
-
expect(minutes.values).to all(
|
699
|
+
expect(minutes.values).to all(be_an Integer)
|
682
700
|
end
|
683
701
|
end
|
684
702
|
|
@@ -689,7 +707,7 @@ describe Yt::Video, :partner do
|
|
689
707
|
minutes = video.estimated_minutes_watched range.merge by: :state
|
690
708
|
expect(minutes.keys).to all(be_a String)
|
691
709
|
expect(minutes.keys.map(&:length).uniq).to eq [2]
|
692
|
-
expect(minutes.values).to all(
|
710
|
+
expect(minutes.values).to all(be_an Integer)
|
693
711
|
end
|
694
712
|
end
|
695
713
|
|
@@ -744,7 +762,7 @@ describe Yt::Video, :partner do
|
|
744
762
|
duration = video.average_view_duration range.merge by: :country
|
745
763
|
expect(duration.keys).to all(be_a String)
|
746
764
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
747
|
-
expect(duration.values).to all(
|
765
|
+
expect(duration.values).to all(be_an Integer)
|
748
766
|
end
|
749
767
|
end
|
750
768
|
|
@@ -755,7 +773,7 @@ describe Yt::Video, :partner do
|
|
755
773
|
duration = video.average_view_duration range.merge by: :state
|
756
774
|
expect(duration.keys).to all(be_a String)
|
757
775
|
expect(duration.keys.map(&:length).uniq).to eq [2]
|
758
|
-
expect(duration.values).to all(
|
776
|
+
expect(duration.values).to all(be_an Integer)
|
759
777
|
end
|
760
778
|
end
|
761
779
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|