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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30c38777c96e3983801b273d1ca29efd2e107cd9
4
- data.tar.gz: 4de8292876f8d7193a0d5e32355b65a0fdd5444b
3
+ metadata.gz: 92bd4d67d0b039373542dd45a4f85abaf95d3aa3
4
+ data.tar.gz: 8ec36efd6d006f719ff41fa9a85cda983ee9ac5f
5
5
  SHA512:
6
- metadata.gz: 35e20ccb37d0a7a9a8faa9045735025488a896b21313a47189556f7031dd0581f8f485e775dbf8cbbfb791a5805a2e4b07e4856334da6827c1394959911ee243
7
- data.tar.gz: af3f518907140a82bb4a22baa82d1b07a4fb47ae62b016c91f138a6c8b3cab733fb26a0b4f8c7af73dff9651907fd83a56561edf30ec3ec5126b76060f24dfda
6
+ metadata.gz: 575970ef892b48beb15b0ff0266ebc67f68e175820696b30fdfbbde1017039a4fb1eafb83c86aa46819e6bf399ae9f3ea868c6c1a75125e8cc546d1fab61195b
7
+ data.tar.gz: b25da01c60ec08ae5a7aa8796a5f778e3038a0f32532a8cbb9b201f39fad91be71bf69a3cca0f11daa09b0f8386d9c4468580b7bc846bab7aca07009b72892d4
@@ -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 impressions of a video
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
@@ -35,7 +35,7 @@ module Yt
35
35
 
36
36
  def next_page
37
37
  super.tap do |items|
38
- add_offset_to(items) if !use_list_endpoint? && @page_token.nil?
38
+ add_offset_to(items) if !use_list_endpoint? && @page_token.nil? && videos_params[:order] == 'date'
39
39
  end
40
40
  end
41
41
 
@@ -61,6 +61,9 @@ module Yt
61
61
  # @macro has_report
62
62
  has_report :impressions
63
63
 
64
+ # @macro has_report
65
+ has_report :monetized_playbacks
66
+
64
67
  # @macro has_viewer_percentages
65
68
  has_viewer_percentages
66
69
 
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.13.6'
2
+ VERSION = '0.13.7'
3
3
  end
@@ -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
- it { expect(channel.videos.count).to be > 500 }
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.6
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-08 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport