Class: GoogleContacts::Contact
- Defined in:
- lib/google_contacts/contact.rb
Constant Summary collapse
- CATEGORY_TERM =
"http://schemas.google.com/contact/2008#contact"
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #email ⇒ Object
- #email=(address) ⇒ Object
-
#initialize(*args) ⇒ Contact
constructor
A new instance of Contact.
- #inspect ⇒ Object
-
#name ⇒ Object
Alias “name” to “title”.
- #name=(v) ⇒ Object
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.
7 8 9 10 11 12 13 |
# File 'lib/google_contacts/contact.rb', line 7 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
#email ⇒ Object
24 25 26 27 |
# File 'lib/google_contacts/contact.rb', line 24 def email primary = emails.primary primary && primary.address end |
#email=(address) ⇒ Object
29 30 31 |
# File 'lib/google_contacts/contact.rb', line 29 def email=(address) emails[address].primary! end |
#inspect ⇒ Object
33 34 35 |
# File 'lib/google_contacts/contact.rb', line 33 def inspect "\#<GoogleContacts::Contact name=#{name.inspect} email=#{email.inspect}>" end |
#name ⇒ Object
Alias “name” to “title”
16 17 18 |
# File 'lib/google_contacts/contact.rb', line 16 def name method_missing(:title) end |
#name=(v) ⇒ Object
20 21 22 |
# File 'lib/google_contacts/contact.rb', line 20 def name=(v) method_missing(:title=, v) end |