Class: GoogleContactsApi::Group
- Includes:
- Contacts
- Defined in:
- lib/google_contacts_api/group.rb
Overview
Represents a single group.
Instance Attribute Summary
Attributes inherited from Result
Instance Method Summary collapse
-
#contacts(params = {}) ⇒ Object
Return the contacts in this group and cache them.
-
#contacts!(params = {}) ⇒ Object
Return the contacts in this group, retrieving them again from the server.
- #edit_link ⇒ Object
-
#links ⇒ Object
Returns the array of links, as link is an array for Hashie.
- #self_link ⇒ Object
-
#system_group? ⇒ Boolean
Return true if this is a system group.
Methods inherited from Result
#categories, #content, #deleted?, #etag, #id, #initialize, #inspect, #title, #updated
Constructor Details
This class inherits a constructor from GoogleContactsApi::Result
Instance Method Details
#contacts(params = {}) ⇒ Object
Return the contacts in this group and cache them.
12 13 14 15 |
# File 'lib/google_contacts_api/group.rb', line 12 def contacts(params = {}) # contacts in this group @contacts ||= super({"group" => self.id}.merge(params)) end |
#contacts!(params = {}) ⇒ Object
Return the contacts in this group, retrieving them again from the server.
18 19 20 21 |
# File 'lib/google_contacts_api/group.rb', line 18 def contacts!(params = {}) # contacts in this group @contacts = super({"group" => self.id}.merge(params)) end |
#edit_link ⇒ Object
33 34 35 36 |
# File 'lib/google_contacts_api/group.rb', line 33 def edit_link _link = self["link"].find { |l| l.rel == "edit" } _link ? _link.href : nil end |
#links ⇒ Object
Returns the array of links, as link is an array for Hashie.
24 25 26 |
# File 'lib/google_contacts_api/group.rb', line 24 def links self["link"].map { |l| l.href } end |
#self_link ⇒ Object
28 29 30 31 |
# File 'lib/google_contacts_api/group.rb', line 28 def self_link _link = self["link"].find { |l| l.rel == "self" } _link ? _link.href : nil end |
#system_group? ⇒ Boolean
Return true if this is a system group.
7 8 9 |
# File 'lib/google_contacts_api/group.rb', line 7 def system_group? !self["gContact$systemGroup"].nil? end |