Class: LearnWorlds::UserResource
- Inherits:
-
Resource
- Object
- Resource
- LearnWorlds::UserResource
show all
- Defined in:
- lib/learn_worlds/resources/user_resource.rb
Constant Summary
collapse
- ENDPOINT =
"/admin/api/v2/users".freeze
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#default_headers, #delete_request, #get_request, #handle_errors, #handle_response, #initialize, #patch_request, #post_request, #put_request
Instance Method Details
33
34
35
36
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 33
def attach_tags(user_id:, tags:)
put_request("#{ENDPOINT}/#{user_id}/tags", tags: tags, action: 'attach')
true
end
|
#create(**attributes) ⇒ Object
10
11
12
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 10
def create(**attributes)
UserObject.new(post_request(ENDPOINT, attributes).body)
end
|
38
39
40
41
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 38
def detach_tags(user_id:, tags:)
put_request("#{ENDPOINT}/#{user_id}/tags", tags: tags, action: 'detach')
true
end
|
#enroll(user_id:, **attributes) ⇒ Object
28
29
30
31
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 28
def enroll(user_id:, **attributes)
post_request("#{ENDPOINT}/#{user_id}/enrollment", attributes)
true
end
|
#enrollments(user_id:) ⇒ Object
#find(user_id:) ⇒ Object
14
15
16
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 14
def find(user_id:)
UserObject.new(get_request("#{ENDPOINT}/#{user_id}").body)
end
|
#update(user_id:, **params) ⇒ Object
23
24
25
26
|
# File 'lib/learn_worlds/resources/user_resource.rb', line 23
def update(user_id:, **params)
put_request("#{ENDPOINT}/#{user_id}", params)
true
end
|