Class: LingotekClient::Resource::User

Inherits:
Base
  • Object
show all
Defined in:
lib/lingotek-client/resource/user.rb

Constant Summary

Constants inherited from Base

Base::ERRORS, Base::FAIL, Base::RESULTS

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, find, key

Constructor Details

#initialize(opts = {}) ⇒ User

Returns a new instance of User.



5
6
7
# File 'lib/lingotek-client/resource/user.rb', line 5

def initialize(opts = {})
  @username = opts[:username]
end

Instance Attribute Details

#usernameObject

Returns the value of attribute username.



4
5
6
# File 'lib/lingotek-client/resource/user.rb', line 4

def username
  @username
end

Class Method Details

.enable_login(username, password) ⇒ Object



22
23
24
# File 'lib/lingotek-client/resource/user.rb', line 22

def self.(username, password)
  JSON.parse(Lingotek::API::api.allowLocalLogin(externalId: username, password: password))['result'] == 'success'
end

.valid_credentials?(username, password) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/lingotek-client/resource/user.rb', line 14

def self.valid_credentials?(username, password)
  JSON.parse(Lingotek::API::api.validateCredentials(externalId: username, password: password))['result'] == 'success'
end

Instance Method Details

#enable_login(password) ⇒ Object



18
19
20
# File 'lib/lingotek-client/resource/user.rb', line 18

def (password)
  (@username, password)
end

#valid_credentials?(password) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/lingotek-client/resource/user.rb', line 10

def valid_credentials?(password)
  User.valid_credentials?(@username, password)
end