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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4990a25da9b00fcf5de0fce0473d87d24563de8
4
- data.tar.gz: 5b9def6677ebf1c9af4be04e49ee9b26923e1ff3
3
+ metadata.gz: 971a104b4ddc10faa4cc9a337b9816f22f0f69d3
4
+ data.tar.gz: b67f36d4b8a98ea97b6a8810629982a52cac85fe
5
5
  SHA512:
6
- metadata.gz: 458db637ff111a84404798e6e06c325f62ff5cb892d4b2561c3d3c65781fd77bdf653949b10ac350cf3ab333327a6434281964f655d8d479eb9e115bf9143b85
7
- data.tar.gz: 9723b95f969156d5df0dabc1146dcb2434340c57a5bff8342a9a4d24872f7a3878343d5c430a9fe9c3ecb8856697ddaee92624edf97982a248cb254bc6aa2595
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 ||= Net::HTTP.get_response(item_uri)
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.each { |line| logger.error line }
63
+ logger.error(e.backtrace.first(2))
46
64
 
47
65
  render(status: 500, body: 'error')
48
66
  end
@@ -1,3 +1,3 @@
1
1
  module Slds
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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-08-29 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails