Class: Sovren::ContactInformation
- Inherits:
-
Object
- Object
- Sovren::ContactInformation
- Defined in:
- lib/sovren/contact_information.rb
Instance Attribute Summary collapse
-
#address_line_1 ⇒ Object
Returns the value of attribute address_line_1.
-
#address_line_2 ⇒ Object
Returns the value of attribute address_line_2.
-
#aristocratic_title ⇒ Object
Returns the value of attribute aristocratic_title.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#form_of_address ⇒ Object
Returns the value of attribute form_of_address.
-
#generation ⇒ Object
Returns the value of attribute generation.
-
#home_phone ⇒ Object
Returns the value of attribute home_phone.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#middle_name ⇒ Object
Returns the value of attribute middle_name.
-
#mobile_phone ⇒ Object
Returns the value of attribute mobile_phone.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#qualification ⇒ Object
Returns the value of attribute qualification.
-
#state ⇒ Object
Returns the value of attribute state.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Attribute Details
#address_line_1 ⇒ Object
Returns the value of attribute address_line_1.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ Object
Returns the value of attribute address_line_2.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def address_line_2 @address_line_2 end |
#aristocratic_title ⇒ Object
Returns the value of attribute aristocratic_title.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def aristocratic_title @aristocratic_title end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def first_name @first_name end |
#form_of_address ⇒ Object
Returns the value of attribute form_of_address.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def form_of_address @form_of_address end |
#generation ⇒ Object
Returns the value of attribute generation.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def generation @generation end |
#home_phone ⇒ Object
Returns the value of attribute home_phone.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def home_phone @home_phone end |
#last_name ⇒ Object
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def last_name @last_name end |
#middle_name ⇒ Object
Returns the value of attribute middle_name.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def middle_name @middle_name end |
#mobile_phone ⇒ Object
Returns the value of attribute mobile_phone.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def mobile_phone @mobile_phone end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def postal_code @postal_code end |
#qualification ⇒ Object
Returns the value of attribute qualification.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def qualification @qualification end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def state @state end |
#website ⇒ Object
Returns the value of attribute website.
3 4 5 |
# File 'lib/sovren/contact_information.rb', line 3 def website @website end |
Class Method Details
.parse(contact_information) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sovren/contact_information.rb', line 5 def self.parse(contact_information) return nil if contact_information.nil? result = self.new result.first_name = contact_information.css('PersonName GivenName').collect(&:text).join(" ") result.middle_name = contact_information.css('PersonName MiddleName').collect(&:text).join(" ") result.last_name = contact_information.css('PersonName FamilyName').collect(&:text).join(" ") result.aristocratic_title = contact_information.css('PersonName Affix[type=aristocraticTitle]').collect(&:text).join(" ") result.form_of_address = contact_information.css('PersonName Affix[type=formOfAddress]').collect(&:text).join(" ") result.generation = contact_information.css('PersonName Affix[type=generation]').collect(&:text).join(" ") result.qualification = contact_information.css('PersonName Affix[type=qualification]').collect(&:text).join(" ") address = contact_information.css('PostalAddress DeliveryAddress AddressLine').collect(&:text) result.address_line_1 = address[0] if address.length > 0 result.address_line_2 = address[1] if address.length > 1 result.city = contact_information.css('PostalAddress').first.css('Municipality').text rescue nil result.state = contact_information.css('PostalAddress').first.css('Region').text rescue nil result.postal_code = contact_information.css('PostalAddress').first.css('PostalCode').text rescue nil result.country = contact_information.css('PostalAddress').first.css('CountryCode').text rescue nil result.home_phone = contact_information.css('Telephone FormattedNumber').first.text rescue nil result.mobile_phone = contact_information.css('Mobile FormattedNumber').first.text rescue nil result.website = contact_information.css('InternetWebAddress').first.text rescue nil result.email = contact_information.css('InternetEmailAddress').first.text rescue nil result end |