Class: LingotekClient::Resource::User
- Inherits:
-
Base
- Object
- Base
- LingotekClient::Resource::User
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
#username ⇒ Object
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.enable_login(username, password)
JSON.parse(Lingotek::API::api.allowLocalLogin(externalId: username, password: password))['result'] == 'success'
end
|
.valid_credentials?(username, password) ⇒ 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 enable_login(password)
enable_login(@username, password)
end
|
#valid_credentials?(password) ⇒ Boolean
10
11
12
|
# File 'lib/lingotek-client/resource/user.rb', line 10
def valid_credentials?(password)
User.valid_credentials?(@username, password)
end
|