Sha256: 9753374be72849bb804c6707f24d227efee2e50218bbdc7b0c24bbb98fb2548b

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require 'razsell/http_service'

module Razsell
  # Use the engine class to make requests and receive results
  class Engine
    def initialize opts={}
      @opts = opts
      @http_service = get_http_service
    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[:http_service] || Razsell::HttpService.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
razsell-0.0.11 lib/razsell/engine.rb