Class: Sovren::Education

Inherits:
Object
  • Object
show all
Defined in:
lib/sovren/education.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/sovren/education.rb', line 3

def city
  @city
end

#countryObject

Returns the value of attribute country.



3
4
5
# File 'lib/sovren/education.rb', line 3

def country
  @country
end

#degree_nameObject

Returns the value of attribute degree_name.



3
4
5
# File 'lib/sovren/education.rb', line 3

def degree_name
  @degree_name
end

#degree_typeObject

Returns the value of attribute degree_type.



3
4
5
# File 'lib/sovren/education.rb', line 3

def degree_type
  @degree_type
end

#end_dateObject

Returns the value of attribute end_date.



3
4
5
# File 'lib/sovren/education.rb', line 3

def end_date
  @end_date
end

#gpaObject

Returns the value of attribute gpa.



3
4
5
# File 'lib/sovren/education.rb', line 3

def gpa
  @gpa
end

#gpa_out_ofObject

Returns the value of attribute gpa_out_of.



3
4
5
# File 'lib/sovren/education.rb', line 3

def gpa_out_of
  @gpa_out_of
end

#graduatedObject

Returns the value of attribute graduated.



3
4
5
# File 'lib/sovren/education.rb', line 3

def graduated
  @graduated
end

#majorObject

Returns the value of attribute major.



3
4
5
# File 'lib/sovren/education.rb', line 3

def major
  @major
end

#minorObject

Returns the value of attribute minor.



3
4
5
# File 'lib/sovren/education.rb', line 3

def minor
  @minor
end

#school_nameObject

Returns the value of attribute school_name.



3
4
5
# File 'lib/sovren/education.rb', line 3

def school_name
  @school_name
end

#start_dateObject

Returns the value of attribute start_date.



3
4
5
# File 'lib/sovren/education.rb', line 3

def start_date
  @start_date
end

#stateObject

Returns the value of attribute state.



3
4
5
# File 'lib/sovren/education.rb', line 3

def state
  @state
end

Class Method Details

.parse(education_history) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sovren/education.rb', line 5

def self.parse(education_history)
  return Array.new if education_history.nil?
  result = education_history.css('SchoolOrInstitution').collect do |item|
    e = Education.new
    e.school_name = item.css('SchoolName').text
    e.city, e.state, e.country = item.css('PostalAddress Municipality, PostalAddress Region, PostalAddress CountryCode').collect(&:text)
    e.degree_type = item.css('Degree').first['degreeType']
    e.degree_name = item.css('Degree DegreeName').text
    e.major = item.css('DegreeMajor Name').text
    e.minor = item.css('DegreeMinor name').text
    e.gpa = item.css('EducationalMeasure MeasureValue StringValue').text.to_f rescue nil
    e.gpa_out_of = item.css('EducationalMeasure HighestPossibleValue StringValue').text.to_f rescue nil
    e.start_date = Date.parse(item.css('DatesOfAttendance StartDate AnyDate').text) rescue nil
    e.end_date = Date.parse(item.css('DatesOfAttendance EndDate AnyDate').text) rescue nil
    e.graduated = item.css('Degree DegreeDate AnyDate').text != ""
    e
  end
  result
end

Instance Method Details

#graduated?Boolean

Returns:

  • (Boolean)


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

def graduated?
  !graduated.nil? && graduated
end