Class: Sovren::Employment

Inherits:
Object
  • Object
show all
Defined in:
lib/sovren/employment.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/employment.rb', line 3

def city
  @city
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#current_employerObject

Returns the value of attribute current_employer.



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

def current_employer
  @current_employer
end

#descriptionObject

Returns the value of attribute description.



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

def description
  @description
end

#divisionObject

Returns the value of attribute division.



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

def division
  @division
end

#employerObject

Returns the value of attribute employer.



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

def employer
  @employer
end

#end_dateObject

Returns the value of attribute end_date.



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

def end_date
  @end_date
end

#start_dateObject

Returns the value of attribute start_date.



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

def start_date
  @start_date
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Class Method Details

.parse(employment_history) ⇒ Object



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

def self.parse(employment_history)
  return Array.new if employment_history.nil?
  result = employment_history.css('EmployerOrg').collect do |item|
    position = item.css('PositionHistory').first
    e = Employment.new
    e.employer = item.css('EmployerOrgName').text
    e.division = position.css('OrganizationName').text
    e.division = nil if e.employer == e.division
    e.city, e.state, e.country = item.css('PositionLocation Municipality, PositionLocation Region, PositionLocation CountryCode').collect(&:text)
    e.title = position.css('Title').text
    e.description = position.css('Description').text
    e.start_date = Date.parse(position.css('StartDate').text) rescue nil
    e.current_employer = position['currentEmployer'] == "true"
    e.end_date = e.current_employer ? nil : (Date.parse(position.css('EndDate').text) rescue nil)
    e
  end
  result
end

Instance Method Details

#current_employer?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/sovren/employment.rb', line 24

def current_employer?
  !current_employer.nil? && current_employer
end