Module: BridgeAPI::Client::User

Defined in:
lib/bridge_api/client/user.rb

Instance Method Summary collapse

Instance Method Details

#add_user(params = {}) ⇒ Object



6
7
8
# File 'lib/bridge_api/client/user.rb', line 6

def add_user(params = {})
  post("#{API_PATH}#{ADMIN_PATH}#{USER_PATH}", params)
end

#add_user_to_role_batch(user_id, params = {}) ⇒ Object



42
43
44
# File 'lib/bridge_api/client/user.rb', line 42

def add_user_to_role_batch(user_id, params = {})
  put("#{API_PATH}#{ADMIN_PATH}#{USER_PATH}/#{user_id}#{ROLE_PATH}#{BATCH_PATH}", params)
end

#delete_user(user_id, params = {}) ⇒ Object



14
15
16
# File 'lib/bridge_api/client/user.rb', line 14

def delete_user(user_id, params = {})
  delete("#{API_PATH}#{ADMIN_PATH}#{USER_PATH}/#{user_id}", params)
end

#get_all_users(params = {}) ⇒ Object



38
39
40
# File 'lib/bridge_api/client/user.rb', line 38

def get_all_users(params = {})
  get("#{API_PATH}#{AUTHOR_PATH}#{USER_PATH}", params)
end

#get_user(user_id, params = {}) ⇒ Object



10
11
12
# File 'lib/bridge_api/client/user.rb', line 10

def get_user(user_id, params = {})
  get("#{API_PATH}#{AUTHOR_PATH}#{USER_PATH}/#{user_id}", params)
end

#new_temporary_users(params = {}) ⇒ Object



46
47
48
# File 'lib/bridge_api/client/user.rb', line 46

def new_temporary_users(params = {})
  get("#{API_PATH}#{ADMIN_PATH}#{NEW_TEMPORARY_USERS}", params)
end

#restore_deleted_user(user_id, params = {}) ⇒ Object



22
23
24
# File 'lib/bridge_api/client/user.rb', line 22

def restore_deleted_user(user_id, params = {})
  post("#{API_PATH}#{AUTHOR_PATH}#{USER_PATH}/#{user_id}#{RESTORE_PATH}", params)
end

#update_user(user_id, params = {}) ⇒ Object



18
19
20
# File 'lib/bridge_api/client/user.rb', line 18

def update_user(user_id, params = {})
  put("#{API_PATH}#{AUTHOR_PATH}#{USER_PATH}/#{user_id}", params)
end

#update_user_with_custom_values(user_id, custom_params, params = {}) ⇒ Object

Used for easier handling of updating custom params. This method will handle the lookup of existing custom_field_value ids and insert them as needed. user_id Bridge user ID custom_params See build_custom_values_payload method for formatting. params any bridge allowed params to be updated on the user



31
32
33
34
35
36
# File 'lib/bridge_api/client/user.rb', line 31

def update_user_with_custom_values(user_id, custom_params, params = {})
  params ||= {}
  params['user'] ||= {}
  params['user']['custom_field_values'] = build_custom_values_payload(user_id, custom_params)
  update_user(user_id, params)
end