Class: Googletastic::Person

Inherits:
Base
  • Object
show all
Defined in:
lib/googletastic/person.rb

Constant Summary

Constants included from Mixins::Namespaces

Mixins::Namespaces::NAMESPACES

Instance Attribute Summary collapse

Attributes inherited from Base

#acl, #attachment_path, #created_at, #etag, #head, #id, #keep_raw, #raw, #response, #synced_with, #updated_at

Attributes included from Mixins::Attributes

#attributes

Class Method Summary collapse

Methods inherited from Base

#initialize, #to_xml

Methods included from Mixins::Pagination

included

Methods included from Mixins::Finders

included

Methods included from Mixins::Parsing

included

Methods included from Mixins::Requesting

included

Methods included from Mixins::Attributes

#attribute_names, #has_attribute?, #inspect

Methods included from Mixins::Namespaces

included

Constructor Details

This class inherits a constructor from Googletastic::Base

Instance Attribute Details

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/googletastic/person.rb', line 3

def email
  @email
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/googletastic/person.rb', line 3

def name
  @name
end

Class Method Details

.client_classObject



11
12
13
# File 'lib/googletastic/person.rb', line 11

def client_class
  "Contacts"
end

.index_urlObject



7
8
9
# File 'lib/googletastic/person.rb', line 7

def index_url
  "http://www.google.com/m8/feeds/contacts/default/full"
end

.unmarshall(xml) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/googletastic/person.rb', line 24

def unmarshall(xml)
  records = xml.xpath("//atom:entry", ns_tag("atom")).collect do |record|
    id      = record.xpath("atom:id", ns_tag("atom")).first.text
    name    = record.xpath("atom:title", ns_tag("atom")).first.text
    email   = record.xpath("gd:email", ns_tag("gd")).first["address"].to_s
    
    Googletastic::Person.new(
      :id => id,
      :name => name,
      :email => email
    )
  end
  records
end

.valid_queriesObject



16
17
18
19
20
21
22
# File 'lib/googletastic/person.rb', line 16

def valid_queries
  {
    :order => "orderby",
    :sort => "sortorder",
    :group => "group"
  }.merge(super)
end