yourub 1.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -6
- data/Gemfile +15 -1
- data/README.md +36 -25
- data/Rakefile +18 -0
- data/config/yourub.yml +1 -1
- data/lib/yourub/client.rb +38 -10
- data/lib/yourub/config.rb +34 -1
- data/lib/yourub/default.rb +1 -1
- data/lib/yourub/meta_search.rb +134 -0
- data/lib/yourub/rest/api.rb +6 -0
- data/lib/yourub/rest/categories.rb +39 -0
- data/lib/yourub/rest/request.rb +22 -4
- data/lib/yourub/rest/search.rb +11 -149
- data/lib/yourub/rest/videos.rb +38 -0
- data/lib/yourub/result.rb +41 -0
- data/lib/yourub/validator.rb +4 -11
- data/lib/yourub/version.rb +3 -3
- data/lib/yourub.rb +2 -3
- data/spec/fixtures/categories_list.json +1 -0
- data/spec/fixtures/categories_list_formatted.json +1 -0
- data/spec/fixtures/search_list.json +1 -0
- data/spec/fixtures/single_video.json +1 -0
- data/spec/fixtures/video_with_200_views.json +1 -0
- data/spec/fixtures/videos_list.json +1 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/shared_context_result_load_fixture.rb +11 -0
- data/spec/support/shared_context_result_search_list.rb +16 -0
- data/spec/support/shared_context_result_search_list_with_single_videos.rb +24 -0
- data/spec/support/shared_context_stub_client_connection.rb +18 -0
- data/spec/yourub/client_spec.rb +29 -72
- data/spec/yourub/count_filter_spec.rb +4 -5
- data/spec/yourub/count_spec.rb +39 -0
- data/spec/yourub/integration.rb +105 -0
- data/spec/yourub/meta_search_spec.rb +141 -0
- data/spec/yourub/rest/categories_spec.rb +33 -0
- data/spec/yourub/rest/request_spec.rb +32 -0
- data/spec/yourub/rest/videos_spec.rb +24 -0
- data/spec/yourub/validator_spec.rb +54 -57
- data/yourub.gemspec +0 -5
- metadata +39 -66
- data/lib/yourub/cli.rb +0 -20
- data/lib/yourub/reader.rb +0 -21
- data/spec/fixtures/categories.json +0 -0
- data/spec/fixtures/category.json +0 -0
- data/spec/helper.rb +0 -26
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davide Prati
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.7'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: thor
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.18'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.18'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,48 +38,6 @@ dependencies:
|
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '1.3'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: byebug
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.1'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.1'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.1'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.1'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.14'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.14'
|
97
41
|
description: Youtube API v3 parser
|
98
42
|
email:
|
99
43
|
- 'lastexxit@gmail.com '
|
@@ -110,25 +54,40 @@ files:
|
|
110
54
|
- bin/yourub
|
111
55
|
- config/yourub.yml
|
112
56
|
- lib/yourub.rb
|
113
|
-
- lib/yourub/cli.rb
|
114
57
|
- lib/yourub/client.rb
|
115
58
|
- lib/yourub/config.rb
|
116
59
|
- lib/yourub/count_filter.rb
|
117
60
|
- lib/yourub/default.rb
|
118
61
|
- lib/yourub/logger.rb
|
62
|
+
- lib/yourub/meta_search.rb
|
119
63
|
- lib/yourub/railtie.rb
|
120
|
-
- lib/yourub/reader.rb
|
121
64
|
- lib/yourub/rest/api.rb
|
65
|
+
- lib/yourub/rest/categories.rb
|
122
66
|
- lib/yourub/rest/request.rb
|
123
67
|
- lib/yourub/rest/search.rb
|
68
|
+
- lib/yourub/rest/videos.rb
|
69
|
+
- lib/yourub/result.rb
|
124
70
|
- lib/yourub/validator.rb
|
125
71
|
- lib/yourub/version.rb
|
126
|
-
- spec/fixtures/
|
127
|
-
- spec/fixtures/
|
128
|
-
- spec/
|
72
|
+
- spec/fixtures/categories_list.json
|
73
|
+
- spec/fixtures/categories_list_formatted.json
|
74
|
+
- spec/fixtures/search_list.json
|
75
|
+
- spec/fixtures/single_video.json
|
76
|
+
- spec/fixtures/video_with_200_views.json
|
77
|
+
- spec/fixtures/videos_list.json
|
129
78
|
- spec/spec_helper.rb
|
79
|
+
- spec/support/shared_context_result_load_fixture.rb
|
80
|
+
- spec/support/shared_context_result_search_list.rb
|
81
|
+
- spec/support/shared_context_result_search_list_with_single_videos.rb
|
82
|
+
- spec/support/shared_context_stub_client_connection.rb
|
130
83
|
- spec/yourub/client_spec.rb
|
131
84
|
- spec/yourub/count_filter_spec.rb
|
85
|
+
- spec/yourub/count_spec.rb
|
86
|
+
- spec/yourub/integration.rb
|
87
|
+
- spec/yourub/meta_search_spec.rb
|
88
|
+
- spec/yourub/rest/categories_spec.rb
|
89
|
+
- spec/yourub/rest/request_spec.rb
|
90
|
+
- spec/yourub/rest/videos_spec.rb
|
132
91
|
- spec/yourub/validator_spec.rb
|
133
92
|
- yourub.gemspec
|
134
93
|
- yourub.sublime-project
|
@@ -157,10 +116,24 @@ signing_key:
|
|
157
116
|
specification_version: 4
|
158
117
|
summary: Yourub is a gem that search videos on youtebe using the YouTube API v3
|
159
118
|
test_files:
|
160
|
-
- spec/fixtures/
|
161
|
-
- spec/fixtures/
|
162
|
-
- spec/
|
119
|
+
- spec/fixtures/categories_list.json
|
120
|
+
- spec/fixtures/categories_list_formatted.json
|
121
|
+
- spec/fixtures/search_list.json
|
122
|
+
- spec/fixtures/single_video.json
|
123
|
+
- spec/fixtures/video_with_200_views.json
|
124
|
+
- spec/fixtures/videos_list.json
|
163
125
|
- spec/spec_helper.rb
|
126
|
+
- spec/support/shared_context_result_load_fixture.rb
|
127
|
+
- spec/support/shared_context_result_search_list.rb
|
128
|
+
- spec/support/shared_context_result_search_list_with_single_videos.rb
|
129
|
+
- spec/support/shared_context_stub_client_connection.rb
|
164
130
|
- spec/yourub/client_spec.rb
|
165
131
|
- spec/yourub/count_filter_spec.rb
|
132
|
+
- spec/yourub/count_spec.rb
|
133
|
+
- spec/yourub/integration.rb
|
134
|
+
- spec/yourub/meta_search_spec.rb
|
135
|
+
- spec/yourub/rest/categories_spec.rb
|
136
|
+
- spec/yourub/rest/request_spec.rb
|
137
|
+
- spec/yourub/rest/videos_spec.rb
|
166
138
|
- spec/yourub/validator_spec.rb
|
139
|
+
has_rdoc:
|
data/lib/yourub/cli.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
module Yourub
|
4
|
-
class CLI < Thor
|
5
|
-
desc 'hello NAME', 'Display greeting with given NAME'
|
6
|
-
def hello(name)
|
7
|
-
puts "Hello #{name}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'nations', 'display available nations in youtube standard feed'
|
11
|
-
def nations
|
12
|
-
Yourub::Search::NATION
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'feed_types', 'display available types in youtube standard feed'
|
16
|
-
def feed_types
|
17
|
-
Yourub.types
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/yourub/reader.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Yourub
|
2
|
-
module Reader
|
3
|
-
class << self
|
4
|
-
def parse_videos(videos)
|
5
|
-
res = JSON.parse(videos.data.to_json)['items']
|
6
|
-
return nil if res.empty?
|
7
|
-
res
|
8
|
-
end
|
9
|
-
|
10
|
-
def parse_entry(entry)
|
11
|
-
video_id = entry["id"]["videoId"] || entry['id']
|
12
|
-
{
|
13
|
-
'id' => video_id,
|
14
|
-
'title' => entry['snippet']['title'],
|
15
|
-
'thumb' => entry['snippet']['thumbnails']['default']['url'],
|
16
|
-
'url' => 'https://www.youtube.com/watch?v='<< video_id
|
17
|
-
}
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
File without changes
|
data/spec/fixtures/category.json
DELETED
File without changes
|
data/spec/helper.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#require 'webmock/rspec'
|
2
|
-
|
3
|
-
#WebMock.disable_net_connect!(allow_localhost: true)
|
4
|
-
RSpec.configure do |c|
|
5
|
-
c.filter_run_including :focus => true
|
6
|
-
end
|
7
|
-
|
8
|
-
def a_get(path)
|
9
|
-
a_request(:get, Yourub::REST::Request::BASE_URL + path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def stub_get(path)
|
13
|
-
stub_request(:get, Yourub::REST::Request::BASE_URL + path)
|
14
|
-
end
|
15
|
-
|
16
|
-
def capture_warning
|
17
|
-
begin
|
18
|
-
old_stderr = $stderr
|
19
|
-
$stderr = StringIO.new
|
20
|
-
yield
|
21
|
-
result = $stderr.string
|
22
|
-
ensure
|
23
|
-
$stderr = old_stderr
|
24
|
-
end
|
25
|
-
result
|
26
|
-
end
|