Class: EOAT::Request
- Inherits:
-
Object
- Object
- EOAT::Request
- Defined in:
- lib/eoat/request.rb
Overview
Request class. Returns an instance of the class-result from the cache or performs http request.
Instance Method Summary collapse
-
#get(cache) ⇒ Object
Method-collector of private methods.
-
#initialize(host, uri, result_class) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(host, uri, result_class) ⇒ Request
Returns a new instance of Request.
25 26 27 28 29 |
# File 'lib/eoat/request.rb', line 25 def initialize(host, uri, result_class) @host = host @uri = uri @result = result_class end |
Instance Method Details
#get(cache) ⇒ Object
Method-collector of private methods. Performs basic algorithm of output.
32 33 34 35 36 37 38 39 40 |
# File 'lib/eoat/request.rb', line 32 def get(cache) if cache cache_response = cache_get return(cache_response) if cache_response end response = @result.new(http_request) cache_save(response) response end |