yt 0.24.3 → 0.24.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c12f9d88e82dde5c64b908f8a2c8cd43f9ee588
4
- data.tar.gz: be1d78e20c50df48fd0f5fb9129a1487af71b717
3
+ metadata.gz: 13f722082a0563925b7f9d95ece5ff723fd96b7d
4
+ data.tar.gz: 0cf90eda3d4d1170a0b6c618c193f864af9c3b89
5
5
  SHA512:
6
- metadata.gz: 22520e88d24260587fd04f99e55a2a98d04d3a9f8a822f831bb32cb069f884c119eada891ee72efb94c35197959a01caffedafd46a19ccfeb897cf60c29414a7
7
- data.tar.gz: edac76c27b215eb1e7bf32b2fe138dfc75137a1175da8bbfe33e51796dc1a4bd52131bf11922f378618939d30b8d65df8fdcc238f4949438aecd1fae9580e3a3
6
+ metadata.gz: 34b643c9657ad003fefcba80cd3bc7ec286813f323f6d947854b704f413f161093b031c8113aa93fd63f1fc4caa264897cbeca4cf950c7c7bdab5b50dd03e335
7
+ data.tar.gz: ae540eff03ac2222382408bb910c9bb10abfffbac6ef3b5cb524483f947c21ca8631a5acd41e9f275f9967fb6c1421166d0253b65f80a78cddce04ac5e7a0a49
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.24.4 - 2015-06-05
10
+
11
+ * [ENHANCEMENT] When grouping by traffic source, country, state or playback location, return results sorted by descending views
12
+
9
13
  ## 0.24.3 - 2015-06-05
10
14
 
11
15
  * [ENHANCEMENT] Add newly available traffic sources
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.24.3'
44
+ gem 'yt', '~> 0.24.4'
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*)
@@ -76,6 +76,8 @@ module Yt
76
76
  end
77
77
  if dimension == :month
78
78
  hash = hash.transform_values{|h| h.sort_by{|range, v| range.first}.to_h}
79
+ elsif dimension.in? [:traffic_source, :country, :state, :playback_location]
80
+ hash = hash.transform_values{|h| h.sort_by{|range, v| -v}.to_h}
79
81
  end
80
82
  (@metrics.one? || @metrics.keys == [:earnings, :estimated_minutes_watched]) ? hash[@metrics.keys.first] : hash
81
83
  end
data/lib/yt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.24.3'
2
+ VERSION = '0.24.4'
3
3
  end
@@ -302,6 +302,11 @@ describe Yt::Channel, :partner do
302
302
  views = channel.views range.merge by: :traffic_source
303
303
  expect(views.keys - keys).to be_empty
304
304
  end
305
+
306
+ specify 'and are returned sorted by descending views' do
307
+ views = channel.views range.merge by: :traffic_source
308
+ expect(views.values.sort.reverse).to eq views.values
309
+ end
305
310
  end
306
311
 
307
312
  describe 'views can be grouped by playback location' do
@@ -312,6 +317,11 @@ describe Yt::Channel, :partner do
312
317
  views = channel.views range.merge by: :playback_location
313
318
  expect(views.keys - keys).to be_empty
314
319
  end
320
+
321
+ specify 'and are returned sorted by descending views' do
322
+ views = channel.views range.merge by: :playback_location
323
+ expect(views.values.sort.reverse).to eq views.values
324
+ end
315
325
  end
316
326
 
317
327
  describe 'views can be grouped by embedded player location' do
@@ -405,6 +415,11 @@ describe Yt::Channel, :partner do
405
415
  expect(views.keys.map(&:length).uniq).to eq [2]
406
416
  expect(views.values).to all(be_an Integer)
407
417
  end
418
+
419
+ specify 'and are returned sorted by descending views' do
420
+ views = channel.views range.merge by: :country
421
+ expect(views.values.sort.reverse).to eq views.values
422
+ end
408
423
  end
409
424
 
410
425
  describe 'views can be grouped by state' do
@@ -416,6 +431,11 @@ describe Yt::Channel, :partner do
416
431
  expect(views.keys.map(&:length).uniq).to eq [2]
417
432
  expect(views.values).to all(be_an Integer)
418
433
  end
434
+
435
+ specify 'and are returned sorted by descending views' do
436
+ views = channel.views range.merge by: :state
437
+ expect(views.values.sort.reverse).to eq views.values
438
+ end
419
439
  end
420
440
 
421
441
  describe 'uniques can be retrieved for a single country' do
@@ -1637,7 +1657,7 @@ describe Yt::Channel, :partner do
1637
1657
  describe 'annotation close rate can be retrieved for a single US state' do
1638
1658
  let(:state_code) { 'NY' }
1639
1659
  let(:result) { channel.annotation_close_rate since: date, by: by, in: location }
1640
- let(:date) { 4.days.ago }
1660
+ let(:date) { ENV['YT_TEST_PARTNER_VIDEO_DATE'] }
1641
1661
 
1642
1662
  context 'and grouped by day' do
1643
1663
  let(:by) { :day }
@@ -300,6 +300,11 @@ describe Yt::Video, :partner do
300
300
  views = video.views range.merge by: :traffic_source
301
301
  expect(views.keys - keys).to be_empty
302
302
  end
303
+
304
+ specify 'and are returned sorted by descending views' do
305
+ views = video.views range.merge by: :traffic_source
306
+ expect(views.values.sort.reverse).to eq views.values
307
+ end
303
308
  end
304
309
 
305
310
  describe 'views can be grouped by playback location' do
@@ -367,6 +372,11 @@ describe Yt::Video, :partner do
367
372
  expect(views.keys.map(&:length).uniq).to eq [2]
368
373
  expect(views.values).to all(be_an Integer)
369
374
  end
375
+
376
+ specify 'and are returned sorted by descending views' do
377
+ views = video.views range.merge by: :country
378
+ expect(views.values.sort.reverse).to eq views.values
379
+ end
370
380
  end
371
381
 
372
382
  describe 'views can be grouped by state' do
@@ -378,6 +388,11 @@ describe Yt::Video, :partner do
378
388
  expect(views.keys.map(&:length).uniq).to eq [2]
379
389
  expect(views.values).to all(be_an Integer)
380
390
  end
391
+
392
+ specify 'and are returned sorted by descending views' do
393
+ views = video.views range.merge by: :state
394
+ expect(views.values.sort.reverse).to eq views.values
395
+ end
381
396
  end
382
397
 
383
398
  describe 'uniques can be retrieved for a single US state' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.3
4
+ version: 0.24.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo