Class: GoogleContactsApi::User
- Inherits:
-
Object
- Object
- GoogleContactsApi::User
- Defined in:
- lib/google_contacts_api/user.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
-
#contacts(params = {}) ⇒ Object
Return the contacts for this user and cache them.
-
#contacts!(params = {}) ⇒ Object
Return the contacts for this user, retrieving them again from the server.
-
#groups(params = {}) ⇒ Object
Return the groups for this user and cache them.
-
#groups!(params = {}) ⇒ Object
Return the groups for this user, retrieving them again from the server.
-
#initialize(oauth) ⇒ User
constructor
A new instance of User.
Methods included from Groups
Methods included from Contacts
Constructor Details
#initialize(oauth) ⇒ User
Returns a new instance of User.
7 8 9 |
# File 'lib/google_contacts_api/user.rb', line 7 def initialize(oauth) @api = GoogleContactsApi::Api.new(oauth) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
6 7 8 |
# File 'lib/google_contacts_api/user.rb', line 6 def api @api end |
Instance Method Details
#contacts(params = {}) ⇒ Object
Return the contacts for this user and cache them.
12 13 14 15 |
# File 'lib/google_contacts_api/user.rb', line 12 def contacts(params = {}) # contacts in this group @contacts ||= get_contacts(params) end |
#contacts!(params = {}) ⇒ Object
Return the contacts for this user, retrieving them again from the server.
18 19 20 21 22 |
# File 'lib/google_contacts_api/user.rb', line 18 def contacts!(params = {}) # contacts in this group @contacts = nil contacts(params) end |
#groups(params = {}) ⇒ Object
Return the groups for this user and cache them.
25 26 27 |
# File 'lib/google_contacts_api/user.rb', line 25 def groups(params = {}) @groups ||= get_groups(params) end |
#groups!(params = {}) ⇒ Object
Return the groups for this user, retrieving them again from the server.
30 31 32 33 |
# File 'lib/google_contacts_api/user.rb', line 30 def groups!(params = {}) @groups = nil groups(params) end |