class PlaceOS::Model::ControlSystem
- PlaceOS::Model::ControlSystem
- PlaceOS::Model::ModelBase
- PgORM::Base
- ActiveModel::Model
- Reference
- Object
Included Modules
- PlaceOS::Model::Playlist::Checker
- PlaceOS::Model::Timestamps
- PlaceOS::Model::Utilities::MetadataHelper
- PlaceOS::Model::Utilities::SettingsHelper
Defined in:
placeos-models/control_system.crConstant Summary
-
CALLBACKS =
{before_save: [:check_playlists, :check_zones, :check_modules] of Nil, after_save: [:update_triggers] of Nil, before_create: [do self.created_at = self.updated_at = Time.utc end] of Nil, after_create: [] of Nil, before_update: [do self.updated_at = Time.utc end] of Nil, after_update: [] of Nil, before_destroy: [:destroy_settings_and_versions, :destroy_metadata_and_versions, :destroy_system_triggers, :cleanup_modules] of Nil, after_destroy: [] of Nil}
-
Log =
::Log.for(self)
Constructors
- .from_json(string_or_io : String | IO, trusted : Bool = false) : self
-
.from_json(string_or_io : String | IO, root : String, trusted : Bool = false) : self
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. - .from_trusted_json(string_or_io : String | IO, root : String) : self
-
.from_trusted_json(string_or_io : String | IO) : self
Serialize from a trusted JSON source
-
.from_trusted_yaml(string_or_io : String | IO) : self
Serialize from a trusted YAML source
- .from_yaml(string_or_io : String | IO, trusted : Bool = false) : self
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new(rs : DB::ResultSet)
- .new(created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, updated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, name : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, description : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, features : Set(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, email : PlaceOS::Model::Email | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, bookable : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, public : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, display_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, code : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, type : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, capacity : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, map_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, images : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, timezone : Time::Location | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, support_url : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, version : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, installed_ui_devices : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, zones : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, modules : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, orientation : PlaceOS::Model::Playlist::Orientation | ActiveModel::Model::None = ::ActiveModel::Model::None.new, playlists : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, signage : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new)
-
.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Initialize PlaceOS::Model::ControlSystem from
HTTP::Params
.
Class Method Summary
- .add_module(control_system_id : String, module_id : String)
-
.attributes : Array(Symbol)
Returns all attribute keys.
- .auto_generate_id : Bool
- .by_module_id(id)
- .by_zone_id(id)
-
.changes(id : PrimaryKeyType = nil) : ChangeFeed
Changefeed at row (if
#id
passed) or whole table level. - .elastic
- .from_rs(__temp_719 : DB::ResultSet)
-
.in_zone(id)
DEPRECATED Use
.by_zone_id
- .on_error(err : Exception | IO::Error)
- .primary_key : Symbol
- .remove_module(control_system_id : String, module_id : String)
- .table_name
-
.using_module(id)
DEPRECATED Use
.by_module_id
- .with_playlists(ids : Enumerable(String))
Instance Method Summary
-
#add_module(module_id : String)
Removes the module from the system and deletes it if not used elsewhere
-
#after_create
Base class for all Engine models
-
#after_destroy
Base class for all Engine models
- #after_initialize(trusted : Bool)
-
#after_save
Base class for all Engine models
-
#after_update
Base class for all Engine models
- #all_playlists : Hash(String, Array(String))
-
#apply_defaults
Generate code to apply default values
-
#assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, name : String | Missing = Missing, description : String | Missing = Missing, features : Set(String) | Missing = Missing, email : PlaceOS::Model::Email | Nil | Missing = Missing, bookable : Bool | Missing = Missing, public : Bool | Missing = Missing, display_name : String | Nil | Missing = Missing, code : String | Nil | Missing = Missing, type : String | Nil | Missing = Missing, capacity : Int32 | Missing = Missing, map_id : String | Nil | Missing = Missing, images : Array(String) | Missing = Missing, timezone : Time::Location | Nil | Missing = Missing, support_url : String | Missing = Missing, version : Int32 | Missing = Missing, installed_ui_devices : Int32 | Missing = Missing, zones : Array(String) | Missing = Missing, modules : Array(String) | Missing = Missing, orientation : PlaceOS::Model::Playlist::Orientation | Missing = Missing, playlists : Array(String) | Missing = Missing, signage : Bool | Missing = Missing, id : String | Nil | Missing = Missing)
Assign to multiple attributes.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params
. -
#assign_attributes(model : PlaceOS::Model::ControlSystem)
Assign to multiple attributes from a model object
- #assign_attributes_from_json(json, root : String)
- #assign_attributes_from_json(json)
- #assign_attributes_from_trusted_json(json, root : String)
-
#assign_attributes_from_trusted_json(json)
Assign each field from JSON if field exists in JSON and has changed in model
- #assign_attributes_from_trusted_yaml(yaml)
-
#assign_attributes_from_yaml(yaml)
Uses the YAML parser as JSON is valid YAML
-
#attributes
Returns a
Hash
of all attribute values -
#attributes_tuple
Returns a
NamedTuple
of all attribute values. -
#before_create
Base class for all Engine models
-
#before_destroy
Base class for all Engine models
-
#before_save
Base class for all Engine models
-
#before_update
Base class for all Engine models
-
#bookable : Bool
#bookable
getter -
#bookable=(value : Bool)
#bookable
setter - #bookable? : Bool | Nil
- #bookable_assigned? : Bool
-
#bookable_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #bookable_changed? : Bool
-
#bookable_default : Bool
#bookable
's default value - #bookable_present? : Bool
- #bookable_was : Bool | Nil
-
#bookable_will_change! : Nil
Include
#bookable
in the set of changed attributes, whether it has changed or not. -
#capacity : Int32
#capacity
getter -
#capacity=(value : Int32)
#capacity
setter - #capacity? : Int32 | Nil
- #capacity_assigned? : Bool
-
#capacity_change : Tuple(Int32 | Nil, Int32 | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #capacity_changed? : Bool
-
#capacity_default : Int32
#capacity
's default value - #capacity_present? : Bool
- #capacity_was : Int32 | Nil
-
#capacity_will_change! : Nil
Include
#capacity
in the set of changed attributes, whether it has changed or not. -
#changed?
Check if any attributes have changed.
-
#changed_attributes
Returns a
Hash
with all changed attributes. -
#changed_json(io : IO) : Nil
Serialize the set of changed attributes to JSON.
-
#changed_json : String
Serialize the set of changed attributes to JSON.
- #changed_persist_attributes
-
#changed_yaml(io : IO) : Nil
Serialize the set of changed attributes to YAML.
-
#changed_yaml : String
Serialize the set of changed attributes to YAML.
-
#check_modules
ensure all the modules are valid and exist
-
#cleanup_modules
Remove Modules not associated with any other systems NOTE: Includes compulsory associated Logic Modules
-
#clear_changes_information
Reset changes for all attributes.
-
#code : String | Nil
#code
getter -
#code=(value : String | Nil)
#code
setter - #code_assigned? : Bool
-
#code_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #code_changed? : Bool
-
#code_default : String | Nil
#code
's default value - #code_present? : Bool
- #code_was : String | Nil | Nil
-
#code_will_change! : Nil
Include
#code
in the set of changed attributes, whether it has changed or not. -
#created_at : Time
#created_at
getter -
#created_at=(value : Time)
Setters
#created_at
setter - #created_at? : Time | Nil
- #created_at_assigned? : Bool
-
#created_at_change : Tuple(Time | Nil, Time | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #created_at_changed? : Bool
-
#created_at_default : Time
#created_at
's default value - #created_at_present? : Bool
- #created_at_was : Time | Nil
-
#created_at_will_change! : Nil
Include
#created_at
in the set of changed attributes, whether it has changed or not. -
#description : String
#description
getter -
#description=(value : String)
#description
setter - #description? : String | Nil
- #description_assigned? : Bool
-
#description_change : Tuple(String | Nil, String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #description_changed? : Bool
-
#description_default : String
#description
's default value - #description_present? : Bool
- #description_was : String | Nil
-
#description_will_change! : Nil
Include
#description
in the set of changed attributes, whether it has changed or not. -
#destroy_metadata_and_versions
Metadata belonging to this control_system
-
#destroy_settings_and_versions
Encrypted yaml settings, with metadata
-
#destroy_system_triggers
Single System triggers
-
#display_name : String | Nil
#display_name
getter -
#display_name=(value : String | Nil)
#display_name
setter - #display_name_assigned? : Bool
-
#display_name_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #display_name_changed? : Bool
-
#display_name_default : String | Nil
#display_name
's default value - #display_name_present? : Bool
- #display_name_was : String | Nil | Nil
-
#display_name_will_change! : Nil
Include
#display_name
in the set of changed attributes, whether it has changed or not. -
#email : PlaceOS::Model::Email | Nil
#email
getter -
#email=(value : PlaceOS::Model::Email | Nil)
#email
setter - #email_assigned? : Bool
-
#email_change : Tuple(PlaceOS::Model::Email | Nil | Nil, PlaceOS::Model::Email | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #email_changed? : Bool
-
#email_default : Email | Nil
#email
's default value - #email_present? : Bool
- #email_was : PlaceOS::Model::Email | Nil | Nil
-
#email_will_change! : Nil
Include
#email
in the set of changed attributes, whether it has changed or not. -
#features : Set(String)
#features
getter -
#features=(value : Set(String))
#features
setter -
#features? : Set(String) | Nil
Room search meta-data Building + Level are both filtered using zones
- #features_assigned? : Bool
-
#features_change : Tuple(Set(String) | Nil, Set(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #features_changed? : Bool
-
#features_default : Set(String)
#features
's default value -
#features_present? : Bool
Room search meta-data Building + Level are both filtered using zones
- #features_was : Set(String) | Nil
-
#features_will_change! : Nil
Include
#features
in the set of changed attributes, whether it has changed or not. -
#id : String | Nil
#id
getter -
#id=(value : String | Nil)
#id
setter -
#id? : String | Nil | Nil
Same as
#id
but may returnnil
when the record hasn't been saved instead of raising. - #id_assigned? : Bool
-
#id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #id_changed? : Bool
-
#id_default : String | Nil
#id
's default value - #id_present? : Bool
- #id_was : String | Nil | Nil
-
#id_will_change! : Nil
Include
#id
in the set of changed attributes, whether it has changed or not. -
#images : Array(String)
#images
getter -
#images=(value : Array(String))
#images
setter -
#images? : Array(String) | Nil
Array of URLs to images for a system
- #images_assigned? : Bool
-
#images_change : Tuple(Array(String) | Nil, Array(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #images_changed? : Bool
-
#images_default : Array(String)
#images
's default value -
#images_present? : Bool
Array of URLs to images for a system
- #images_was : Array(String) | Nil
-
#images_will_change! : Nil
Include
#images
in the set of changed attributes, whether it has changed or not. -
#installed_ui_devices : Int32
#installed_ui_devices
getter -
#installed_ui_devices=(value : Int32)
#installed_ui_devices
setter -
#installed_ui_devices? : Int32 | Nil
The number of UI devices that are always available in the room i.e.
- #installed_ui_devices_assigned? : Bool
-
#installed_ui_devices_change : Tuple(Int32 | Nil, Int32 | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #installed_ui_devices_changed? : Bool
-
#installed_ui_devices_default : Int32
#installed_ui_devices
's default value -
#installed_ui_devices_present? : Bool
The number of UI devices that are always available in the room i.e.
- #installed_ui_devices_was : Int32 | Nil
-
#installed_ui_devices_will_change! : Nil
Include
#installed_ui_devices
in the set of changed attributes, whether it has changed or not. -
#invoke_props
Base class for all Engine models
-
#map_id : String | Nil
#map_id
getter -
#map_id=(value : String | Nil)
#map_id
setter - #map_id_assigned? : Bool
-
#map_id_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #map_id_changed? : Bool
-
#map_id_default : String | Nil
#map_id
's default value - #map_id_present? : Bool
- #map_id_was : String | Nil | Nil
-
#map_id_will_change! : Nil
Include
#map_id
in the set of changed attributes, whether it has changed or not. -
#metadata_and_versions
Metadata belonging to this control_system
-
#module_data
Obtains the control system's modules as json FIXME: Dreadfully needs optimisation, i.e.
-
#modules : Array(String)
#modules
getter -
#modules=(value : Array(String))
#modules
setter - #modules? : Array(String) | Nil
- #modules_assigned? : Bool
-
#modules_change : Tuple(Array(String) | Nil, Array(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #modules_changed? : Bool
-
#modules_default : Array(String)
#modules
's default value - #modules_present? : Bool
- #modules_was : Array(String) | Nil
-
#modules_will_change! : Nil
Include
#modules
in the set of changed attributes, whether it has changed or not. - #modules_with_single_occurrence : Array(Module)
-
#name : String
#name
getter -
#name=(value : String)
#name
setter - #name? : String | Nil
- #name_assigned? : Bool
-
#name_change : Tuple(String | Nil, String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #name_changed? : Bool
-
#name_default : String
#name
's default value - #name_present? : Bool
- #name_was : String | Nil
-
#name_will_change! : Nil
Include
#name
in the set of changed attributes, whether it has changed or not. -
#orientation : PlaceOS::Model::Playlist::Orientation
#orientation
getter -
#orientation=(value : PlaceOS::Model::Playlist::Orientation)
#orientation
setter -
#orientation? : PlaceOS::Model::Playlist::Orientation | Nil
Systems as digital signage displays playlists can be assigned directly to displays or to zones playlists in zones will only be loaded if they have matching orientations
- #orientation_assigned? : Bool
-
#orientation_change : Tuple(PlaceOS::Model::Playlist::Orientation | Nil, PlaceOS::Model::Playlist::Orientation | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #orientation_changed? : Bool
-
#orientation_default : Playlist::Orientation
#orientation
's default value -
#orientation_present? : Bool
Systems as digital signage displays playlists can be assigned directly to displays or to zones playlists in zones will only be loaded if they have matching orientations
- #orientation_was : PlaceOS::Model::Playlist::Orientation | Nil
-
#orientation_will_change! : Nil
Include
#orientation
in the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Returns a
Hash
of all attributes that can be persisted. -
#playlists : Array(String)
#playlists
getter -
#playlists=(value : Array(String))
#playlists
setter - #playlists? : Array(String) | Nil
- #playlists_assigned? : Bool
-
#playlists_change : Tuple(Array(String) | Nil, Array(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #playlists_changed? : Bool
-
#playlists_default : Array(String)
#playlists
's default value - #playlists_last_updated(playlists : Hash(String, Array(String)) = all_playlists) : Time
- #playlists_present? : Bool
- #playlists_was : Array(String) | Nil
-
#playlists_will_change! : Nil
Include
#playlists
in the set of changed attributes, whether it has changed or not. -
#public : Bool
#public
getter -
#public=(value : Bool)
#public
setter - #public? : Bool | Nil
- #public_assigned? : Bool
-
#public_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #public_changed? : Bool
-
#public_default : Bool
#public
's default value - #public_present? : Bool
- #public_was : Bool | Nil
-
#public_will_change! : Nil
Include
#public
in the set of changed attributes, whether it has changed or not. -
#remove_module(module_id : String)
Removes the module from the system and deletes it if not used elsewhere
-
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#run_create_callbacks(&)
Wrap a block with callbacks for the appropriate crud operation
-
#run_destroy_callbacks(&)
Base class for all Engine models
-
#run_save_callbacks(&)
Base class for all Engine models
-
#run_update_callbacks(&)
Base class for all Engine models
-
#settings_and_versions
Encrypted yaml settings, with metadata
-
#settings_hierarchy : Array(Settings)
Collect Settings ordered by hierarchy
-
#signage : Bool
#signage
getter -
#signage=(value : Bool)
#signage
setter - #signage? : Bool | Nil
- #signage_assigned? : Bool
-
#signage_change : Tuple(Bool | Nil, Bool | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #signage_changed? : Bool
-
#signage_default : Bool
#signage
's default value - #signage_present? : Bool
- #signage_was : Bool | Nil
-
#signage_will_change! : Nil
Include
#signage
in the set of changed attributes, whether it has changed or not. -
#support_url : String
#support_url
getter -
#support_url=(value : String)
#support_url
setter -
#support_url? : String | Nil
Provide a field for simplifying support
- #support_url_assigned? : Bool
-
#support_url_change : Tuple(String | Nil, String | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #support_url_changed? : Bool
-
#support_url_default : String
#support_url
's default value -
#support_url_present? : Bool
Provide a field for simplifying support
- #support_url_was : String | Nil
-
#support_url_will_change! : Nil
Include
#support_url
in the set of changed attributes, whether it has changed or not. -
#system_triggers
Single System triggers
- #table_name
-
#timezone : Time::Location | Nil
#timezone
getter -
#timezone=(value : Time::Location | Nil)
#timezone
setter - #timezone_assigned? : Bool
-
#timezone_change : Tuple(Time::Location | Nil | Nil, Time::Location | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #timezone_changed? : Bool
-
#timezone_default : Time::Location | Nil
#timezone
's default value - #timezone_present? : Bool
- #timezone_was : Time::Location | Nil | Nil
-
#timezone_will_change! : Nil
Include
#timezone
in the set of changed attributes, whether it has changed or not. -
#triggers
Triggers
-
#type : String | Nil
#type
getter -
#type=(value : String | Nil)
#type
setter - #type_assigned? : Bool
-
#type_change : Tuple(String | Nil | Nil, String | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #type_changed? : Bool
-
#type_default : String | Nil
#type
's default value - #type_present? : Bool
- #type_was : String | Nil | Nil
-
#type_will_change! : Nil
Include
#type
in the set of changed attributes, whether it has changed or not. -
#updated_at : Time
#updated_at
getter -
#updated_at=(value : Time)
#updated_at
setter - #updated_at? : Time | Nil
- #updated_at_assigned? : Bool
-
#updated_at_change : Tuple(Time | Nil, Time | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #updated_at_changed? : Bool
-
#updated_at_default : Time
#updated_at
's default value - #updated_at_present? : Bool
- #updated_at_was : Time | Nil
-
#updated_at_will_change! : Nil
Include
#updated_at
in the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
-
#version : Int32
#version
getter -
#version=(value : Int32)
#version
setter - #version? : Int32 | Nil
- #version_assigned? : Bool
-
#version_change : Tuple(Int32 | Nil, Int32 | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #version_changed? : Bool
-
#version_default : Int32
#version
's default value - #version_present? : Bool
- #version_was : Int32 | Nil
-
#version_will_change! : Nil
Include
#version
in the set of changed attributes, whether it has changed or not. -
#zone_data
Obtains the control system's zones as json
-
#zones : Array(String)
#zones
getter -
#zones=(value : Array(String))
#zones
setter -
#zones? : Array(String) | Nil
IDs of associated models
- #zones_assigned? : Bool
-
#zones_change : Tuple(Array(String) | Nil, Array(String) | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #zones_changed? : Bool
-
#zones_default : Array(String)
#zones
's default value -
#zones_present? : Bool
IDs of associated models
- #zones_was : Array(String) | Nil
-
#zones_will_change! : Nil
Include
#zones
in the set of changed attributes, whether it has changed or not.
Instance methods inherited from module PlaceOS::Model::Playlist::Checker
check_playlists
check_playlists
Instance methods inherited from module PlaceOS::Model::Utilities::MetadataHelper
metadata(name : String | Nil = nil) : Array(Metadata)
metadata
Instance methods inherited from module PlaceOS::Model::Utilities::SettingsHelper
all_settings : Hash(YAML::Any, YAML::Any)
all_settings,
settings : Array(Settings)
settings,
settings_at(encryption_level : Encryption::Level)
settings_at,
settings_at?(encryption_level : Encryption::Level)
settings_at?,
settings_hierarchy : Array(Settings)
settings_hierarchy,
settings_json : String
settings_json
Instance methods inherited from class PlaceOS::Model::ModelBase
after_create
after_create,
after_destroy
after_destroy,
after_save
after_save,
after_update
after_update,
apply_defaults
apply_defaults,
assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))assign_attributes(model : PlaceOS::Model::ModelBase)
assign_attributes assign_attributes, attributes attributes, attributes_tuple attributes_tuple, before_create before_create, before_destroy before_destroy, before_save before_save, before_update before_update, invoke_props invoke_props, persistent_attributes persistent_attributes, run_create_callbacks(&) run_create_callbacks, run_destroy_callbacks(&) run_destroy_callbacks, run_save_callbacks(&) run_save_callbacks, run_update_callbacks(&) run_update_callbacks
Constructor methods inherited from class PlaceOS::Model::ModelBase
new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)new(pull : JSON::PullParser)
new(rs : DB::ResultSet) new
Class methods inherited from class PlaceOS::Model::ModelBase
attributes : Array(Symbol)
attributes,
auto_generate_id : Bool
auto_generate_id,
from_rs(rs : DB::ResultSet)
from_rs,
primary_key : Symbol
primary_key
Instance methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres,
reset_associations
reset_associations
Class methods inherited from module PlaceOS::Model::Associations
format_list_for_postgres(list : Enumerable(String)) : String
format_list_for_postgres
Macros inherited from module PlaceOS::Model::Associations
belongs_to(parent_class, dependent = :none, association_name = nil, foreign_key = nil, presence = false, pk_type = nil, serialize = true)
belongs_to,
has_many(child_class, collection_name = nil, dependent = :none, foreign_key = nil, serialize = false)
has_many,
has_one(child_class, dependent = :none, association_name = nil, presence = false)
has_one
Constructor Detail
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::ControlSystem from HTTP::Params
.
Class Method Detail
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 Method Detail
Removes the module from the system and deletes it if not used elsewhere
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Assign to multiple attributes.
Assign to mulitple 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
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
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.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #capacity
in the set of changed attributes, whether it has changed or not.
Remove Modules not associated with any other systems
NOTE Includes compulsory associated Logic Modules
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #code
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #created_at
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #description
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #display_name
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #email
in the set of changed attributes, whether it has changed or not.
Room search meta-data Building + Level are both filtered using zones
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #features
in the set of changed attributes, whether it has changed or not.
Same as #id
but may return nil
when the record hasn't been saved
instead of raising.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #id
in the set of changed attributes, whether it has changed or not.
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.
The number of UI devices that are always available in the room i.e. the number of iPads mounted on the wall
Returns a Tuple of the previous and the current value of an instance variable if it has changed
The number of UI devices that are always available in the room i.e. the number of iPads mounted on the wall
Include #installed_ui_devices
in the set of changed attributes, whether it has changed or not.
Base class for all Engine models
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.
Obtains the control system's modules as json
FIXME Dreadfully needs optimisation, i.e. subset serialisation
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #modules
in the set of changed attributes, whether it has changed or not.
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.
Systems as digital signage displays playlists can be assigned directly to displays or to zones playlists in zones will only be loaded if they have matching orientations
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Systems as digital signage displays playlists can be assigned directly to displays or to zones playlists in zones will only be loaded if they have matching orientations
Include #orientation
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #playlists
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #public
in the set of changed attributes, whether it has changed or not.
Removes the module from the system and deletes it if not used elsewhere
Base class for all Engine models
Base class for all Engine models
Base class for all Engine models
Collect Settings ordered by hierarchy
Control System < Zone/n < Zone/(n-1) < ... < Zone/0
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #signage
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #support_url
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #timezone
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #type
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #updated_at
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #version
in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed