Class: GoogleContacts::Contact

Inherits:
Base
  • Object
show all
Defined in:
lib/google_contacts/contact.rb

Constant Summary collapse

CATEGORY_TERM =
'http://schemas.google.com/contact/2008#contact'

Constants inherited from Base

Base::NAMESPACES

Instance Attribute Summary

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #attributes=, #changed?, #delete, #entry_for_batch, feed_for_batch, #href, #insert_xml, #new?, #remove_xml, #save, #updated_at, #url

Constructor Details

#initialize(*args) ⇒ Contact

Returns a new instance of Contact.



6
7
8
9
10
11
12
# File 'lib/google_contacts/contact.rb', line 6

def initialize(*args)
  super
  register_proxy :emails, Proxies::Emails.new(self)
  register_proxy :groups, Proxies::Array.new(self,
    :tag   => 'gContact:groupMembershipInfo',
    :attr  => 'href')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GoogleContacts::Base

Instance Method Details

#emailObject



14
15
16
# File 'lib/google_contacts/contact.rb', line 14

def email
  emails.primary.try(:address)
end

#email=(address) ⇒ Object



18
19
20
# File 'lib/google_contacts/contact.rb', line 18

def email=(address)
  emails[address].primary!
end

#inspectObject



22
23
24
# File 'lib/google_contacts/contact.rb', line 22

def inspect
  "\#<GoogleContacts::Contact name=#{name.inspect} email=#{email.inspect}>"
end