Module: Users
- Included in:
- Config
- Defined in:
- lib/user/config/users.rb
Instance Method Summary collapse
-
#can_users_coach ⇒ Object
Users.
-
#create_user(data, options = nil) ⇒ Object
Create user.
-
#get_user(id) ⇒ Object
Get user.
-
#get_users(options) ⇒ Object
Get users.
-
#update_user(id, data, options = nil) ⇒ Object
Update user.
Instance Method Details
#can_users_coach ⇒ Object
Users
Can Users Coach.
Determine if users can coach.
Example
@data = @cxf_user.can_users_coach
13 14 15 |
# File 'lib/user/config/users.rb', line 13 def can_users_coach @client.raw('get', '/config/users/can_coach') end |
#create_user(data, options = nil) ⇒ Object
Create user.
Create an user with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
name: 'New User Name',
email: 'new_user_email@example.com',
is_confirmed: false,
set_password: true,
password: '123456',
is_coach: false
}
@data = @cxf_user.create_user(data)
54 55 56 |
# File 'lib/user/config/users.rb', line 54 def create_user(data, = nil) @client.raw('post', '/config/users', , data_transform(data)) end |
#get_user(id) ⇒ Object
Get user.
Get an user info.
Parameters
- id
-
(Integer) – User id.
Example
@data = @cxf_user.get_user(8)
34 35 36 |
# File 'lib/user/config/users.rb', line 34 def get_user(id) @client.raw('get', "/config/users/#{id}") end |
#get_users(options) ⇒ Object
Get users.
Get a collection of users.
Example
@data = @cxf_user.get_users
22 23 24 |
# File 'lib/user/config/users.rb', line 22 def get_users() @client.raw('get', '/config/users', ) end |
#update_user(id, data, options = nil) ⇒ Object
Update user.
Update an user info.
Parameters
- id
-
(Integer) – User id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
name: 'New User Name Modified',
email: 'new_user_name@example.com',
is_active: true,
is_confirmed: false,
roles: ''
}
@data = @cxf_user.update_user(14, data)
74 75 76 |
# File 'lib/user/config/users.rb', line 74 def update_user(id, data, = nil) @client.raw('put', "/config/users/#{id}", , data_transform(data)) end |