Skip to content

Commit

Permalink
Sort Channel#videos by most recent first
Browse files Browse the repository at this point in the history
The default for YouTube is instead to sort by relevance
https://developers.google.com/youtube/v3/docs/search/list

> The order parameter specifies the method that will be used to order resources in the API response. The default value is relevance.
> Acceptable values are:
> date – Resources are sorted in reverse chronological order based on the date they were created.
> rating – Resources are sorted from highest to lowest rating.
> relevance – Resources are sorted based on their relevance to the search query. This is the default value for this parameter.
> title – Resources are sorted alphabetically by title.
> videoCount – Channels are sorted in descending order of their number of uploaded videos.
> viewCount – Resources are sorted from highest to lowest number of views.
  • Loading branch information
claudiob committed Jun 26, 2014
1 parent 73728ce commit 7ee5859
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
yt (0.7.2)
yt (0.7.3)
activesupport

GEM
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Expand Up @@ -9,6 +9,7 @@ v0.7 - 2014/06/18
* More snippet methods for PlaylistItem (channel_id, channel_title, playlist_id, video_id)
* More status methods for PlaylistItem (privacy_status, public?, private?, unlisted?)
* Add video.update to update title, description, tags and categoryId of a video
* Sort channel.videos by most recent first

v0.6 - 2014/06/05
-----------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -431,7 +431,7 @@ To install on your system, run

To use inside a bundled Ruby project, add this line to the Gemfile:

gem 'yt', '~> 0.7.2'
gem 'yt', '~> 0.7.3'

Since the gem follows [Semantic Versioning](http://semver.org),
indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
Expand Down
3 changes: 2 additions & 1 deletion lib/yt/collections/videos.rb
Expand Up @@ -28,8 +28,9 @@ def list_params
end

def videos_params
params = {type: :video, maxResults: 50, part: 'snippet', order: 'date'}
@extra_params ||= {}
{type: :video, maxResults: 50, part: 'snippet'}.merge @extra_params
params.merge @extra_params
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/yt/version.rb
@@ -1,3 +1,3 @@
module Yt
VERSION = '0.7.2'
VERSION = '0.7.3'
end

0 comments on commit 7ee5859

Please sign in to comment.