Class: Teamlab::People

Inherits:
Object
  • Object
show all
Defined in:
lib/teamlab/modules/people.rb

Instance Method Summary collapse

Constructor Details

#initializePeople

Returns a new instance of People.



3
4
5
# File 'lib/teamlab/modules/people.rb', line 3

def initialize
  @request = Teamlab::Request.new('people')
end

Instance Method Details

#active(options = {}) ⇒ Object



47
48
49
# File 'lib/teamlab/modules/people.rb', line 47

def active(options = {})
  @request.post(['active'], options) # TODO: need some fixing
end

#add_contacts(contacts, user_id) ⇒ Object



79
80
81
# File 'lib/teamlab/modules/people.rb', line 79

def add_contacts(contacts, user_id)
  @request.put([user_id, 'contacts'], contacts: contacts)
end

#add_user(is_visitor, email, firstname, lastname, options = {}) ⇒ Object



43
44
45
# File 'lib/teamlab/modules/people.rb', line 43

def add_user(is_visitor, email, firstname, lastname, options = {})
  @request.post(nil, { isVisitor: is_visitor, email: email, firstname: firstname, lastname: lastname }.merge(options))
end

#change_people_status(status, user_ids) ⇒ Object



75
76
77
# File 'lib/teamlab/modules/people.rb', line 75

def change_people_status(status, user_ids)
  @request.put(['status', status], userIds: user_ids)
end

#change_people_type(type, user_ids) ⇒ Object



67
68
69
# File 'lib/teamlab/modules/people.rb', line 67

def change_people_type(type, user_ids)
  @request.put(['type', type.to_s], userIds: user_ids)
end

#delete(*user_ids) ⇒ Object



59
60
61
# File 'lib/teamlab/modules/people.rb', line 59

def delete(*user_ids)
  @request.put(['delete'], userIds: user_ids.flatten)
end

#delete_contacts(user_id, contacts) ⇒ Object



95
96
97
# File 'lib/teamlab/modules/people.rb', line 95

def delete_contacts(user_id, contacts)
  @request.delete([user_id, 'contacts'], contacts: contacts)
end

#delete_photo(user_id) ⇒ Object



91
92
93
# File 'lib/teamlab/modules/people.rb', line 91

def delete_photo(user_id)
  @request.delete([user_id, 'photo'])
end

#delete_user(user_id) ⇒ Object



87
88
89
# File 'lib/teamlab/modules/people.rb', line 87

def delete_user(user_id)
  @request.delete([user_id])
end

#filter_people(filters) ⇒ Object



19
20
21
# File 'lib/teamlab/modules/people.rb', line 19

def filter_people(filters)
  @request.get(['filter'], filters)
end

#get_peopleObject



7
8
9
# File 'lib/teamlab/modules/people.rb', line 7

def get_people
  @request.get
end

#get_people_by_search_query(query) ⇒ Object



31
32
33
# File 'lib/teamlab/modules/people.rb', line 31

def get_people_by_search_query(query)
  @request.get(['@search', query])
end

#get_people_by_status(status) ⇒ Object



27
28
29
# File 'lib/teamlab/modules/people.rb', line 27

def get_people_by_status(status)
  @request.get(['status', status])
end

#get_selfObject



11
12
13
# File 'lib/teamlab/modules/people.rb', line 11

def get_self
  @request.get(['@self'])
end

#get_user_by_username(username) ⇒ Object



23
24
25
# File 'lib/teamlab/modules/people.rb', line 23

def get_user_by_username(username)
  @request.get([username.to_s])
end


83
84
85
# File 'lib/teamlab/modules/people.rb', line 83

def (profile)
  @request.put([%w(thirdparty linkaccount)], serializedProfile: profile)
end

#remind_password(user_id, email) ⇒ Object



35
36
37
# File 'lib/teamlab/modules/people.rb', line 35

def remind_password(user_id, email)
  @request.get([user_id, 'password'], email: email)
end

#search_people(query) ⇒ Object



15
16
17
# File 'lib/teamlab/modules/people.rb', line 15

def search_people(query)
  @request.get(['search'], query: query)
end

#search_with_status(status, query) ⇒ Object



39
40
41
# File 'lib/teamlab/modules/people.rb', line 39

def search_with_status(status, query)
  @request.get(['status', status.to_s, 'search'], query: query.to_s)
end

#send_invite(*user_ids) ⇒ Object



55
56
57
# File 'lib/teamlab/modules/people.rb', line 55

def send_invite(*user_ids)
  @request.put(['invite'], userIds: user_ids.flatten)
end


99
100
101
# File 'lib/teamlab/modules/people.rb', line 99

def (provider)
  @request.delete([%w(thirdparty unlinkaccount)], provider: provider)
end

#update_contacts(user_id, contacts = {}) ⇒ Object



51
52
53
# File 'lib/teamlab/modules/people.rb', line 51

def update_contacts(user_id, contacts = {})
  @request.post([user_id, 'contacts'], contacts)
end

#update_photo(user_id, path) ⇒ Object



71
72
73
# File 'lib/teamlab/modules/people.rb', line 71

def update_photo(user_id, path)
  @request.put([user_id.to_s, 'photo'], files: path)
end

#update_user(user_id, is_visitor, email, firstname, lastname, options = {}) ⇒ Object



63
64
65
# File 'lib/teamlab/modules/people.rb', line 63

def update_user(user_id, is_visitor, email, firstname, lastname, options = {})
  @request.put([user_id.to_s], { isVisitor: is_visitor, email: email, firstname: firstname, lastname: lastname }.merge(options))
end