yt 0.13.6 → 0.13.7
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/CHANGELOG.md +4 -0
- data/README.md +2 -1
- data/lib/yt/collections/reports.rb +1 -1
- data/lib/yt/collections/videos.rb +1 -1
- data/lib/yt/models/video.rb +3 -0
- data/lib/yt/version.rb +1 -1
- data/spec/requests/as_account/channel_spec.rb +9 -6
- data/spec/requests/as_account/video_spec.rb +1 -0
- data/spec/requests/as_content_owner/video_spec.rb +32 -0
- 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: 92bd4d67d0b039373542dd45a4f85abaf95d3aa3
|
4
|
+
data.tar.gz: 8ec36efd6d006f719ff41fa9a85cda983ee9ac5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 575970ef892b48beb15b0ff0266ebc67f68e175820696b30fdfbbde1017039a4fb1eafb83c86aa46819e6bf399ae9f3ea868c6c1a75125e8cc546d1fab61195b
|
7
|
+
data.tar.gz: b25da01c60ec08ae5a7aa8796a5f778e3038a0f32532a8cbb9b201f39fad91be71bf69a3cca0f11daa09b0f8386d9c4468580b7bc846bab7aca07009b72892d4
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ 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.13.7 - 2014-10-27
|
10
|
+
|
11
|
+
* [FEATURE] New video reports: monetized playbacks.
|
12
|
+
|
9
13
|
## 0.13.6 - 2014-10-08
|
10
14
|
|
11
15
|
* [ENHANCEMENT] Accept `includes(:viewer_percentages)` in `.partnered_channels` to eager-load multiple viewer percentages at once.
|
data/README.md
CHANGED
@@ -239,7 +239,7 @@ Use [Yt::Video](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/Video)
|
|
239
239
|
* access the annotations of a video
|
240
240
|
* delete a video
|
241
241
|
* like and dislike a video
|
242
|
-
* retrieve the daily earnings, views, comments, likes, dislikes, shares and
|
242
|
+
* retrieve the daily earnings, views, comments, likes, dislikes, shares, impressions and monetized playbacks of a video
|
243
243
|
* retrieve the viewer percentage of a video by gender and age group
|
244
244
|
* retrieve data about live-streaming videos
|
245
245
|
* retrieve the advertising options of a video
|
@@ -346,6 +346,7 @@ video.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0
|
|
346
346
|
video.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
|
347
347
|
video.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
|
348
348
|
video.impressions_on 5.days.ago #=> 157.0
|
349
|
+
video.monetized_playbacks_on 5.days.ago #=> 123.0
|
349
350
|
|
350
351
|
video.viewer_percentages #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
|
351
352
|
video.viewer_percentage(gender: :female) #=> 49.12
|
@@ -37,7 +37,7 @@ module Yt
|
|
37
37
|
@parent.reports_params.tap do |params|
|
38
38
|
params['start-date'] = @days_range.begin
|
39
39
|
params['end-date'] = @days_range.end
|
40
|
-
params['metrics'] = @metric
|
40
|
+
params['metrics'] = @metric.to_s.camelize(:lower)
|
41
41
|
params['dimensions'] = :day
|
42
42
|
end
|
43
43
|
end
|
data/lib/yt/models/video.rb
CHANGED
data/lib/yt/version.rb
CHANGED
@@ -79,16 +79,19 @@ describe Yt::Channel, :device_app do
|
|
79
79
|
it { expect(channel.videos.where(chart: 'invalid').first).to be_a Yt::Video }
|
80
80
|
end
|
81
81
|
|
82
|
-
# @note: these tests are slow because they go through multiple pages of
|
83
|
-
# results and do so to test that we can overcome YouTube’s limitation of
|
84
|
-
# only returning the first 500 results for each query.
|
85
|
-
# @note: in principle, the following three counters should match, but in
|
86
|
-
# reality +video_count+ and +size+ are only approximations.
|
87
82
|
context 'with more than 500 videos' do
|
88
83
|
let(:id) { 'UCsmvakQZlvGsyjyOhmhvOsw' }
|
84
|
+
# @note: in principle, the following three counters should match, but in
|
85
|
+
# reality +video_count+ and +size+ are only approximations.
|
89
86
|
it { expect(channel.video_count).to be > 500 }
|
90
87
|
it { expect(channel.videos.size).to be > 500 }
|
91
|
-
|
88
|
+
context 'with default order (by date)' do
|
89
|
+
# @note: these tests are slow because they go through multiple pages of
|
90
|
+
# results and do so to test that we can overcome YouTube’s limitation of
|
91
|
+
# only returning the first 500 results when ordered by date.
|
92
|
+
it { expect(channel.videos.count).to be > 500 }
|
93
|
+
it { expect(channel.videos.where(order: 'viewCount').count).to be 500 }
|
94
|
+
end
|
92
95
|
end
|
93
96
|
end
|
94
97
|
|
@@ -305,6 +305,7 @@ describe Yt::Video, :device_app do
|
|
305
305
|
expect{video.shares}.not_to raise_error
|
306
306
|
expect{video.earnings}.to raise_error Yt::Errors::Unauthorized
|
307
307
|
expect{video.impressions}.to raise_error Yt::Errors::Unauthorized
|
308
|
+
expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
|
308
309
|
expect{video.advertising_options_set}.to raise_error Yt::Errors::Forbidden
|
309
310
|
|
310
311
|
expect{video.views_on 3.days.ago}.not_to raise_error
|
@@ -237,6 +237,38 @@ describe Yt::Video, :partner do
|
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
|
+
describe 'monetized playbacks can be retrieved for a specific day' do
|
241
|
+
context 'in which the video was partnered' do
|
242
|
+
let(:monetized_playbacks) { video.monetized_playbacks_on 20.days.ago}
|
243
|
+
it { expect(monetized_playbacks).to be_a Float }
|
244
|
+
end
|
245
|
+
|
246
|
+
context 'in which the video was not partnered' do
|
247
|
+
let(:monetized_playbacks) { video.monetized_playbacks_on 20.years.ago}
|
248
|
+
it { expect(monetized_playbacks).to be_nil }
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
describe 'monetized playbacks can be retrieved for a range of days' do
|
253
|
+
let(:date) { 4.days.ago }
|
254
|
+
|
255
|
+
specify 'with a given start (:since option)' do
|
256
|
+
expect(video.monetized_playbacks(since: date).keys.min).to eq date.to_date
|
257
|
+
end
|
258
|
+
|
259
|
+
specify 'with a given end (:until option)' do
|
260
|
+
expect(video.monetized_playbacks(until: date).keys.max).to eq date.to_date
|
261
|
+
end
|
262
|
+
|
263
|
+
specify 'with a given start (:from option)' do
|
264
|
+
expect(video.monetized_playbacks(from: date).keys.min).to eq date.to_date
|
265
|
+
end
|
266
|
+
|
267
|
+
specify 'with a given end (:to option)' do
|
268
|
+
expect(video.monetized_playbacks(to: date).keys.max).to eq date.to_date
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
240
272
|
specify 'viewer percentages by gender and age range can be retrieved' do
|
241
273
|
expect(video.viewer_percentages[:female]['18-24']).to be_a Float
|
242
274
|
expect(video.viewer_percentages[:female]['25-34']).to be_a Float
|
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.13.
|
4
|
+
version: 0.13.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|