Sha256: b6ac1bef3ad74eb6a930d482572f0ef9481555e9e5eaa13a0ce5650c49e31707

Contents?: true

Size: 516 Bytes

Versions: 4

Compression:

Stored size: 516 Bytes

Contents

require 'http_service'

module Razsell
  class Engine
    def initialize opts={}
      @http_service = get_http_service opts
    end

    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

    def get_http_service opts
      opts[:http_service] ? opts[:http_service] : Razsell::HttpService.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubyyot-razsell-0.0.0 lib/engine.rb
rubyyot-razsell-0.0.1 lib/engine.rb
rubyyot-razsell-0.0.2 lib/engine.rb
rubyyot-razsell-0.0.3 lib/engine.rb