onebox 1.6.1 → 1.6.2
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 +4 -4
- data/lib/onebox/engine.rb +4 -6
- data/lib/onebox/engine/audioboom_onebox.rb +27 -0
- data/lib/onebox/engine/gfycat_onebox.rb +1 -0
- data/lib/onebox/engine/giphy_onebox.rb +1 -0
- data/lib/onebox/engine/sketchfab_onebox.rb +33 -0
- data/lib/onebox/engine/standard_embed.rb +1 -1
- data/lib/onebox/engine/youtube_onebox.rb +0 -1
- data/lib/onebox/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94fc556b352ee73d791b1794fbfbacad4ceb28ba
|
4
|
+
data.tar.gz: ee33834b15da1ec2701a578019b8c5586e4d0f4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdcf8a62d60808afc285b24f790730c7a71f0b2638589149c9d50aa610c90b249ac74e48f527da27bad924f8eedfbc157c0c417749831f35997d73133f0fd065
|
7
|
+
data.tar.gz: c41699247ec93be5472e48d2ca39c274499446219bed35257d3e8b97a27bc84d6f0c9b64721be19c3481013a10ec8063dab6ea579da165e04f6e97900395c37a
|
data/lib/onebox/engine.rb
CHANGED
@@ -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?
|
25
|
-
|
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
|
@@ -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
|
data/lib/onebox/version.rb
CHANGED
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.
|
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-
|
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
|