Class: GoogleAppsApi::ContactEntity
- Defined in:
- lib/google_apps_api/contacts.rb
Constant Summary
Constants inherited from Entity
Instance Attribute Summary collapse
-
#emails ⇒ Object
readonly
Returns the value of attribute emails.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary_email ⇒ Object
readonly
Returns the value of attribute primary_email.
Attributes inherited from Entity
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(*args) ⇒ ContactEntity
constructor
A new instance of ContactEntity.
Methods inherited from Entity
#full_id, #full_id_escaped, #id_escaped, #qualified_id, #qualified_id_escaped
Constructor Details
#initialize(*args) ⇒ ContactEntity
Returns a new instance of ContactEntity.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/google_apps_api/contacts.rb', line 55 def initialize(*args) @emails = {} = args. if (_xml = [:xml]) xml = _xml.at_css("entry") || _xml @kind = "contact" @id = xml.at_css("id").content.gsub(/^.+\/base\//,"") @domain = xml.at_css("id").content.gsub(/^.+\/contacts\/([^\/]+)\/.+$/,"\\1") @name = xml.at_css("title").content xml.css("gd|email").each do |email_node| loc = email_node.attribute("rel").content.gsub(/^.+\#/,"").to_sym email = email_node.attribute("address").content primary = email_node.attribute("primary") && email_node.attribute("primary").content == "true" @primary_email = loc if primary @emails[loc] = email end else if args.first.kind_of?(String) super(:contact => args.first) else @name = .delete(:name) @emails = .delete(:emails) || {} super(.merge(:kind => "contact")) end end end |
Instance Attribute Details
#emails ⇒ Object (readonly)
Returns the value of attribute emails.
53 54 55 |
# File 'lib/google_apps_api/contacts.rb', line 53 def emails @emails end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
53 54 55 |
# File 'lib/google_apps_api/contacts.rb', line 53 def name @name end |
#primary_email ⇒ Object (readonly)
Returns the value of attribute primary_email.
53 54 55 |
# File 'lib/google_apps_api/contacts.rb', line 53 def primary_email @primary_email end |
Instance Method Details
#==(other) ⇒ Object
87 88 89 |
# File 'lib/google_apps_api/contacts.rb', line 87 def ==(other) super(other) end |