onebox 1.2.5 → 1.2.6

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: 66fa788b67da32beda2b5c5f9ee946ab9df91dd4
4
- data.tar.gz: 44631fb76252c9ca68e1e2b6296efb28d501b1a7
3
+ metadata.gz: c6a66e8e91c7878af02cfc958cef061c9217c53b
4
+ data.tar.gz: 6256dc1b8e4e02eb72e20caa760a895ffc92c30b
5
5
  SHA512:
6
- metadata.gz: 6c2da907c156abf1012b4910a481391c0a5e658caa71f7b12e01f05f0059df45372a3d7d6c13da415aaa9bc3e60318f68f77c7c0dc1388cc1a7f75c73f717691
7
- data.tar.gz: c5b726d096b6c9cda3c39c71ff38c487e4955127e0ad851686f1bcf02ca509bdcc04f32a6b2608cfd441556ce94fa5be89ae3a3a8d22ad61b997719ad6f0e989
6
+ metadata.gz: 8a883437f3fc2dda06c596813fbc4c20229889d48fb640cae006039e869fc2c5a634922ff7dc5fa8fed7c9b70102168e36ca914df4b16dd3edb48e56ba6f5c63
7
+ data.tar.gz: 937fa649b03e96ed98af0ce8dc222bbe04797a70e6d727052706523915bf051ee2534b13f554cb5fcefbed37257820a6aaa9d4d2828cbaca02884b8573ae2ac4
@@ -18,7 +18,7 @@ module Onebox
18
18
  end
19
19
 
20
20
  def url
21
- domain = match[:subsubdomain] || match[:subdomain] || match[:domain]
21
+ domain = URI(@url).host
22
22
  "http://api.stackexchange.com/2.1/questions/#{match[:question]}?site=#{domain}"
23
23
  end
24
24
 
@@ -1,6 +1,8 @@
1
1
  module Onebox
2
2
  module Helpers
3
3
  def self.symbolize_keys(hash)
4
+ return {} if hash.nil?
5
+
4
6
  hash.inject({}){|result, (key, value)|
5
7
  new_key = case key
6
8
  when String then key.to_sym
@@ -11,8 +11,8 @@ module Onebox
11
11
  @record = Onebox::Helpers.symbolize_keys(record)
12
12
 
13
13
  # Fix any relative paths
14
- if record[:image] && record[:image] =~ /^\/[^\/]/
15
- record[:image] = "#{uri.scheme}://#{uri.host}/#{record[:image]}"
14
+ if @record[:image] && @record[:image] =~ /^\/[^\/]/
15
+ @record[:image] = "#{uri.scheme}://#{uri.host}/#{@record[:image]}"
16
16
  end
17
17
 
18
18
  @md5 = Digest::MD5.new
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.2.5"
2
+ VERSION = "1.2.6"
3
3
  end
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
  describe Onebox::Engine::StackExchangeOnebox do
4
4
  before(:all) do
5
5
  @link = "http://stackoverflow.com/questions/17992553/concept-behind-these-four-lines-of-tricky-c-code"
6
- fake("http://api.stackexchange.com/2.1/questions/17992553?site=stackoverflow", response(described_class.onebox_name))
6
+ fake("http://api.stackexchange.com/2.1/questions/17992553?site=stackoverflow.com", response(described_class.onebox_name))
7
7
  end
8
8
 
9
9
  include_context "engines"
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.2.5
4
+ version: 1.2.6
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: 2014-02-25 00:00:00.000000000 Z
13
+ date: 2014-03-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json