Class: Brivo::Credential
- Inherits:
-
Object
- Object
- Brivo::Credential
- Defined in:
- lib/brivo/credential.rb
Class Attribute Summary collapse
-
.application ⇒ Object
Returns the value of attribute application.
Instance Attribute Summary collapse
-
#field_values ⇒ Object
readonly
Returns the value of attribute field_values.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#reference_id ⇒ Object
readonly
Returns the value of attribute reference_id.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(attributes = {}) ⇒ Credential
constructor
A new instance of Credential.
- #user ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Credential
Returns a new instance of Credential.
15 16 17 18 19 20 21 22 23 |
# File 'lib/brivo/credential.rb', line 15 def initialize attributes = {} @id = attributes['id'] @reference_id = attributes['referenceId'] @field_values = attributes['fieldValues']&.map do |field_value| field_value.inject({}) do |m, (k, v)| m.tap { m[k.to_sym] = v } end end end |
Class Attribute Details
.application ⇒ Object
Returns the value of attribute application.
8 9 10 |
# File 'lib/brivo/credential.rb', line 8 def application @application end |
Instance Attribute Details
#field_values ⇒ Object (readonly)
Returns the value of attribute field_values.
5 6 7 |
# File 'lib/brivo/credential.rb', line 5 def field_values @field_values end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/brivo/credential.rb', line 5 def id @id end |
#reference_id ⇒ Object (readonly)
Returns the value of attribute reference_id.
5 6 7 |
# File 'lib/brivo/credential.rb', line 5 def reference_id @reference_id end |
Class Method Details
.create(id:, facility_code:) ⇒ Object
10 11 12 |
# File 'lib/brivo/credential.rb', line 10 def create id:, facility_code: application.create_credential(id, facility_code) end |
Instance Method Details
#delete ⇒ Object
25 26 27 |
# File 'lib/brivo/credential.rb', line 25 def delete application.delete_credential(id) end |
#user ⇒ Object
29 30 31 |
# File 'lib/brivo/credential.rb', line 29 def user application.credential_user(id) end |