onebox 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onebox/engine/amazon_onebox.rb +2 -2
- data/lib/onebox/helpers.rb +1 -1
- data/lib/onebox/version.rb +1 -1
- data/onebox.gemspec +3 -3
- data/spec/spec_helper.rb +12 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 988dda6f5b64b8781329e91c3f0b8dc826d0e8bc
|
4
|
+
data.tar.gz: df7b513451cfb05039fd6d45ff236d042bd8359c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50f11c399aaf148cc15111f3bc420f1f7dfd1e39c301b1757008ba13bc71f7ea73745f4c22e25c372696cb50587215b38510e47f835567545934028a12a2c2d7
|
7
|
+
data.tar.gz: 727cbe61c73b320fb63a9232a88afe41e75e231dfcb3d169d6571875c4bc5693688381f964454f77ce8e5c47a08813f0ccf1966d64517f0bb157aec77b6e0db0
|
@@ -36,7 +36,7 @@ module Onebox
|
|
36
36
|
if (main_image = raw.css("#main-image")) && main_image.any?
|
37
37
|
attributes = main_image.first.attributes
|
38
38
|
|
39
|
-
return attributes["data-a-hires"] if attributes["data-a-hires"]
|
39
|
+
return attributes["data-a-hires"].to_s if attributes["data-a-hires"]
|
40
40
|
|
41
41
|
if attributes["data-a-dynamic-image"]
|
42
42
|
return ::JSON.parse(attributes["data-a-dynamic-image"].value).keys.first
|
@@ -44,7 +44,7 @@ module Onebox
|
|
44
44
|
end
|
45
45
|
|
46
46
|
if (landing_image = raw.css("#landingImage")) && landing_image.any?
|
47
|
-
landing_image.first["src"]
|
47
|
+
landing_image.first["src"].to_s
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
data/lib/onebox/helpers.rb
CHANGED
@@ -132,7 +132,7 @@ module Onebox
|
|
132
132
|
# expect properly encoded url, remove any unsafe chars
|
133
133
|
url.gsub!("'", "'")
|
134
134
|
url.gsub!('"', """)
|
135
|
-
url.gsub!(/[^\w\-`.~:\/?#\[\]@!$&'\(\)
|
135
|
+
url.gsub!(/[^\w\-`.~:\/?#\[\]@!$&'\(\)*+,;=%]/, "")
|
136
136
|
url
|
137
137
|
end
|
138
138
|
|
data/lib/onebox/version.rb
CHANGED
data/onebox.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'multi_json', '~> 1.11'
|
22
22
|
spec.add_runtime_dependency 'mustache'
|
23
|
-
spec.add_runtime_dependency 'nokogiri', '~> 1.
|
24
|
-
spec.add_runtime_dependency 'moneta', '~> 0
|
25
|
-
spec.add_runtime_dependency 'htmlentities', '~> 4.3
|
23
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.7'
|
24
|
+
spec.add_runtime_dependency 'moneta', '~> 1.0'
|
25
|
+
spec.add_runtime_dependency 'htmlentities', '~> 4.3'
|
26
26
|
spec.add_runtime_dependency 'fast_blank', '>= 1.0.0'
|
27
27
|
spec.add_runtime_dependency 'sanitize'
|
28
28
|
|
data/spec/spec_helper.rb
CHANGED
@@ -6,6 +6,14 @@ require 'mocha/api'
|
|
6
6
|
|
7
7
|
require_relative "support/html_spec_helper"
|
8
8
|
|
9
|
+
# Monkey-patch fakeweb to support Ruby 2.4+.
|
10
|
+
# See https://github.com/chrisk/fakeweb/pull/59.
|
11
|
+
module FakeWeb
|
12
|
+
class StubSocket
|
13
|
+
def close; end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
RSpec.configure do |config|
|
10
18
|
config.before(:all) do
|
11
19
|
FakeWeb.allow_net_connect = false
|
@@ -50,6 +58,10 @@ shared_examples_for "an engine" do
|
|
50
58
|
it "includes link" do
|
51
59
|
expect(data[:link]).not_to be_nil
|
52
60
|
end
|
61
|
+
|
62
|
+
it "is serializable" do
|
63
|
+
expect { Marshal.dump(data) }.to_not raise_error
|
64
|
+
end
|
53
65
|
end
|
54
66
|
end
|
55
67
|
|
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.8.
|
4
|
+
version: 1.8.3
|
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: 2017-
|
13
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
@@ -46,42 +46,42 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: '1.7'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 1.
|
56
|
+
version: '1.7'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: moneta
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0
|
63
|
+
version: '1.0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '0
|
70
|
+
version: '1.0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: htmlentities
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 4.3
|
77
|
+
version: '4.3'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 4.3
|
84
|
+
version: '4.3'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: fast_blank
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -491,7 +491,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
491
491
|
version: '0'
|
492
492
|
requirements: []
|
493
493
|
rubyforge_project:
|
494
|
-
rubygems_version: 2.
|
494
|
+
rubygems_version: 2.5.1
|
495
495
|
signing_key:
|
496
496
|
specification_version: 4
|
497
497
|
summary: A gem for turning URLs into previews.
|
@@ -558,4 +558,3 @@ test_files:
|
|
558
558
|
- spec/lib/onebox_spec.rb
|
559
559
|
- spec/spec_helper.rb
|
560
560
|
- spec/support/html_spec_helper.rb
|
561
|
-
has_rdoc:
|