yt 0.11.0 → 0.11.1

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: 20c3426083692b2c9726ef4c76119e2ad252f51d
4
- data.tar.gz: 3e03a4ab33ee8de7c5ea9e9786b05b3bc953790e
3
+ metadata.gz: 1bca9a6106823c8817aef8eb024c9b54ae1a684d
4
+ data.tar.gz: a4dd91d6a9be61e077ab502b4268cf7362383142
5
5
  SHA512:
6
- metadata.gz: d4f963fe983113861da21a13f2cca84011d8a717601c53f5009a6e0304354ea30d605ed31cc14ff8959107592ab6cb913387d27285ff63bf640a26fc08c8e968
7
- data.tar.gz: 4ef695b291cb1b97884acdfc26a92130a83c6ed169319add5c9e901e8bb9067e515b992b6250750aeb71053dc1756f53e56a240c4c5fe1aa292a3f26559cf447
6
+ metadata.gz: 5bcd46f496c2a4cd43a280da1bcea6b54d5527152ed2cf73cae7797ba4eb7033a20f998caf9208d19bc665f9ac9e6ebd2421df48e6f07d4c4171d37414c156f7
7
+ data.tar.gz: 5da86f76c045a7760ab56ed9022029332c6f2bc75ad2fe10d9750545a0900388f52db27be88e88907e9d893798bd3927de587ce9e5376dbd52eb192104a59ff2
@@ -6,6 +6,17 @@ 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.11.1 - 2014-08-17
10
+
11
+ * [ENHANCEMENT] Add Video search even without a parent account or channel
12
+
13
+ For instance, to search for the most viewed video on the whole YouTube, run:
14
+
15
+ ```ruby
16
+ videos = Yt::Collections::Videos.new
17
+ videos.where(order: 'viewCount').first.title #=> "PSY - GANGNAM STYLE"
18
+ ```
19
+
9
20
  ## 0.11.0 - 2014-08-17
10
21
 
11
22
  **How to upgrade**
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yt (0.11.0)
4
+ yt (0.11.1)
5
5
  activesupport
6
6
 
7
7
  GEM
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.11.0'
44
+ gem 'yt', '~> 0.11.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*)
@@ -19,10 +19,25 @@ module Yt
19
19
  new parent: parent, auth: parent.auth
20
20
  end
21
21
 
22
- def where(conditions = {})
22
+ # Adds requirements to the collection in order to limit the result of
23
+ # List methods to only items that match the requirements.
24
+ #
25
+ # Under the hood, all the requirements are passed to the YouTube API
26
+ # as query parameters, after transforming the keys to camel-case.
27
+ #
28
+ # To know which requirements are available for each collection, check
29
+ # the documentation of the corresponding YouTube API endpoint.
30
+ # For instance the list of valid requirements to filter a list of videos
31
+ # are at https://developers.google.com/youtube/v3/docs/search/list
32
+ #
33
+ # @example Return the first video of a channel (no requirements):
34
+ # video.channels.first
35
+ # @example Return the first long video of a channel by video count:
36
+ # video.channels.where(order: 'viewCount', video_duration: 'long').first
37
+ def where(requirements = {})
23
38
  self.tap do
24
39
  @items = []
25
- @where_params = conditions
40
+ @where_params = requirements
26
41
  end
27
42
  end
28
43
 
@@ -48,12 +48,13 @@ module Yt
48
48
  end
49
49
 
50
50
  def videos_params
51
- @parent.videos_params.tap do |params|
51
+ {}.tap do |params|
52
52
  params[:type] = :video
53
53
  params[:max_results] = 50
54
54
  params[:part] = 'snippet'
55
55
  params[:order] = 'date'
56
56
  params[:published_before] = @published_before if @published_before
57
+ params.merge! @parent.videos_params if @parent
57
58
  apply_where_params! params
58
59
  end
59
60
  end
@@ -1,3 +1,3 @@
1
1
  module Yt
2
- VERSION = '0.11.0'
2
+ VERSION = '0.11.1'
3
3
  end
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+ require 'spec_helper'
3
+ require 'yt/collections/videos'
4
+
5
+ describe Yt::Collections::Videos, :server_app do
6
+ subject(:videos) { Yt::Collections::Videos.new }
7
+
8
+ specify 'without :where conditions, returns all YouTube videos', :ruby2 do
9
+ expect(videos.size).to be > 100_000
10
+ end
11
+
12
+ specify 'with a query term, only returns some YouTube videos' do
13
+ expect(videos.where(q: 'Fullscreen CreatorPlatform', video_duration: :long).size).to be < 100_000
14
+ end
15
+ end
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.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
@@ -250,6 +250,7 @@ files:
250
250
  - spec/requests/as_server_app/playlist_spec.rb
251
251
  - spec/requests/as_server_app/resource_spec.rb
252
252
  - spec/requests/as_server_app/video_spec.rb
253
+ - spec/requests/as_server_app/videos_spec.rb
253
254
  - spec/requests/unauthenticated/video_spec.rb
254
255
  - spec/spec_helper.rb
255
256
  - spec/support/fail_matcher.rb
@@ -334,6 +335,7 @@ test_files:
334
335
  - spec/requests/as_server_app/playlist_spec.rb
335
336
  - spec/requests/as_server_app/resource_spec.rb
336
337
  - spec/requests/as_server_app/video_spec.rb
338
+ - spec/requests/as_server_app/videos_spec.rb
337
339
  - spec/requests/unauthenticated/video_spec.rb
338
340
  - spec/spec_helper.rb
339
341
  - spec/support/fail_matcher.rb