class Brivo::Credential

Attributes

application[RW]
field_values[R]
id[R]
reference_id[R]

Public Class Methods

create(id:, facility_code: application.create_credential(id, facility_code)) click to toggle source
# File lib/brivo/credential.rb, line 10
def create id:, facility_code:
  application.create_credential(id, facility_code)
end
new(attributes = {}) click to toggle source
# 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

Public Instance Methods

delete() click to toggle source
# File lib/brivo/credential.rb, line 25
def delete
  application.delete_credential(id)
end
user() click to toggle source
# File lib/brivo/credential.rb, line 29
def user
  application.credential_user(id)
end

Private Instance Methods

application() click to toggle source
# File lib/brivo/credential.rb, line 35
def application
  self.class.application
end