Class: Sovren::Reference

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email.



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

def email
  @email
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#phone_numberObject

Returns the value of attribute phone_number.



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

def phone_number
  @phone_number
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Class Method Details

.parse(references) ⇒ Object



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

def self.parse(references)
  return Array.new if references.nil?
  result = references.css('Reference').collect do |item|
    r = Reference.new
    r.name = item.css('PersonName FormattedName').text
    r.title = item.css('PositionTitle').text
    r.email = item.css('ContactMethod InternetEmailAddress').first.text rescue nil
    r.phone_number = item.css('ContactMethod Telephone FormattedNumber').first.text rescue nil
    r
  end
  result
end