Sha256: 168a61f95cf9e02921a5e80b03a3542d47db6deae13ab2e7b6117b549c299af5
Contents?: true
Size: 782 Bytes
Versions: 2
Compression:
Stored size: 782 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)) results = search.results hits = search.hits max_page = search.max_page loop do results.each do |resume| yield Resume.new(client, resume) end current_page += 1 break if current_page > max_page search = client.advanced_resume_search(search_options.merge(:page_number => current_page)) results = search.results end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
career_builder-0.1.1 | lib/career_builder/resume/lazy_collection.rb |
career_builder-0.1.0 | lib/career_builder/resume/lazy_collection.rb |