search_yt 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +56 -0
- data/Rakefile +32 -0
- data/app/assets/config/search_yt_manifest.js +0 -0
- data/config/routes.rb +2 -0
- data/lib/generators/youtube/USAGE +10 -0
- data/lib/generators/youtube/search_generator.rb +11 -0
- data/lib/generators/youtube/templates/index_view_template.tt +4 -0
- data/lib/generators/youtube/templates/search_controller_template.tt +4 -0
- data/lib/generators/youtube/templates/search_template.tt +35 -0
- data/lib/search_yt.rb +5 -0
- data/lib/search_yt/engine.rb +5 -0
- data/lib/search_yt/version.rb +3 -0
- data/lib/tasks/search_yt_tasks.rake +4 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 00eff627a24918a38f12b5d289ebc4e662f9ff7999595e2208cc06cefa6597e5
|
4
|
+
data.tar.gz: bf5b738db15c9cb2c77a7991b47becddeb3ece814249feb657427cbd35355536
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d85399cf8b0e1af90179287d5e57a1cee9d73e327c8d94cf6442a347bbed1bf5ecb6c2f4d873f0c9b1bd18996b902bde063afda97406cef4cd1f578dc961102c
|
7
|
+
data.tar.gz: 2347307fe8f6aeb4723893cf6393b5e1a97e852fb7732c6da674b319c7d6001186a4ebd61ac0f62aee8eac4b0c9c95d399ef3e373c57acce40398c2b3443c064
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Felipe Llerena
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# SearchYt
|
2
|
+
|
3
|
+
Welcome to your new gem!
|
4
|
+
|
5
|
+
This generates files that bases its functionality on the search of YouTube videos through its API
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'search_yt'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install search_yt
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Add in Gemfile: ```
|
26
|
+
gem 'jquery-rails'
|
27
|
+
```
|
28
|
+
|
29
|
+
Add ```//= require jquery``` in app/assets/javascripts/application.js
|
30
|
+
|
31
|
+
Add ```<script src="https://apis.google.com/js/client.js?onload=onClientLoad" type="text/javascript"></script>``` in app/views/layouts/application.html.erb
|
32
|
+
|
33
|
+
To execute the functionality of this gem you should use:
|
34
|
+
|
35
|
+
$ rails generate youtube:search
|
36
|
+
|
37
|
+
This will generate:
|
38
|
+
app / assets / javascripts / search_youtube / search.js
|
39
|
+
app / controllers / search_controller.rb
|
40
|
+
app / views / search_yt / index.html.erb
|
41
|
+
|
42
|
+
|
43
|
+
Add in ``` config/routes.rb ``` the next line:
|
44
|
+
``` get 'search/index' ```
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Training-Sena/search_yt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
53
|
+
|
54
|
+
## Code of Conduct
|
55
|
+
|
56
|
+
Everyone interacting in the SearchYt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Training-Sena/search_yt/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'SearchYt'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
task default: :test
|
File without changes
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
This generates files that bases its functionality on the search of YouTube videos through its API
|
3
|
+
|
4
|
+
Example:
|
5
|
+
rails generate youtube:search
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
app/assets/javascripts/search_youtube/search.js
|
9
|
+
app/controllers/search_controller.rb
|
10
|
+
app/views/search_yt/index.html.erb
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Youtube
|
2
|
+
class SearchGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def generate_jsfile
|
6
|
+
copy_file "search_template.tt", "app/assets/javascripts/search.js"
|
7
|
+
copy_file "search_controller_template.tt", "app/controllers/search_controller.rb"
|
8
|
+
copy_file "index_view_template.tt", "app/views/search/index.html.erb"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
function onClientLoad() {
|
2
|
+
gapi.client.load('youtube', 'v3', onYouTubeApiLoad);
|
3
|
+
}
|
4
|
+
|
5
|
+
function onYouTubeApiLoad() {
|
6
|
+
gapi.client.setApiKey('AIzaSyAWhX3xLCfnJ-U0HEPo7R0Zc-5J9jCJoXc');
|
7
|
+
}
|
8
|
+
|
9
|
+
function searchVideo() {
|
10
|
+
var query = document.getElementById('query').value;
|
11
|
+
var request = gapi.client.youtube.search.list({
|
12
|
+
part: 'snippet',
|
13
|
+
type: 'playlist, video',
|
14
|
+
maxResults: '49',
|
15
|
+
q:query
|
16
|
+
});
|
17
|
+
request.execute(onSearchResponse);
|
18
|
+
}
|
19
|
+
|
20
|
+
var ytplayer;
|
21
|
+
function onYouTubeIframeAPIReady() {
|
22
|
+
ytplayer = new YT.Player('spherical-video-player', {
|
23
|
+
height: '30',
|
24
|
+
width: '640',
|
25
|
+
videoId: 'FAtdv94yzp4',
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
function onSearchResponse(response) {
|
31
|
+
$("#response").html('');
|
32
|
+
response.items.forEach(function(e){
|
33
|
+
$("#response").append('<iframe id="ytplayer" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/'+ e.id.videoId +'"><img width="'+ e.snippet.thumbnails.default.width + '"src="'+ e.snippet.thumbnails.default.url +'" height="'+ e.snippet.thumbnails.default.height +'"></iframe>');
|
34
|
+
});
|
35
|
+
}
|
data/lib/search_yt.rb
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: search_yt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Training Koombea Backend
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jquery-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.3'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 4.3.3
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '4.3'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 4.3.3
|
61
|
+
description: This generates files that bases its functionality on the search of YouTube
|
62
|
+
videos through its API
|
63
|
+
email:
|
64
|
+
- felipe.llerena@koombea.com, kevin.diaz@koombea.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- MIT-LICENSE
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- app/assets/config/search_yt_manifest.js
|
73
|
+
- config/routes.rb
|
74
|
+
- lib/generators/youtube/USAGE
|
75
|
+
- lib/generators/youtube/search_generator.rb
|
76
|
+
- lib/generators/youtube/templates/index_view_template.tt
|
77
|
+
- lib/generators/youtube/templates/search_controller_template.tt
|
78
|
+
- lib/generators/youtube/templates/search_template.tt
|
79
|
+
- lib/search_yt.rb
|
80
|
+
- lib/search_yt/engine.rb
|
81
|
+
- lib/search_yt/version.rb
|
82
|
+
- lib/tasks/search_yt_tasks.rake
|
83
|
+
homepage: https://github.com/Training-Sena/search_yt
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.7.5
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Find Youtube Videos from API
|
107
|
+
test_files: []
|