slds_on_rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/slds/slds_controller.rb +20 -2
- data/lib/slds/version.rb +1 -1
- 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: 971a104b4ddc10faa4cc9a337b9816f22f0f69d3
|
4
|
+
data.tar.gz: b67f36d4b8a98ea97b6a8810629982a52cac85fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 677c8767739995a9ddf01ac56e5880ebead112688641c2e75832c89bf1b9678072e23c750db488b7361dd4c61f324738923cfa003a6db19fd4a0eb03b070db01
|
7
|
+
data.tar.gz: e79a26a0bec3459b1cc3739fa1988a857c6ea8526c9a1a05619085bf1759a79c4a41e2521ec71badff349c793b645bef03480ca5cdf0198367a767342c1a2f73
|
@@ -21,8 +21,26 @@ module Slds
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
+
#
|
25
|
+
# http://opensourceconnections.com/blog/2008/04/24/adding-timeout-to-nethttp-get_response/
|
26
|
+
#
|
27
|
+
# Net::HTTP.get and Net::HTTP.get_response
|
28
|
+
# The difference between these two methods is that
|
29
|
+
# get_response is a class method that returns an Net::HTTPResponse object
|
30
|
+
# while get is an instance method that returns a string.
|
31
|
+
# And get_response doesn’t support passing in timeouts of any kind!
|
32
|
+
# By wrapping my call to http.get in an http.start{} block,
|
33
|
+
# I get the timeout ability of http.get
|
34
|
+
# with the return of an HTTPResponse that Net::HTTP.get_response normally provides.
|
24
35
|
def slds_response
|
25
|
-
@slds_response
|
36
|
+
return @slds_response if @slds_response
|
37
|
+
http = Net::HTTP.new(item_uri.host, item_uri.port)
|
38
|
+
http.use_ssl = true
|
39
|
+
http.read_timeout = 2
|
40
|
+
http.open_timeout = 2
|
41
|
+
@slds_response ||= http.start do |http|
|
42
|
+
http.get(item_uri.path)
|
43
|
+
end
|
26
44
|
end
|
27
45
|
|
28
46
|
# Map the given URL path to the absolute url to the Slds asset uri (server).
|
@@ -42,7 +60,7 @@ module Slds
|
|
42
60
|
|
43
61
|
def render_error(e)
|
44
62
|
logger.error("Slds::SldsController.render_error: exception: #{e}")
|
45
|
-
e.backtrace.
|
63
|
+
logger.error(e.backtrace.first(2))
|
46
64
|
|
47
65
|
render(status: 500, body: 'error')
|
48
66
|
end
|
data/lib/slds/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slds_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Eden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|