media_embed 0.0.3 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a90e907b4cd3e650fc771df66cb3b58715974d90
4
- data.tar.gz: 57cf3b73c7cfe00fa5698a7db20fd93a9939a709
3
+ metadata.gz: c5cb58d16191f7f6151840317db341ddcb4ce0dd
4
+ data.tar.gz: 97f92b58db2022d48b86e11359598eddd27b20e4
5
5
  SHA512:
6
- metadata.gz: 195eef0aa0b75c958f777f59b379830ab2104de578ce2a1db66d898a92eef972012bf3204fc13b8ab4ecf228d4f1f0600c8ce451ad678e9fa6fc3b384df9e6ea
7
- data.tar.gz: c9190bfe497e911a109138e3d5e1731ca59d1f50d2f82668e51834b74e4d546964ba033fa3e6623a07fff7cb5c992c9e7637f86a33f74ac01cdcca48b1fb6588
6
+ metadata.gz: 848b6d1303342262100c618e59d58c86371482aa5c8a93f39378570d337fb3a3b806be604be77f17bf0a1a16a545535204760808785d0cb11a7bf9750a8e3890
7
+ data.tar.gz: a042811c131d08d0a184aa23dcdef1f3be1c17ec4f1357066960c22bce73902c14230923e4bb81f79048761fb7def0cc109092d2c38e81d19f0efe3badecb0d2
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module MediaEmbed
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,21 +1,18 @@
1
1
  module MediaEmbed
2
2
  class Video
3
- def self.youtube_template(code)
4
- source = "http://youtube.com/embed/#{code}"
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
- source = "//player.vimeo.com/video/#{code}"
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.iframe_structure(source, options = [])
18
- "<iframe src='#{source}' frameborder='0' #{options.join(' ')} allowfullscreen></iframe>"
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
@@ -203,3 +203,28 @@ MediaEmbedTest: test_it_has_a_version_number
203
203
  MediaEmbedTest: test_truth
204
204
  --------------------------
205
205
   (0.0ms) rollback transaction
206
+  (0.1ms) begin transaction
207
+ --------------------------------------------
208
+ MediaEmbedTest: test_it_has_a_version_number
209
+ --------------------------------------------
210
+  (0.1ms) rollback transaction
211
+  (0.1ms) begin transaction
212
+ --------------------------
213
+ MediaEmbedTest: test_truth
214
+ --------------------------
215
+  (0.0ms) rollback transaction
216
+  (0.0ms) begin transaction
217
+ ---------------------------------------------------------------
218
+ HandlerTest: test_it_extracts_codes_from_all_youtube_structures
219
+ ---------------------------------------------------------------
220
+  (0.0ms) rollback transaction
221
+  (0.1ms) begin transaction
222
+ ------------------------------------------------------------
223
+ HandlerTest: test_it_extracts_code_from_all_vimeo_structures
224
+ ------------------------------------------------------------
225
+  (0.0ms) rollback transaction
226
+  (0.1ms) begin transaction
227
+ -----------------------------------------------------------
228
+ HandlerTest: test_it_extracts_code_for_soundcloud_structure
229
+ -----------------------------------------------------------
230
+  (0.0ms) rollback transaction
@@ -1 +1 @@
1
- 72525
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.0.3
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-05-26 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails