class GoogleContactsApi::Result

Base class for Group and Contact. In the JSON responses, “:” from the equivalent XML response is replaced with a “$”, while element content is instead keyed with “$t”.

Attributes

api[R]

Public Class Methods

new(source_hash = nil, default = nil, api = nil, &blk) click to toggle source

Initialize a Result from a single result’s Hash/Hashie

Calls superclass method
# File lib/google_contacts_api/result.rb, line 10
def initialize(source_hash = nil, default = nil, api = nil, &blk)
  @api = api if api
  super(source_hash, default, &blk)
end

Public Instance Methods

categories() click to toggle source

Returns the array of categories, as category is an array for Hashie. There is a scheme and a term.

# File lib/google_contacts_api/result.rb, line 44
def categories
  category
end
content() click to toggle source
# File lib/google_contacts_api/result.rb, line 32
def content
  _content = self["content"]
  _content ? _content["$t"] : nil
end
deleted?() click to toggle source
# File lib/google_contacts_api/result.rb, line 48
def deleted?
  self.key?('gd$deleted')
end
etag() click to toggle source

TODO: Conditional retrieval? There might not be an etag in the JSON representation, there is in the XML representation

# File lib/google_contacts_api/result.rb, line 17
def etag
end
id() click to toggle source
# File lib/google_contacts_api/result.rb, line 20
def id
  _id = self["id"]
  _id ? _id["$t"] : nil
end
inspect() click to toggle source
# File lib/google_contacts_api/result.rb, line 52
def inspect
  "<#{self.class}: #{title}>"
end
title() click to toggle source

For Contacts, returns the (full) name. For Groups, returns the name of the group.

# File lib/google_contacts_api/result.rb, line 27
def title
  _title = self["title"]
  _title ? _title["$t"] : nil
end
updated() click to toggle source
# File lib/google_contacts_api/result.rb, line 37
def updated
  _updated = self["updated"]
  _updated ? DateTime.parse(_updated["$t"]) : nil
end