Class: IndeedAwards

Inherits:
Object
  • Object
show all
Includes:
IndeedUtilities
Defined in:
lib/indeed_awards.rb

Instance Method Summary collapse

Methods included from IndeedUtilities

#date_normalize, #parse_dates

Constructor Details

#initialize(html) ⇒ IndeedAwards

Returns a new instance of IndeedAwards.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/indeed_awards.rb', line 6

def initialize(html)
  awards = html.xpath("//div[contains(concat(' ',normalize-space(@class),' '),' award-section ')]")
  @award_list = Array.new
  
  awards.each do |award|
    @award_list.push({
                      award_title: award_title(award),
                      award_date: award_date(award),
                      award_description: award_description(award)
    })
  end
end

Instance Method Details

#award_date(award) ⇒ Object

Get award date



30
31
32
# File 'lib/indeed_awards.rb', line 30

def award_date(award)
  award.xpath(".//p[@class='award_date']").text
end

#award_description(award) ⇒ Object

Get award description



35
36
37
# File 'lib/indeed_awards.rb', line 35

def award_description(award)
  award.xpath(".//p[@class='award_description']").text
end

#award_title(award) ⇒ Object

Get title of award



25
26
27
# File 'lib/indeed_awards.rb', line 25

def award_title(award)
  award.xpath(".//p[@class='award_title']").text
end

#get_awardsObject

Return award info



20
21
22
# File 'lib/indeed_awards.rb', line 20

def get_awards
  return @award_list
end