onebox 1.5.38 → 1.5.39
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 +5 -1
- data/lib/onebox/version.rb +1 -1
- data/spec/lib/onebox/engine/amazon_onebox_spec.rb +12 -3
- 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: 7ea86816288cce59362b5168910f92f0d84e755c
|
4
|
+
data.tar.gz: 28a653fc5dd177f71f31658d2b5339dbb7a9df18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8693498c5c04aec5349c03e86fe9d1155a229525c423086475369e0fd6d06ba7335a72546142bafa2c668758fbcd70ac9773a9585d7ad52ff9eb9290a01b6ac
|
7
|
+
data.tar.gz: 9c4db21c6bf36d9859fdcbd36bf3db9de3d625e5188a02853167ad75a96490aff1a95320b5bc35c1db5b18e3b4b602730ee12111f4171fc9b15734884f36beab
|
@@ -11,7 +11,11 @@ module Onebox
|
|
11
11
|
matches_regexp(/^https?:\/\/(?:www)\.amazon\.(?<tld>com|ca|de|it|es|fr|co\.jp|co\.uk|cn|in|com\.br)\//)
|
12
12
|
|
13
13
|
def url
|
14
|
-
|
14
|
+
if match && match[:id]
|
15
|
+
_url = URI("http://www.amazon.#{tld}/gp/aw/d/" + URI::encode(match[:id]))
|
16
|
+
_url.scheme = URI(@url).scheme
|
17
|
+
return _url.to_s
|
18
|
+
end
|
15
19
|
@url
|
16
20
|
end
|
17
21
|
|
data/lib/onebox/version.rb
CHANGED
@@ -18,8 +18,7 @@ describe Onebox::Engine::AmazonOnebox do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "matches canadian domains" do
|
21
|
-
|
22
|
-
|
21
|
+
check_link("ca", "http://www.amazon.ca/Too-Much-Happiness-Alice-Munro-ebook/dp/B0031TZ98K/")
|
23
22
|
end
|
24
23
|
|
25
24
|
it "matches german domains" do
|
@@ -60,6 +59,16 @@ describe Onebox::Engine::AmazonOnebox do
|
|
60
59
|
|
61
60
|
end
|
62
61
|
|
62
|
+
describe "#url" do
|
63
|
+
it "maintains the same http/https scheme as the requested URL" do
|
64
|
+
expect(described_class.new("https://www.amazon.fr/gp/product/B01BYD0TZM").url)
|
65
|
+
.to eq("https://www.amazon.fr/gp/aw/d/B01BYD0TZM")
|
66
|
+
|
67
|
+
expect(described_class.new("http://www.amazon.fr/gp/product/B01BYD0TZM").url)
|
68
|
+
.to eq("http://www.amazon.fr/gp/aw/d/B01BYD0TZM")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
63
72
|
describe "#to_html" do
|
64
73
|
it "includes image" do
|
65
74
|
expect(html).to include("http://ecx.images-amazon.com/images/I/51opYcR6kVL._SY400_.jpg")
|
@@ -76,6 +85,6 @@ describe Onebox::Engine::AmazonOnebox do
|
|
76
85
|
it "includes title" do
|
77
86
|
expect(html).to include("Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages (Pragmatic Programmers)")
|
78
87
|
end
|
79
|
-
|
80
88
|
end
|
89
|
+
|
81
90
|
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.5.
|
4
|
+
version: 1.5.39
|
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-
|
13
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|