Sha256: cd52e94534255f8e54062c02a070da09309c077643adb947b227d8a301cfb060

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

module CareerBuilder

  class Resume::LazyCollection

    attr_reader :search_options, :client

    def initialize(client, options)
      @client = client
      @search_options = options
    end

    def each
      current_page = search_options[:page] || 1

      search = client.advanced_resume_search(search_options.merge(:page_number => current_page, :rows_per_page => 500))

      results = search.results

      loop do
        results.each do |resume|
          yield Resume.new(client, resume)
        end

        current_page += 1

        search = client.advanced_resume_search(search_options.merge(:page_number => current_page, :rows_per_page => 500))
        results = search.results
        break if results.empty?
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
career_builder-0.2.0 lib/career_builder/resume/lazy_collection.rb