Class: Razsell::Engine
- Inherits:
-
Object
- Object
- Razsell::Engine
- Defined in:
- lib/razsell/engine.rb
Overview
Use the engine class to make requests and receive results
Instance Method Summary collapse
- #get_http_service ⇒ Object
-
#initialize(opts = {}) ⇒ Engine
constructor
A new instance of Engine.
- #request(query) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Engine
Returns a new instance of Engine.
6 7 8 9 |
# File 'lib/razsell/engine.rb', line 6 def initialize opts={} @opts = opts @http_service = get_http_service end |
Instance Method Details
#get_http_service ⇒ Object
23 24 25 |
# File 'lib/razsell/engine.rb', line 23 def get_http_service @opts[:http_service] || Razsell::HttpService.new end |
#request(query) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/razsell/engine.rb', line 11 def request query feed = @http_service.get query results = Razsell::Results.new feed while results.has_more_pages? && query.advance_page feed = @http_service.get query results.add(feed) end results end |