Class: GoogleContactsApi::User

Inherits:
Object
  • Object
show all
Includes:
Contacts, Groups
Defined in:
lib/google_contacts_api/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Groups

#get_groups

Methods included from Contacts

#get_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

#apiObject (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