yt 0.13.10 → 0.13.11

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: f38c80c9cc34b749849ed9934a037fe7707614ce
4
- data.tar.gz: 2a9a06c9f14a9fabe19aa0d74e47e2a2fe2aaf6f
3
+ metadata.gz: 786cbb9164a2e2b754ce54f81a003d8fee3abc05
4
+ data.tar.gz: cdb45f6cb5c1dfc7a8241a9a75862513db54336d
5
5
  SHA512:
6
- metadata.gz: d39da84ceb5bd9941ea7a90b32ca01e2c94d1aa101289ac7ff012728663f08279bf2d6e961761aeb3043f973fe9304109d4449b95c45e78126784bc7d278bdc4
7
- data.tar.gz: fed816b3f0ef773b7b3f1050135c1a1e08b953ada0ba4aeafc69571c9e0f0408158190a20bcb4be0f4bca803a246254d2738502fed05ec4b4c61f512e09c585c
6
+ metadata.gz: c66811d1d74ee081d1fd00864c8668e1a053d6326892c6fd4d999524b913514cf2753f29c3926e2124a31505ecd9689a8e15fa660a5470af84f9b40468b50c18
7
+ data.tar.gz: 598db011f908c5d8200601abe755aea2571233c0d41fb5627397ea268efff5c8a2ab30d61e86f368ccc9a47f94f8888ff27eec66c6a6454f12cf8ad77233391d
@@ -6,7 +6,13 @@ 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.9 - 2015-02-17
9
+ ## 0.13.11 - 2015-02-27
10
+
11
+ * [FEATURE] New channel reports: `subscribers_gained`, `subscribers_lost`.
12
+ * [FEATURE] New video reports: `subscribers_gained`, `subscribers_lost`.
13
+ * [FEATURE] New channel reports: `estimated_minutes_watched`, `average_view_duration`, `average_view_percentage`.
14
+
15
+ ## 0.13.10 - 2015-02-17
10
16
 
11
17
  * [FEATURE] New `video.upload_thumbnail` to upload the thumbnail for a video.
12
18
 
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.13.9'
44
+ gem 'yt', '~> 0.13.11'
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*)
@@ -148,7 +148,7 @@ Use [Yt::Channel](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/Chan
148
148
  * access the channels that the channel is subscribed to
149
149
  * subscribe to and unsubscribe from a channel
150
150
  * delete playlists from a channel
151
- * retrieve the daily earnings, views, comments, likes, dislikes, shares and impressions of a channel
151
+ * retrieve the daily earnings, views, comments, likes, dislikes, shares, subscribers gained/lost, estimated/average video watch and impressions of a channel
152
152
  * retrieve the viewer percentage of a channel by gender and age group
153
153
 
154
154
  ```ruby
@@ -201,7 +201,11 @@ channel.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 201
201
201
  channel.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
202
202
  channel.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
203
203
  channel.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
204
-
204
+ channel.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
205
+ channel.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
206
+ channel.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
207
+ channel.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
208
+ channel.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
205
209
  channel.viewer_percentages #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
206
210
  channel.viewer_percentage(gender: :male) #=> 49.12
207
211
  ```
@@ -219,7 +223,11 @@ channel.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 =>
219
223
  channel.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
220
224
  channel.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
221
225
  channel.impressions_on 5.days.ago #=> 157.0
222
-
226
+ channel.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
227
+ channel.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
228
+ channel.estimated_minutes_watched #=> {Sun, 22 Feb 2015=>2433258.0, Mon, 23 Feb 2015=>2634360.0, …}
229
+ channel.average_view_duration #=> {Sun, 22 Feb 2015=>329.0, Mon, 23 Feb 2015=>326.0, …}
230
+ channel.average_view_percentage # {Sun, 22 Feb 2015=>38.858253094977265, Mon, 23 Feb 2015=>37.40014235438217, …}
223
231
  channel.viewer_percentages #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
224
232
  channel.viewer_percentage(gender: :female) #=> 49.12
225
233
 
@@ -240,7 +248,7 @@ Use [Yt::Video](http://rubydoc.info/github/Fullscreen/yt/master/Yt/Models/Video)
240
248
  * access the annotations of a video
241
249
  * delete a video
242
250
  * like and dislike a video
243
- * retrieve the daily earnings, views, comments, likes, dislikes, shares, impressions and monetized playbacks of a video
251
+ * retrieve the daily earnings, views, comments, likes, dislikes, shares, subscribers gained/lost, impressions and monetized playbacks of a video
244
252
  * retrieve the viewer percentage of a video by gender and age group
245
253
  * retrieve data about live-streaming videos
246
254
  * retrieve the advertising options of a video
@@ -331,7 +339,8 @@ video.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014
331
339
  video.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
332
340
  video.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
333
341
  video.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
334
-
342
+ video.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
343
+ video.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
335
344
  video.viewer_percentages #=> {female: {'18-24' => 12.12, '25-34' => 16.16,…}…}
336
345
  video.viewer_percentage(gender: :female) #=> 49.12
337
346
 
@@ -350,6 +359,8 @@ video.comments until: 2.days.ago #=> {Wed, 28 May 2014 => 9.0, Thu, 29 May 2014
350
359
  video.likes from: 8.days.ago #=> {Tue, 27 May 2014 => 7.0, Wed, 28 May 2014 => 0.0, …}
351
360
  video.dislikes to: 2.days.ago #=> {Tue, 27 May 2014 => 0.0, Wed, 28 May 2014 => 1.0, …}
352
361
  video.shares since: 7.days.ago, until: 7.days.ago #=> {Wed, 28 May 2014 => 3.0}
362
+ video.subscribers_gained from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>1.0, Sun, 31 Aug 2014=>0.0}
363
+ video.subscribers_lost from: '2014-08-30', to: '2014-08-31' #=> {Sat, 30 Aug 2014=>0.0, Sun, 31 Aug 2014=>0.0}
353
364
  video.impressions_on 5.days.ago #=> 157.0
354
365
  video.monetized_playbacks_on 5.days.ago #=> 123.0
355
366
 
@@ -31,6 +31,21 @@ module Yt
31
31
  # @macro has_report
32
32
  has_report :shares
33
33
 
34
+ # @macro has_report
35
+ has_report :subscribers_gained
36
+
37
+ # @macro has_report
38
+ has_report :subscribers_lost
39
+
40
+ # @macro has_report
41
+ has_report :estimated_minutes_watched
42
+
43
+ # @macro has_report
44
+ has_report :average_view_duration
45
+
46
+ # @macro has_report
47
+ has_report :average_view_percentage
48
+
34
49
  # @macro has_report
35
50
  has_report :impressions
36
51
 
@@ -58,6 +58,16 @@ module Yt
58
58
  # @macro has_report
59
59
  has_report :shares
60
60
 
61
+ # @macro has_report
62
+ # @note: This is not the total number of subscribers gained by the video’s
63
+ # channel, but the subscribers gained *from* the video’s page.
64
+ has_report :subscribers_gained
65
+
66
+ # @macro has_report
67
+ # @note: This is not the total number of subscribers lost by the video’s
68
+ # channel, but the subscribers lost *from* the video’s page.
69
+ has_report :subscribers_lost
70
+
61
71
  # @macro has_report
62
72
  has_report :impressions
63
73
 
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.13.10'
2
+ VERSION = '0.13.11'
3
3
  end
@@ -130,6 +130,11 @@ describe Yt::Channel, :device_app do
130
130
  expect{channel.likes}.not_to raise_error
131
131
  expect{channel.dislikes}.not_to raise_error
132
132
  expect{channel.shares}.not_to raise_error
133
+ expect{channel.subscribers_gained}.not_to raise_error
134
+ expect{channel.subscribers_lost}.not_to raise_error
135
+ expect{channel.estimated_minutes_watched}.not_to raise_error
136
+ expect{channel.average_view_duration}.not_to raise_error
137
+ expect{channel.average_view_percentage}.not_to raise_error
133
138
  expect{channel.earnings}.to raise_error Yt::Errors::Unauthorized
134
139
  expect{channel.impressions}.to raise_error Yt::Errors::Unauthorized
135
140
 
@@ -138,6 +143,11 @@ describe Yt::Channel, :device_app do
138
143
  expect{channel.likes_on 3.days.ago}.not_to raise_error
139
144
  expect{channel.dislikes_on 3.days.ago}.not_to raise_error
140
145
  expect{channel.shares_on 3.days.ago}.not_to raise_error
146
+ expect{channel.subscribers_gained_on 3.days.ago}.not_to raise_error
147
+ expect{channel.subscribers_lost_on 3.days.ago}.not_to raise_error
148
+ expect{channel.estimated_minutes_watched_on 3.days.ago}.not_to raise_error
149
+ expect{channel.average_view_duration_on 3.days.ago}.not_to raise_error
150
+ expect{channel.average_view_percentage_on 3.days.ago}.not_to raise_error
141
151
  expect{channel.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
142
152
  expect{channel.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
143
153
  end
@@ -285,6 +285,8 @@ describe Yt::Video, :device_app do
285
285
  expect{video.likes}.not_to raise_error
286
286
  expect{video.dislikes}.not_to raise_error
287
287
  expect{video.shares}.not_to raise_error
288
+ expect{video.subscribers_gained}.not_to raise_error
289
+ expect{video.subscribers_lost}.not_to raise_error
288
290
  expect{video.earnings}.to raise_error Yt::Errors::Unauthorized
289
291
  expect{video.impressions}.to raise_error Yt::Errors::Unauthorized
290
292
  expect{video.monetized_playbacks}.to raise_error Yt::Errors::Unauthorized
@@ -295,6 +297,8 @@ describe Yt::Video, :device_app do
295
297
  expect{video.likes_on 3.days.ago}.not_to raise_error
296
298
  expect{video.dislikes_on 3.days.ago}.not_to raise_error
297
299
  expect{video.shares_on 3.days.ago}.not_to raise_error
300
+ expect{video.subscribers_gained_on 3.days.ago}.not_to raise_error
301
+ expect{video.subscribers_lost_on 3.days.ago}.not_to raise_error
298
302
  expect{video.earnings_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
299
303
  expect{video.impressions_on 3.days.ago}.to raise_error Yt::Errors::Unauthorized
300
304
  end
@@ -214,6 +214,166 @@ describe Yt::Channel, :partner do
214
214
  end
215
215
  end
216
216
 
217
+ describe 'gained subscribers can be retrieved for a specific day' do
218
+ context 'in which the channel was partnered' do
219
+ let(:subscribers_gained) { channel.subscribers_gained_on 5.days.ago}
220
+ it { expect(subscribers_gained).to be_a Float }
221
+ end
222
+
223
+ context 'in which the channel was not partnered' do
224
+ let(:subscribers_gained) { channel.subscribers_gained_on 20.years.ago}
225
+ it { expect(subscribers_gained).to be_nil }
226
+ end
227
+ end
228
+
229
+ describe 'gained subscribers can be retrieved for a range of days' do
230
+ let(:date) { 4.days.ago }
231
+
232
+ specify 'with a given start (:since option)' do
233
+ expect(channel.subscribers_gained(since: date).keys.min).to eq date.to_date
234
+ end
235
+
236
+ specify 'with a given end (:until option)' do
237
+ expect(channel.subscribers_gained(until: date).keys.max).to eq date.to_date
238
+ end
239
+
240
+ specify 'with a given start (:from option)' do
241
+ expect(channel.subscribers_gained(from: date).keys.min).to eq date.to_date
242
+ end
243
+
244
+ specify 'with a given end (:to option)' do
245
+ expect(channel.subscribers_gained(to: date).keys.max).to eq date.to_date
246
+ end
247
+ end
248
+
249
+ describe 'lost subscribers can be retrieved for a specific day' do
250
+ context 'in which the channel was partnered' do
251
+ let(:subscribers_lost) { channel.subscribers_lost_on 5.days.ago}
252
+ it { expect(subscribers_lost).to be_a Float }
253
+ end
254
+
255
+ context 'in which the channel was not partnered' do
256
+ let(:subscribers_lost) { channel.subscribers_lost_on 20.years.ago}
257
+ it { expect(subscribers_lost).to be_nil }
258
+ end
259
+ end
260
+
261
+ describe 'lost subscribers can be retrieved for a range of days' do
262
+ let(:date) { 4.days.ago }
263
+
264
+ specify 'with a given start (:since option)' do
265
+ expect(channel.subscribers_lost(since: date).keys.min).to eq date.to_date
266
+ end
267
+
268
+ specify 'with a given end (:until option)' do
269
+ expect(channel.subscribers_lost(until: date).keys.max).to eq date.to_date
270
+ end
271
+
272
+ specify 'with a given start (:from option)' do
273
+ expect(channel.subscribers_lost(from: date).keys.min).to eq date.to_date
274
+ end
275
+
276
+ specify 'with a given end (:to option)' do
277
+ expect(channel.subscribers_lost(to: date).keys.max).to eq date.to_date
278
+ end
279
+ end
280
+
281
+ describe 'estimated minutes watched can be retrieved for a specific day' do
282
+ context 'in which the channel was partnered' do
283
+ let(:estimated_minutes_watched) { channel.estimated_minutes_watched_on 5.days.ago}
284
+ it { expect(estimated_minutes_watched).to be_a Float }
285
+ end
286
+
287
+ context 'in which the channel was not partnered' do
288
+ let(:estimated_minutes_watched) { channel.estimated_minutes_watched_on 20.years.ago}
289
+ it { expect(estimated_minutes_watched).to be_nil }
290
+ end
291
+ end
292
+
293
+ describe 'estimated minutes watched can be retrieved for a range of days' do
294
+ let(:date) { 4.days.ago }
295
+
296
+ specify 'with a given start (:since option)' do
297
+ expect(channel.estimated_minutes_watched(since: date).keys.min).to eq date.to_date
298
+ end
299
+
300
+ specify 'with a given end (:until option)' do
301
+ expect(channel.estimated_minutes_watched(until: date).keys.max).to eq date.to_date
302
+ end
303
+
304
+ specify 'with a given start (:from option)' do
305
+ expect(channel.estimated_minutes_watched(from: date).keys.min).to eq date.to_date
306
+ end
307
+
308
+ specify 'with a given end (:to option)' do
309
+ expect(channel.estimated_minutes_watched(to: date).keys.max).to eq date.to_date
310
+ end
311
+ end
312
+
313
+ describe 'average view duration can be retrieved for a specific day' do
314
+ context 'in which the channel was partnered' do
315
+ let(:average_view_duration) { channel.average_view_duration_on 5.days.ago}
316
+ it { expect(average_view_duration).to be_a Float }
317
+ end
318
+
319
+ context 'in which the channel was not partnered' do
320
+ let(:average_view_duration) { channel.average_view_duration_on 20.years.ago}
321
+ it { expect(average_view_duration).to be_nil }
322
+ end
323
+ end
324
+
325
+ describe 'average view duration can be retrieved for a range of days' do
326
+ let(:date) { 4.days.ago }
327
+
328
+ specify 'with a given start (:since option)' do
329
+ expect(channel.average_view_duration(since: date).keys.min).to eq date.to_date
330
+ end
331
+
332
+ specify 'with a given end (:until option)' do
333
+ expect(channel.average_view_duration(until: date).keys.max).to eq date.to_date
334
+ end
335
+
336
+ specify 'with a given start (:from option)' do
337
+ expect(channel.average_view_duration(from: date).keys.min).to eq date.to_date
338
+ end
339
+
340
+ specify 'with a given end (:to option)' do
341
+ expect(channel.average_view_duration(to: date).keys.max).to eq date.to_date
342
+ end
343
+ end
344
+
345
+ describe 'average view percentage can be retrieved for a specific day' do
346
+ context 'in which the channel was partnered' do
347
+ let(:average_view_percentage) { channel.average_view_percentage_on 5.days.ago}
348
+ it { expect(average_view_percentage).to be_a Float }
349
+ end
350
+
351
+ context 'in which the channel was not partnered' do
352
+ let(:average_view_percentage) { channel.average_view_percentage_on 20.years.ago}
353
+ it { expect(average_view_percentage).to be_nil }
354
+ end
355
+ end
356
+
357
+ describe 'average view percentage can be retrieved for a range of days' do
358
+ let(:date) { 4.days.ago }
359
+
360
+ specify 'with a given start (:since option)' do
361
+ expect(channel.average_view_percentage(since: date).keys.min).to eq date.to_date
362
+ end
363
+
364
+ specify 'with a given end (:until option)' do
365
+ expect(channel.average_view_percentage(until: date).keys.max).to eq date.to_date
366
+ end
367
+
368
+ specify 'with a given start (:from option)' do
369
+ expect(channel.average_view_percentage(from: date).keys.min).to eq date.to_date
370
+ end
371
+
372
+ specify 'with a given end (:to option)' do
373
+ expect(channel.average_view_percentage(to: date).keys.max).to eq date.to_date
374
+ end
375
+ end
376
+
217
377
  describe 'impressions can be retrieved for a specific day' do
218
378
  context 'in which the channel was partnered' do
219
379
  let(:impressions) { channel.impressions_on 20.days.ago}
@@ -205,6 +205,70 @@ describe Yt::Video, :partner do
205
205
  end
206
206
  end
207
207
 
208
+ describe 'gained subscribers can be retrieved for a specific day' do
209
+ context 'in which the video was partnered' do
210
+ let(:subscribers_gained) { video.subscribers_gained_on 5.days.ago}
211
+ it { expect(subscribers_gained).to be_a Float }
212
+ end
213
+
214
+ context 'in which the video was not partnered' do
215
+ let(:subscribers_gained) { video.subscribers_gained_on 20.years.ago}
216
+ it { expect(subscribers_gained).to be_nil }
217
+ end
218
+ end
219
+
220
+ describe 'gained subscribers can be retrieved for a range of days' do
221
+ let(:date) { 4.days.ago }
222
+
223
+ specify 'with a given start (:since option)' do
224
+ expect(video.subscribers_gained(since: date).keys.min).to eq date.to_date
225
+ end
226
+
227
+ specify 'with a given end (:until option)' do
228
+ expect(video.subscribers_gained(until: date).keys.max).to eq date.to_date
229
+ end
230
+
231
+ specify 'with a given start (:from option)' do
232
+ expect(video.subscribers_gained(from: date).keys.min).to eq date.to_date
233
+ end
234
+
235
+ specify 'with a given end (:to option)' do
236
+ expect(video.subscribers_gained(to: date).keys.max).to eq date.to_date
237
+ end
238
+ end
239
+
240
+ describe 'lost subscribers can be retrieved for a specific day' do
241
+ context 'in which the video was partnered' do
242
+ let(:subscribers_lost) { video.subscribers_lost_on 5.days.ago}
243
+ it { expect(subscribers_lost).to be_a Float }
244
+ end
245
+
246
+ context 'in which the video was not partnered' do
247
+ let(:subscribers_lost) { video.subscribers_lost_on 20.years.ago}
248
+ it { expect(subscribers_lost).to be_nil }
249
+ end
250
+ end
251
+
252
+ describe 'lost subscribers 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.subscribers_lost(since: date).keys.min).to eq date.to_date
257
+ end
258
+
259
+ specify 'with a given end (:until option)' do
260
+ expect(video.subscribers_lost(until: date).keys.max).to eq date.to_date
261
+ end
262
+
263
+ specify 'with a given start (:from option)' do
264
+ expect(video.subscribers_lost(from: date).keys.min).to eq date.to_date
265
+ end
266
+
267
+ specify 'with a given end (:to option)' do
268
+ expect(video.subscribers_lost(to: date).keys.max).to eq date.to_date
269
+ end
270
+ end
271
+
208
272
  describe 'impressions can be retrieved for a specific day' do
209
273
  context 'in which the video was partnered' do
210
274
  let(:impressions) { video.impressions_on 20.days.ago}
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.10
4
+ version: 0.13.11
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-02-17 00:00:00.000000000 Z
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport