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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1352380dded0936ef25582e1d72ea8f265ea275
4
- data.tar.gz: 335b4a502bd143fd6b926d7607087699c096c989
3
+ metadata.gz: 7ea86816288cce59362b5168910f92f0d84e755c
4
+ data.tar.gz: 28a653fc5dd177f71f31658d2b5339dbb7a9df18
5
5
  SHA512:
6
- metadata.gz: 61bc29488640968ffa24af64d7efc44869f29a2464f7cd6f5f82624e19bfa07cf9e0a13eb542fa230721cad22e39fe0156123fd52dde4591f401e6758553cab2
7
- data.tar.gz: ae7c475fdec87a70d8788cf60a7bfa286df26c114ece3edc7993771202c19a9fcc8e239adca087f15feeca533fdf3b83e354207686b8ce01c186990c4321ce3f
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
- return "http://www.amazon.#{tld}/gp/aw/d/" + URI::encode(match[:id]) if match && match[:id]
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
 
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.5.38"
2
+ VERSION = "1.5.39"
3
3
  end
@@ -18,8 +18,7 @@ describe Onebox::Engine::AmazonOnebox do
18
18
  end
19
19
 
20
20
  it "matches canadian domains" do
21
- resp = check_link("ca", "http://www.amazon.ca/Too-Much-Happiness-Alice-Munro-ebook/dp/B0031TZ98K/")
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.38
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-03-30 00:00:00.000000000 Z
13
+ date: 2016-04-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json