Class: Brivo::User
- Inherits:
-
Object
- Object
- Brivo::User
- Defined in:
- lib/brivo/user.rb
Class Attribute Summary collapse
-
.application ⇒ Object
Returns the value of attribute application.
Instance Attribute Summary collapse
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#suspended ⇒ Object
readonly
Returns the value of attribute suspended.
Class Method Summary collapse
Instance Method Summary collapse
- #assign_credential(credential_id, effective_from, effective_to) ⇒ Object
- #credentials ⇒ Object
- #delete ⇒ Object
- #groups ⇒ Object
-
#initialize(attributes = {}) ⇒ User
constructor
A new instance of User.
- #remove_credential(credential_id) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ User
Returns a new instance of User.
14 15 16 17 18 19 20 |
# File 'lib/brivo/user.rb', line 14 def initialize attributes = {} @id = attributes['id'] @first_name = attributes['firstName'] @last_name = attributes['lastName'] @external_id = attributes['externalId'] @suspended = attributes['suspended'] end |
Class Attribute Details
.application ⇒ Object
Returns the value of attribute application.
7 8 9 |
# File 'lib/brivo/user.rb', line 7 def application @application end |
Instance Attribute Details
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
5 6 7 |
# File 'lib/brivo/user.rb', line 5 def external_id @external_id end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/brivo/user.rb', line 5 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/brivo/user.rb', line 5 def id @id end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/brivo/user.rb', line 5 def last_name @last_name end |
#suspended ⇒ Object (readonly)
Returns the value of attribute suspended.
5 6 7 |
# File 'lib/brivo/user.rb', line 5 def suspended @suspended end |
Class Method Details
.create(first_name:, last_name:, external_id: nil, suspended: false) ⇒ Object
9 10 11 |
# File 'lib/brivo/user.rb', line 9 def create first_name:, last_name:, external_id: nil, suspended: false application.create_user(first_name, last_name, external_id, suspended) end |
Instance Method Details
#assign_credential(credential_id, effective_from, effective_to) ⇒ Object
34 35 36 |
# File 'lib/brivo/user.rb', line 34 def assign_credential credential_id, effective_from, effective_to application.user_assign_credential(id, credential_id, effective_from, effective_to) end |
#credentials ⇒ Object
30 31 32 |
# File 'lib/brivo/user.rb', line 30 def credentials application.user_credentials(id) end |
#delete ⇒ Object
22 23 24 |
# File 'lib/brivo/user.rb', line 22 def delete application.delete_user(id) end |
#groups ⇒ Object
26 27 28 |
# File 'lib/brivo/user.rb', line 26 def groups application.user_groups(id) end |
#remove_credential(credential_id) ⇒ Object
38 39 40 |
# File 'lib/brivo/user.rb', line 38 def remove_credential credential_id application.user_remove_credential(id, credential_id) end |