yt 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/yt/actions/list.rb +2 -1
- data/lib/yt/models/iterator.rb +15 -0
- data/lib/yt/version.rb +1 -1
- data/spec/collections/videos_spec.rb +1 -1
- data/spec/requests/as_content_owner/content_owner_spec.rb +5 -2
- data/spec/spec_helper.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b117eddfc2f87b57eb4a4ea124ff8f45e5308deb
|
4
|
+
data.tar.gz: 72074157314c69230eeb90a8c28e074611d20314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e7af1b76ea03b99058c314acac896692c4090351f0896b733e9366bf1a7864d51bf17d5c0a7637bd4630fb1ffe4faa56a5a85b1928783d856f314b00c285f27
|
7
|
+
data.tar.gz: df8230eba2a407722778e30d76c557047967ba1d8f5456f392c186cbd8d9ec8bebebf482dc0775830ced1d0f5bf60ece22d4f8a59734aa8f1bef078b4bcac908
|
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.10.1 - 2014-08-11
|
10
|
+
|
11
|
+
* [BUGFIX] Make Yt work on Ruby 1.9.3 / ActiveSupport 3.0 again (was broken by 0.10.0)
|
12
|
+
|
9
13
|
## 0.10.0 - 2014-08-11
|
10
14
|
|
11
15
|
**How to upgrade**
|
data/Gemfile.lock
CHANGED
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.10.
|
44
|
+
gem 'yt', '~> 0.10.1'
|
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*)
|
data/lib/yt/actions/list.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yt/models/request'
|
2
|
+
require 'yt/models/iterator'
|
2
3
|
require 'yt/errors/no_items'
|
3
4
|
|
4
5
|
module Yt
|
@@ -15,7 +16,7 @@ module Yt
|
|
15
16
|
|
16
17
|
def list
|
17
18
|
@last_index, @page_token = 0, nil
|
18
|
-
|
19
|
+
Yt::Iterator.new(-> {total_results}) do |items|
|
19
20
|
while next_item = find_next
|
20
21
|
items << next_item
|
21
22
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Yt
|
2
|
+
module Models
|
3
|
+
# If we dropped support for Ruby 1.9.3, then we could simply use Enumerator
|
4
|
+
# which takes a `size` parameter in Ruby >= 2.
|
5
|
+
class Iterator < Enumerator
|
6
|
+
def initialize(size=nil, &block)
|
7
|
+
RUBY_VERSION < '2' ? super(&block) : super(size, &block)
|
8
|
+
end
|
9
|
+
|
10
|
+
def size
|
11
|
+
RUBY_VERSION < '2' ? count : super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/yt/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe Yt::Collections::Videos do
|
|
7
7
|
let(:channel) { Yt::Channel.new id: 'any-id' }
|
8
8
|
let(:page) { {items: [], token: 'any-token'} }
|
9
9
|
|
10
|
-
describe '#size' do
|
10
|
+
describe '#size', :ruby2 do
|
11
11
|
describe 'sends only one request and return the total results' do
|
12
12
|
let(:total_results) { 123456 }
|
13
13
|
before do
|
@@ -2,11 +2,14 @@ require 'spec_helper'
|
|
2
2
|
require 'yt/models/content_owner'
|
3
3
|
|
4
4
|
describe Yt::ContentOwner, :partner do
|
5
|
-
describe '.partnered_channels' do
|
6
|
-
it { expect($content_owner.partnered_channels.size).to be > 0 }
|
5
|
+
describe '.partnered_channels.first' do
|
7
6
|
it { expect($content_owner.partnered_channels.first).to be_a Yt::Channel }
|
8
7
|
end
|
9
8
|
|
9
|
+
describe '.partnered_channels.size', :ruby2 do
|
10
|
+
it { expect($content_owner.partnered_channels.size).to be > 0 }
|
11
|
+
end
|
12
|
+
|
10
13
|
describe '.claims' do
|
11
14
|
describe 'given the content owner has policies' do
|
12
15
|
let(:claim) { $content_owner.claims.first }
|
data/spec/spec_helper.rb
CHANGED
@@ -11,4 +11,8 @@ Dir['./spec/support/**/*.rb'].each {|f| require f}
|
|
11
11
|
|
12
12
|
RSpec.configure do |config|
|
13
13
|
config.order = 'random'
|
14
|
+
config.run_all_when_everything_filtered = false
|
15
|
+
# @note: Some tests might take too long to run on Ruby 1.9.3 which does not
|
16
|
+
# support "size" for Enumerator, so we are better off skipping them.
|
17
|
+
config.filter_run_excluding ruby2: true if RUBY_VERSION < '2'
|
14
18
|
end
|
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.10.
|
4
|
+
version: 0.10.1
|
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-08-
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/yt/models/description.rb
|
176
176
|
- lib/yt/models/device_flow.rb
|
177
177
|
- lib/yt/models/id.rb
|
178
|
+
- lib/yt/models/iterator.rb
|
178
179
|
- lib/yt/models/live_streaming_detail.rb
|
179
180
|
- lib/yt/models/playlist.rb
|
180
181
|
- lib/yt/models/playlist_item.rb
|