onebox 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9568d4cc0a0bf144ffe61a5b97973f44e41c941f
4
- data.tar.gz: 098b322abd9e0b5941124a22d14e83be9a29d2e6
3
+ metadata.gz: 94fc556b352ee73d791b1794fbfbacad4ceb28ba
4
+ data.tar.gz: ee33834b15da1ec2701a578019b8c5586e4d0f4c
5
5
  SHA512:
6
- metadata.gz: 801755ee7531576bd9e006f06563d97d2540ed58be765668bef94d7c56a61e345a5579450089c86566cdb2fdd45c62a8c15732a9f5fdc14b8ebc4f27c939fb90
7
- data.tar.gz: ed306b576710b9b63a792b8964b2a91ee3b822fc142dd75c71501f9db9216d3e14c5cbf554aa091248d59d1704eab05bf96684f691e1ed51b2cb9f3b7fe9f419
6
+ metadata.gz: fdcf8a62d60808afc285b24f790730c7a71f0b2638589149c9d50aa610c90b249ac74e48f527da27bad924f8eedfbc157c0c417749831f35997d73133f0fd065
7
+ data.tar.gz: c41699247ec93be5472e48d2ca39c274499446219bed35257d3e8b97a27bc84d6f0c9b64721be19c3481013a10ec8063dab6ea579da165e04f6e97900395c37a
@@ -21,17 +21,13 @@ module Onebox
21
21
 
22
22
  def options=(opt)
23
23
  return @options if opt.nil? #make sure options provided
24
- if opt.instance_of? OpenStruct
25
- @options = @options.merge(opt.to_h)
26
- else
27
- @options = @options.merge(opt)
28
- end
24
+ opt = opt.to_h if opt.instance_of?(OpenStruct)
25
+ @options.merge!(opt)
29
26
  @options
30
27
  end
31
28
 
32
29
 
33
30
  def initialize(link, cache = nil, timeout = nil)
34
-
35
31
  @options = DEFAULT
36
32
  class_name = self.class.name.split("::").last.to_s
37
33
  self.options = Onebox.options[class_name] || {} #Set the engine options extracted from global options.
@@ -168,3 +164,5 @@ require_relative "engine/giphy_onebox"
168
164
  require_relative "engine/gfycat_onebox"
169
165
  require_relative "engine/vimeo_onebox"
170
166
  require_relative "engine/steam_store_onebox"
167
+ require_relative "engine/sketchfab_onebox"
168
+ require_relative "engine/audioboom_onebox"
@@ -0,0 +1,27 @@
1
+ module Onebox
2
+ module Engine
3
+ class AudioboomOnebox
4
+ include Engine
5
+ include StandardEmbed
6
+
7
+ matches_regexp(/^https?:\/\/audioboom\.com\/posts\/\d+/)
8
+ always_https
9
+
10
+ def placeholder_html
11
+ oembed = get_oembed
12
+
13
+ # we want the image to have the same dimensions as the embedded html
14
+
15
+ <<-HTML
16
+ <img src="#{oembed[:thumbnail_url]}" style="max-width: #{oembed[:width]}px; max-height: #{oembed[:height]}px;">
17
+ HTML
18
+ end
19
+
20
+ def to_html
21
+ oembed = get_oembed
22
+ oembed[:html]
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -5,6 +5,7 @@ module Onebox
5
5
  include StandardEmbed
6
6
 
7
7
  matches_regexp(/^https?:\/\/gfycat\.com\//)
8
+ always_https
8
9
 
9
10
  def to_html
10
11
  oembed = get_oembed
@@ -5,6 +5,7 @@ module Onebox
5
5
  include StandardEmbed
6
6
 
7
7
  matches_regexp(/^https?:\/\/(giphy\.com\/gifs|gph\.is)\//)
8
+ always_https
8
9
 
9
10
  def to_html
10
11
  oembed = get_oembed
@@ -0,0 +1,33 @@
1
+ module Onebox
2
+ module Engine
3
+ class SketchFabOnebox
4
+ include Engine
5
+ include StandardEmbed
6
+
7
+ matches_regexp(/^https?:\/\/sketchfab\.com\/models\/[a-z0-9]{32}/)
8
+ always_https
9
+
10
+ def to_html
11
+ opengraph = get_opengraph
12
+
13
+ src = opengraph[:video_url].gsub("?autostart=1", "")
14
+
15
+ <<-HTML
16
+ <iframe src="#{src}"
17
+ width="#{opengraph[:video_width]}"
18
+ height="#{opengraph[:video_height]}"
19
+ scrolling="no"
20
+ frameborder="0"
21
+ allowfullscreen>
22
+ </iframe>
23
+ HTML
24
+ end
25
+
26
+ def placeholder_html
27
+ opengraph = get_opengraph
28
+ "<img src='#{opengraph[:image]}'>"
29
+ end
30
+
31
+ end
32
+ end
33
+ end
@@ -22,7 +22,7 @@ module Onebox
22
22
  add_oembed_provider(/www\.meetup\.com\//, 'http://api.meetup.com/oembed')
23
23
 
24
24
  def always_https?
25
- WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts)
25
+ WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts) || super
26
26
  end
27
27
 
28
28
  def raw
@@ -43,7 +43,6 @@ module Onebox
43
43
  # for channel pages
44
44
  html = Onebox::Engine::WhitelistedGenericOnebox.new(@url, @cache, @timeout).to_html
45
45
  return if Onebox::Helpers.blank?(html)
46
- html.gsub!("http:", "https:")
47
46
  html.gsub!(/['"]\/\//, "https://")
48
47
  html
49
48
  end
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.6.1"
2
+ VERSION = "1.6.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-11-29 00:00:00.000000000 Z
13
+ date: 2016-11-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -302,6 +302,7 @@ files:
302
302
  - lib/onebox/engine.rb
303
303
  - lib/onebox/engine/amazon_onebox.rb
304
304
  - lib/onebox/engine/audio_onebox.rb
305
+ - lib/onebox/engine/audioboom_onebox.rb
305
306
  - lib/onebox/engine/douban_onebox.rb
306
307
  - lib/onebox/engine/gfycat_onebox.rb
307
308
  - lib/onebox/engine/giphy_onebox.rb
@@ -320,6 +321,7 @@ files:
320
321
  - lib/onebox/engine/json.rb
321
322
  - lib/onebox/engine/pastebin_onebox.rb
322
323
  - lib/onebox/engine/pubmed_onebox.rb
324
+ - lib/onebox/engine/sketchfab_onebox.rb
323
325
  - lib/onebox/engine/slides_onebox.rb
324
326
  - lib/onebox/engine/soundcloud_onebox.rb
325
327
  - lib/onebox/engine/stack_exchange_onebox.rb