Class: Teamlab::People

Inherits:
Object
  • Object
show all
Includes:
PeopleReassign, PeopleRemove
Defined in:
lib/teamlab/modules/people.rb

Instance Method Summary collapse

Methods included from PeopleRemove

#remove_progress, #start_remove, #terminate_remove

Methods included from PeopleReassign

#reassign_progress, #start_reassign_user_data, #terminate_reassign

Constructor Details

#initialize(config = nil) ⇒ People

Returns a new instance of People.



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

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

Instance Method Details

#add_contacts(contacts, user_id) ⇒ Object



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

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

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



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

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



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

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

#change_people_type(type, user_ids) ⇒ Object



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

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

#delete(*user_ids) ⇒ Object



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

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

#delete_contacts(user_id, contacts) ⇒ Object



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

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

#delete_photo(user_id) ⇒ Object



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

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

#delete_user(user_id) ⇒ Object



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

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

#filter_people(filters) ⇒ Object



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

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

#get_peopleObject



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

def get_people
  @request.get
end

#get_people_by_search_query(query) ⇒ Object



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

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

#get_people_by_status(status) ⇒ Object



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

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

#get_selfObject



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

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

#get_user_by_email(email) ⇒ Hash

Return the detailed information about the profile of the user with the email specified in the request

Parameters:

  • email (String)

    User email

Returns:

  • (Hash)

    result user search by email



105
106
107
# File 'lib/teamlab/modules/people.rb', line 105

def get_user_by_email(email)
  @request.get(['email'], email: email)
end

#get_user_by_username(username) ⇒ Object



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

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

#get_user_photoes(user_id) ⇒ Hash

Get user photos

Parameters:

  • userid (String)

    User ID

Returns:

  • (Hash)

    result user photos



112
113
114
# File 'lib/teamlab/modules/people.rb', line 112

def get_user_photoes(user_id)
  @request.get([user_id, 'photo'])
end

#join_to_affiliate_programmeString

Join to affiliate programme

Returns:

  • (String)

    link to affiliate programme



124
125
126
# File 'lib/teamlab/modules/people.rb', line 124

def join_to_affiliate_programme
  @request.put(%w[self joinaffiliate])
end


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

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

#search_people(query) ⇒ Object



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

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

#search_with_status(status, query) ⇒ Object



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

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

#send_delete_instructionVoid

Send instructions for delete user own profile

Returns:

  • (Void)

    send ‘Deletion of your profile` letter



118
119
120
# File 'lib/teamlab/modules/people.rb', line 118

def send_delete_instruction
  @request.put(%w[self delete])
end

#send_invite(*user_ids) ⇒ Object



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

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


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

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

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



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

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

#update_photo(user_id, path) ⇒ Object



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

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



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

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