module IndeedJobsearch::SearchResultsFetcher

Public Class Methods

fetch(query, location, page_number) click to toggle source
# File lib/indeed_jobsearch/search_results_fetcher.rb, line 3
def self.fetch(query, location, page_number)
  page = SearchPage.new(query, location, page_number)
  results = page.nodes.map do |node|
    search_result(node)
  end
end

Private Class Methods

search_result(node) click to toggle source
# File lib/indeed_jobsearch/search_results_fetcher.rb, line 12
def self.search_result(node)
  SearchResult.new(
    job_title: node.text('.jobtitle'),
    company: node.text('.company'),
    location: node.text('.location'),
    time_since_posting: node.text('.date'),
    time_scraped: Time.now,
    url: 'http://www.indeed.com' + node.url
  )
end