media_embed 0.0.3 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/media_embed/handler.rb +3 -3
- data/lib/media_embed/version.rb +1 -1
- data/lib/media_embed/video.rb +7 -10
- data/test/dummy/log/development.log +40 -0
- data/test/dummy/log/test.log +25 -0
- data/test/dummy/tmp/pids/server.pid +1 -1
- 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: c5cb58d16191f7f6151840317db341ddcb4ce0dd
|
4
|
+
data.tar.gz: 97f92b58db2022d48b86e11359598eddd27b20e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 848b6d1303342262100c618e59d58c86371482aa5c8a93f39378570d337fb3a3b806be604be77f17bf0a1a16a545535204760808785d0cb11a7bf9750a8e3890
|
7
|
+
data.tar.gz: a042811c131d08d0a184aa23dcdef1f3be1c17ec4f1357066960c22bce73902c14230923e4bb81f79048761fb7def0cc109092d2c38e81d19f0efe3badecb0d2
|
data/lib/media_embed/handler.rb
CHANGED
@@ -2,11 +2,11 @@ module MediaEmbed
|
|
2
2
|
module Handler
|
3
3
|
CODE = -1
|
4
4
|
|
5
|
-
def embed(url)
|
6
|
-
return template_for(url)
|
5
|
+
def embed(url, options = {})
|
6
|
+
return template_for(url, options)
|
7
7
|
end
|
8
8
|
|
9
|
-
def template_for(url)
|
9
|
+
def template_for(url, options = {})
|
10
10
|
template = if match = youtube?(url)
|
11
11
|
Video.youtube_template(match[CODE])
|
12
12
|
elsif match = vimeo?(url)
|
data/lib/media_embed/version.rb
CHANGED
data/lib/media_embed/video.rb
CHANGED
@@ -1,21 +1,18 @@
|
|
1
1
|
module MediaEmbed
|
2
2
|
class Video
|
3
|
-
def self.youtube_template(code)
|
4
|
-
|
5
|
-
|
6
|
-
return iframe_structure(source)
|
3
|
+
def self.youtube_template(code, options = {})
|
4
|
+
return iframe("//www.youtube.com/embed/#{code}/enablejsapi=1", options)
|
7
5
|
end
|
8
6
|
|
9
|
-
def self.vimeo_template(code)
|
10
|
-
|
11
|
-
|
12
|
-
return iframe_structure(source, ['webkitallowfullscreen', 'mozallowfullscreen'])
|
7
|
+
def self.vimeo_template(code, options = {})
|
8
|
+
return iframe("//player.vimeo.com/video/#{code}", options)
|
13
9
|
end
|
14
10
|
|
15
11
|
private
|
16
12
|
|
17
|
-
def self.
|
18
|
-
"<iframe src='#{source}'
|
13
|
+
def self.iframe(source, options = {})
|
14
|
+
"<iframe src='#{source}' #{options.map { |key, value| "#{key}='#{value}'" }.join(' ')}></iframe>"
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
18
|
+
|
@@ -600,3 +600,43 @@ Started GET "/assets/home.self-b60acab5af8d245ed2b3012f77d11d8d207d8eada27756bad
|
|
600
600
|
|
601
601
|
|
602
602
|
Started GET "/assets/home.self-19a187bec6cdb96d6de80a61c16c857c613536adf9138476bd367db38d282635.js?body=1" for ::1 at 2016-05-26 16:11:15 -0400
|
603
|
+
|
604
|
+
|
605
|
+
Started GET "/" for ::1 at 2016-06-09 12:19:03 -0400
|
606
|
+
Processing by HomeController#index as HTML
|
607
|
+
Rendered home/index.html.erb within layouts/application (6.0ms)
|
608
|
+
Completed 500 Internal Server Error in 20ms (ActiveRecord: 0.0ms)
|
609
|
+
|
610
|
+
ActionView::Template::Error (undefined method `content_tag' for MediaEmbed::Video:Class):
|
611
|
+
4: <ul>
|
612
|
+
5: <li>
|
613
|
+
6: <h5>youtube.com/watch?v=CODE</h5>
|
614
|
+
7: <%= embed("https://www.youtube.com/watch?v=_mwcreHuqNA").html_safe %>
|
615
|
+
8: </li>
|
616
|
+
9:
|
617
|
+
10: <li>
|
618
|
+
app/views/home/index.html.erb:7:in `_app_views_home_index_html_erb__3338150107652364781_70323665144060'
|
619
|
+
|
620
|
+
|
621
|
+
Rendered /Users/wendybeth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_source.erb (10.5ms)
|
622
|
+
Rendered /Users/wendybeth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.9ms)
|
623
|
+
Rendered /Users/wendybeth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (12.4ms)
|
624
|
+
Rendered /Users/wendybeth/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (80.5ms)
|
625
|
+
|
626
|
+
|
627
|
+
Started GET "/" for ::1 at 2016-06-09 12:26:39 -0400
|
628
|
+
Processing by HomeController#index as HTML
|
629
|
+
Rendered home/index.html.erb within layouts/application (2.3ms)
|
630
|
+
Completed 200 OK in 284ms (Views: 284.0ms | ActiveRecord: 0.0ms)
|
631
|
+
|
632
|
+
|
633
|
+
Started GET "/assets/home.self-b60acab5af8d245ed2b3012f77d11d8d207d8eada27756badaf4ef05770d60f6.css?body=1" for ::1 at 2016-06-09 12:26:40 -0400
|
634
|
+
|
635
|
+
|
636
|
+
Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-06-09 12:26:40 -0400
|
637
|
+
|
638
|
+
|
639
|
+
Started GET "/assets/home.self-19a187bec6cdb96d6de80a61c16c857c613536adf9138476bd367db38d282635.js?body=1" for ::1 at 2016-06-09 12:26:40 -0400
|
640
|
+
|
641
|
+
|
642
|
+
Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-06-09 12:26:40 -0400
|
data/test/dummy/log/test.log
CHANGED
@@ -203,3 +203,28 @@ MediaEmbedTest: test_it_has_a_version_number
|
|
203
203
|
MediaEmbedTest: test_truth
|
204
204
|
--------------------------
|
205
205
|
[1m[35m (0.0ms)[0m rollback transaction
|
206
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
207
|
+
--------------------------------------------
|
208
|
+
MediaEmbedTest: test_it_has_a_version_number
|
209
|
+
--------------------------------------------
|
210
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
211
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
212
|
+
--------------------------
|
213
|
+
MediaEmbedTest: test_truth
|
214
|
+
--------------------------
|
215
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
216
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
217
|
+
---------------------------------------------------------------
|
218
|
+
HandlerTest: test_it_extracts_codes_from_all_youtube_structures
|
219
|
+
---------------------------------------------------------------
|
220
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
221
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
222
|
+
------------------------------------------------------------
|
223
|
+
HandlerTest: test_it_extracts_code_from_all_vimeo_structures
|
224
|
+
------------------------------------------------------------
|
225
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
226
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
227
|
+
-----------------------------------------------------------
|
228
|
+
HandlerTest: test_it_extracts_code_for_soundcloud_structure
|
229
|
+
-----------------------------------------------------------
|
230
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
59917
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: media_embed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WendyBeth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|