Class: IndeedDegrees
- Inherits:
-
Object
- Object
- IndeedDegrees
- Includes:
- IndeedUtilities
- Defined in:
- lib/indeed_degrees.rb
Instance Method Summary collapse
-
#degree_end_date(degree) ⇒ Object
Get degree end date.
-
#degree_start_date(degree) ⇒ Object
Get start date for degree.
-
#degree_title(degree) ⇒ Object
Get title of degree.
-
#get_degrees ⇒ Object
Return degree info.
-
#initialize(html) ⇒ IndeedDegrees
constructor
A new instance of IndeedDegrees.
-
#school(degree) ⇒ Object
Get school name.
-
#school_location(degree) ⇒ Object
Get where the school is.
Methods included from IndeedUtilities
Constructor Details
#initialize(html) ⇒ IndeedDegrees
Returns a new instance of IndeedDegrees.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/indeed_degrees.rb', line 6 def initialize(html) degrees = html.xpath("//div[@itemtype='http://schema.org/EducationalOrganization']") @degree_list = Array.new degrees.each do |degree| @degree_list.push({ school: school(degree), degree_title: degree_title(degree), school_location: school_location(degree), degree_start_date: degree_start_date(degree), degree_end_date: degree_end_date(degree) }) end end |
Instance Method Details
#degree_end_date(degree) ⇒ Object
Get degree end date
47 48 49 |
# File 'lib/indeed_degrees.rb', line 47 def degree_end_date(degree) parse_dates(degree.xpath(".//p[@class='edu_dates']").text)[1] end |
#degree_start_date(degree) ⇒ Object
Get start date for degree
42 43 44 |
# File 'lib/indeed_degrees.rb', line 42 def degree_start_date(degree) parse_dates(degree.xpath(".//p[@class='edu_dates']").text)[0] end |
#degree_title(degree) ⇒ Object
Get title of degree
32 33 34 |
# File 'lib/indeed_degrees.rb', line 32 def degree_title(degree) degree.xpath(".//p[@class='edu_title']").text end |
#get_degrees ⇒ Object
Return degree info
22 23 24 |
# File 'lib/indeed_degrees.rb', line 22 def get_degrees return @degree_list end |
#school(degree) ⇒ Object
Get school name
27 28 29 |
# File 'lib/indeed_degrees.rb', line 27 def school(degree) degree.xpath(".//span[@itemprop='name']").text end |
#school_location(degree) ⇒ Object
Get where the school is
37 38 39 |
# File 'lib/indeed_degrees.rb', line 37 def school_location(degree) degree.xpath(".//span[@itemprop='addressLocality']").text end |