Class: DoceboRuby::User

Inherits:
Resource
  • Object
show all
Defined in:
lib/docebo_ruby/user.rb

Class Method Summary collapse

Methods inherited from Resource

api, api=, fetch_data

Class Method Details

.authenticate(username, password) ⇒ Object



14
15
16
17
18
# File 'lib/docebo_ruby/user.rb', line 14

def authenticate(username, password)
  fetch_data('authenticate', {password: password, username: username}) do |response|
    response['id_user'] || false
  end
end

.check_username(username) ⇒ Object



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

def check_username(username)
  fetch_data('checkUsername', {userid: username})['success']
end

.create(attributes = {}) ⇒ Object



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

def create(attributes = {})
  fetch_data('create', attributes)
end

.sso_url(username) ⇒ Object



20
21
22
23
24
# File 'lib/docebo_ruby/user.rb', line 20

def sso_url(username)
  timestamp = Time.now.to_i
  token = Digest::MD5.hexdigest([username, timestamp, DoceboRuby.config.sso_token].join(','))
  "http://#{DoceboRuby.config.saas_url}/doceboLms/index.php?auth_regen=1&modname=login&op=confirm&login_user=#{username}&time=#{timestamp}&token=#{token}"
end