Class: Net::HTTPResponse
- Inherits:
-
Object
- Object
- Net::HTTPResponse
- Defined in:
- lib/simple/http/expires_in.rb,
lib/simple/http/result.rb
Instance Method Summary collapse
-
#expires_in ⇒ Object
returns expiration information, in seconds from now.
-
#result ⇒ Object
evaluate and potentially parse response.
Instance Method Details
#expires_in ⇒ Object
returns expiration information, in seconds from now.
26 27 28 29 30 31 32 33 |
# File 'lib/simple/http/expires_in.rb', line 26 def expires_in expires_in = max_age if !expires_in && expires = header["Expires"] expires_in = Time.parse(expires) - Time.now end return expires_in if expires_in && expires_in > 0 end |
#result ⇒ Object
evaluate and potentially parse response
11 12 13 14 15 16 17 18 |
# File 'lib/simple/http/result.rb', line 11 def result case response.content_type when "application/json" JSON.parse(body) unless body.empty? else body_string end end |