yt 0.25.20 → 0.25.22

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: ff024fef1f2914775cc7e6739026ae0f83017ee3
4
- data.tar.gz: 2b9ad1e84cec8fb588cfcace0630dfac9d0f52fb
3
+ metadata.gz: 7a98ff50d5e04357a8f4563cd528d9a38dbbaa50
4
+ data.tar.gz: 3e193cf14dbf64103d5f4b306054c4068f69e08c
5
5
  SHA512:
6
- metadata.gz: 3643fe90f6631b93881b1204f87492734ab85b1c15b2d5d5d8161c0b284f1737a8b556a8ff2d7c5a33509d174659f13240e8426ff8ba32ca50050d01f730320d
7
- data.tar.gz: 77f33b6cb1584c5b39fa75a5a5f3987219c85f1120398bdf845c2793a49bf67b148d060d62b03397dd28ccc3053048954307f176a46e739a6fe8ecdbc69d7af3
6
+ metadata.gz: 62af53eb9f22c4d01422077dd2399c2c2c6ee40d73cf02af5a6b95c9f218d6c253004f2520b26060dcb5011270d5dec9cbc76ca24a14889eb941cfe1ab72b4d7
7
+ data.tar.gz: 744df99964bbd6b041f68c813200c78655380cf04f8f7d72385756247017e82a2225bf93ef286fdc18bf128d14678ef7300e127812a9a7a30615ee7217915664
@@ -6,6 +6,14 @@ 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.25.22 - 2016-02-04
10
+
11
+ * [IMPROVEMENT] Deal with channels with more than 500 videos in a better way
12
+
13
+ ## 0.25.21 - 2016-02-04
14
+
15
+ * [BUGFIX] Add required 'require' to have `.with_indifferent_access` in geography
16
+
9
17
  ## 0.25.20 - 2016-01-24
10
18
 
11
19
  * [FEATURE] Add (undocumented) playback location dimensions SEARCH and BROWSE
@@ -77,7 +77,7 @@ module Yt
77
77
  def next_page
78
78
  super.tap do |items|
79
79
  halt_list if use_list_endpoint? && items.empty? && @page_token.nil?
80
- add_offset_to(items) if !use_list_endpoint? && @page_token.nil? && videos_params[:order] == 'date'
80
+ add_offset_to(items) if !use_list_endpoint? && videos_params[:order] == 'date'
81
81
  end
82
82
  end
83
83
 
@@ -86,9 +86,15 @@ module Yt
86
86
  # that limit, the query is restarted with a publishedBefore filter in
87
87
  # case there are more videos to be listed for a channel
88
88
  def add_offset_to(items)
89
- if items.count == videos_params[:max_results]
89
+ @fetched_items ||= 0
90
+ if (@fetched_items += items.count) >= 500
90
91
  last_published = items.last['snippet']['publishedAt']
91
- @page_token, @published_before = '', last_published
92
+ last_published = DateTime.rfc3339(last_published) - 1.second
93
+ last_published = last_published.strftime '%FT%T.999Z'
94
+ @page_token, @published_before, @fetched_items = '', last_published, 0
95
+ elsif (1...50) === @last_index % 50
96
+ @halt_list, @page_token = true, nil
97
+ @last_index += items.size
92
98
  end
93
99
  end
94
100
 
@@ -1,3 +1,6 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext/hash/indifferent_access'
3
+
1
4
  module Yt
2
5
  # The list of country codes and names used by the YouTube Analytics API.
3
6
  # @see https://developers.google.com/youtube/analytics/v1/dimsmets/dims#country
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.25.20'
2
+ VERSION = '0.25.22'
3
3
  end
@@ -86,6 +86,7 @@ describe Yt::Channel, :device_app do
86
86
  # of results to test that we can overcome YouTube’s limitation of only
87
87
  # returning the first 500 results when ordered by date.
88
88
  expect(channel.videos.count).to be > 500
89
+ expect(channel.videos.count).to eq channel.videos.map(&:id).uniq.count
89
90
  expect(channel.videos.where(order: 'viewCount').count).to be 500
90
91
  end
91
92
 
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.25.20
4
+ version: 0.25.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-24 00:00:00.000000000 Z
11
+ date: 2016-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport