Class: SmartRecruiters::UsersResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/smartrecruiters/resources/users.rb

Constant Summary collapse

USER_API =
'user-api/v201804'

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from SmartRecruiters::Resource

Instance Method Details

#activate(user_id:, **attributes) ⇒ Object



23
24
25
# File 'lib/smartrecruiters/resources/users.rb', line 23

def activate(user_id:, **attributes)
  put_request("#{USER_API}/users/#{user_id}/activation", body: attributes)
end

#activation_email(user_id:, **attributes) ⇒ Object



27
28
29
# File 'lib/smartrecruiters/resources/users.rb', line 27

def activation_email(user_id:, **attributes)
  post_request("#{USER_API}/users/#{user_id}/activation-email", body: attributes)
end

#create(**attributes) ⇒ Object



11
12
13
# File 'lib/smartrecruiters/resources/users.rb', line 11

def create(**attributes)
  User.new post_request("#{USER_API}/users", body: attributes).body
end

#deactivate(user_id:) ⇒ Object



31
32
33
# File 'lib/smartrecruiters/resources/users.rb', line 31

def deactivate(user_id:)
  delete_request("#{USER_API}/users/#{user_id}/activation")
end

#list(**params) ⇒ Object



7
8
9
# File 'lib/smartrecruiters/resources/users.rb', line 7

def list(**params)
  Collection.from_response get_request("#{USER_API}/users", params: params), type: User
end

#retrieve(user_id:) ⇒ Object



15
16
17
# File 'lib/smartrecruiters/resources/users.rb', line 15

def retrieve(user_id:)
  User.new get_request("#{USER_API}/users/#{user_id}").body
end

#update(user_id:, changes:) ⇒ Object



19
20
21
# File 'lib/smartrecruiters/resources/users.rb', line 19

def update(user_id:, changes:)
  User.new patch_request("#{USER_API}/users/#{user_id}", body: changes).body
end