Class: Contacts::Contact::Google

Inherits:
Struct
  • Object
show all
Defined in:
lib/contacts/contact/google.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email

Returns:

  • (Object)

    the current value of email



1
2
3
# File 'lib/contacts/contact/google.rb', line 1

def email
  @email
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



1
2
3
# File 'lib/contacts/contact/google.rb', line 1

def name
  @name
end

Class Method Details

.parse(xml) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/contacts/contact/google.rb', line 3

def self.parse xml
  name = xml.css("title").text
  email_node = xml.xpath("gd:email").first
  return nil if email_node.nil?
  email = email_node['address'] 
  new(email, name)
end