Class: Contacts::Contact::Yahoo
- Inherits:
-
Struct
- Object
- Struct
- Contacts::Contact::Yahoo
- Defined in:
- lib/contacts/contact/yahoo.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email
1 2 3 |
# File 'lib/contacts/contact/yahoo.rb', line 1 def email @email end |
#name ⇒ Object
Returns the value of attribute name
1 2 3 |
# File 'lib/contacts/contact/yahoo.rb', line 1 def name @name end |
Class Method Details
.parse(hash) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/contacts/contact/yahoo.rb', line 3 def self.parse hash email, name = '', nil hash['fields'].each do |field| case field['type'] when 'email' email = field['value'] when 'name' name = [field['value']['givenName'], field['value']['familyName']].join(' ') rescue '' end end name ||= email new(email, name) unless email.nil? or email.empty? end |