yourub 1.0.8 → 1.0.9
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 +4 -4
- data/README.md +2 -2
- data/lib/yourub/validator.rb +1 -1
- data/lib/yourub/version.rb +1 -1
- data/spec/client_spec.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e9778e059d14cc1e3a3dfdef72de7b70d29863
|
4
|
+
data.tar.gz: fe5cbe47a3a4da2795895c91add5559acdba77be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22e00c1b0c489180ee6cb9a4e9aacd0358113257823c802d90d350970e5f6dab901118e13d3d7befae4418cac009a7be6b1312927f33af33be6449143be111b1
|
7
|
+
data.tar.gz: 19db03890866df4fbd49504f72a1af4b24c5e78e62965ddbff9da202a7f9a48c78a933d288ae08f2b2a8f4f8b2b6e58ed630b45c83b5e1888db1d41aea8bb854
|
data/README.md
CHANGED
@@ -45,9 +45,9 @@ test:
|
|
45
45
|
|
46
46
|
`:id` Sting, a valid youtube video id, example `NisCkxU544c`. If this parameter is set, tha others are ignored
|
47
47
|
|
48
|
-
`:country` String, one or more alpha-2 country codes [ISO 3166-1](http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm), example `US` or `IT, DE`
|
48
|
+
`:country` String, one or more alpha-2 country codes [ISO 3166-1](http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm), example `US` or `IT, DE`. The default one is `US`
|
49
49
|
|
50
|
-
`:category` String, example `comedy`
|
50
|
+
`:category` String, example `comedy`. It accept the wildcard `all`, that retrieves videos for all the category for the given nation, or the default one (US) if no one is given
|
51
51
|
|
52
52
|
`:count_filter` Hash, example `{views: ">= 100"}` or `{views: "== 600"}`
|
53
53
|
|
data/lib/yourub/validator.rb
CHANGED
@@ -74,7 +74,7 @@ module Yourub
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def valid_category(categories, selected_category)
|
77
|
-
|
77
|
+
return categories if selected_category == 'all'
|
78
78
|
categories = categories.select {|k| k.has_value?(selected_category.downcase)}
|
79
79
|
if categories.first.nil?
|
80
80
|
raise ArgumentError.new(
|
data/lib/yourub/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'byebug'
|
1
2
|
require 'yourub'
|
2
3
|
|
3
4
|
describe Yourub::Client do
|
@@ -24,12 +25,17 @@ describe Yourub::Client do
|
|
24
25
|
it "retrieves videos that have more than 100 views" do
|
25
26
|
filter = {views: ">= 100"}
|
26
27
|
subject.search(country: "US", category: "Sports", count_filter: filter)
|
27
|
-
expect(subject.videos).
|
28
|
+
expect(subject.videos).to_not be_empty
|
29
|
+
end
|
30
|
+
|
31
|
+
it "retrieves videos for all the categories" do
|
32
|
+
subject.search(country: "US", category: "all")
|
33
|
+
expect(subject.videos).to_not be_empty
|
28
34
|
end
|
29
35
|
|
30
36
|
it "accept an 'order' parameter within the others" do
|
31
37
|
subject.search(country: "US", category: "Sports", order: 'date')
|
32
|
-
expect(subject.videos).
|
38
|
+
expect(subject.videos).to_not be_empty
|
33
39
|
end
|
34
40
|
|
35
41
|
it "retrieves 5 videos for each given category" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yourub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide Prati
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|