Base class for all Engine models
PlaceOS::Model::Asset
Inherits PlaceOS::Model::Timestamps < PlaceOS::Model::ModelBase < PlaceOS::Model::Associations < Neuroplastic < PgORM::Base < PgORM::Validators < PgORM::Table < PgORM::Persistence < PgORM::Associations < ActiveModel::Callbacks < ActiveModel::Validation < ActiveModel::Model < DB::Mappable < DB::Serializable < YAML::Serializable < JSON::Serializable < Reference < Object
Constants
macro level key => type
Constructors
Deserializes the given JSON in string_or_io into
an instance of self, assuming the JSON consists
of an JSON object with key root, and whose value is
the value to deserialize. Will not deserialise from
fields with mass_assign: false
class User < ActiveModel::Model
attribute name : String
attribute google_id : UUID, mass_assign: false
end
User.from_json(%({"main": {"name": "Jason", "google_id": "f6f70bfb-c882-446d-8758-7ce47db39620"}}), root: "main") # => #<User:0x103131b20 @name="Jason">
Serialize from a trusted JSON source
Serialize from a trusted YAML source
Initialize PlaceOS::Model::Asset from HTTP::Params.
Class methods
Returns all attribute keys.
Changefeed at row (if id passed) or whole table level.
Returns a ChangeFeed instance which can be used to invoke async callbacks via on or
use blocking Iterator via each method.
Instance methods
attribute parent_id : String? # nested resource like lockers and locker banks
attribute parent_id : String? # nested resource like lockers and locker banks
accessible getter
accessible setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include accessible in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Generate code to apply default values
asset_type_id getter
asset_type_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
asset_type_id's default value
Include asset_type_id in the set of changed attributes, whether it has changed or not.
Assign to multiple attributes.
Assign to multiple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Assign each field from JSON if field exists in JSON and has changed in model
Uses the YAML parser as JSON is valid YAML
assigned_name getter
assigned_name setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include assigned_name in the set of changed attributes, whether it has changed or not.
assigned_to getter
assigned_to setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include assigned_to in the set of changed attributes, whether it has changed or not.
Returns a Hash of all attribute values
Returns a NamedTuple of all attribute values.
barcode getter
barcode setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include barcode in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
bookable getter
bookable setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include bookable in the set of changed attributes, whether it has changed or not.
Check if any attributes have changed.
Returns a Hash with all changed attributes.
Serialize the set of changed attributes to JSON.
Serialize the set of changed attributes to JSON.
Serialize the set of changed attributes to YAML.
Serialize the set of changed attributes to YAML.
Reset changes for all attributes.
client_ids getter
client_ids setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include client_ids in the set of changed attributes, whether it has changed or not.
created_at getter
Setters
created_at setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
created_at's default value
Include created_at in the set of changed attributes, whether it has changed or not.
features getter
features setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
queryable with AND and OR operators
Include features in the set of changed attributes, whether it has changed or not.
id getter
id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
id's default value
Include id in the set of changed attributes, whether it has changed or not.
identifier getter
identifier setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include identifier in the set of changed attributes, whether it has changed or not.
images getter
images setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include images in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
map_id getter
map_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include map_id in the set of changed attributes, whether it has changed or not.
name getter
name setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include name in the set of changed attributes, whether it has changed or not.
notes getter
notes setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include notes in the set of changed attributes, whether it has changed or not.
other_data getter
other_data setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include other_data in the set of changed attributes, whether it has changed or not.
parent_id getter
parent_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
parent_id's default value
attribute parent_id : String? # nested resource like lockers and locker banks
Include parent_id in the set of changed attributes, whether it has changed or not.
Returns a Hash of all attributes that can be persisted.
place_groups getter
place_groups setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include place_groups in the set of changed attributes, whether it has changed or not.
purchase_order_id getter
purchase_order_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
purchase_order_id's default value
Include purchase_order_id in the set of changed attributes, whether it has changed or not.
attribute parent_id : String? # nested resource like lockers and locker banks
Reset each attribute to their previous values and clears all changes.
security_system_groups getter
security_system_groups setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include security_system_groups in the set of changed attributes, whether it has changed or not.
serial_number getter
serial_number setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include serial_number in the set of changed attributes, whether it has changed or not.
updated_at getter
updated_at setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
updated_at's default value
Include updated_at in the set of changed attributes, whether it has changed or not.
Validate that all non-nillable fields have values.
zone_id getter
zone_id setter
Returns a Tuple of the previous and the current value of an instance variable if it has changed
zone_id's default value
Include zone_id in the set of changed attributes, whether it has changed or not.
zones getter
zones setter
NOTE: use getter / getter! (not property / property!) so that the
setter defined later in __create_initializer__ is the only setter on
the field. Crystal's overload resolution silently fails to replace a
property-defined setter with one of identical signature for generic
types (e.g. Set(String)?, Array(String)?, String | Array(String)),
although it does work for non-generic ones like String?. Defining the
setter only once via __create_initializer__ ensures change tracking,
sanitization, and custom setter blocks run uniformly across all types.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include zones in the set of changed attributes, whether it has changed or not.