class PlaceOS::Model::Module
- PlaceOS::Model::Module
- PlaceOS::Model::ModelBase
- PgORM::Base
- ActiveModel::Model
- Reference
- Object
Included Modules
Defined in:
placeos-models/module.crConstant Summary
-
CALLBACKS =
{before_save: [:set_name_and_role] of Nil, after_save: [] of Nil, before_create: [do self.created_at = self.updated_at = Time.utc end, :set_edge_hint] of Nil, after_create: [:add_logic_module] of Nil, before_update: [do self.updated_at = Time.utc end] of Nil, after_update: [] of Nil, before_destroy: [:destroy_settings_and_versions, :remove_module] 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, ip : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, port : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, tls : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, udp : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, makebreak : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, uri : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, name : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, custom_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, role : PlaceOS::Model::Driver::Role | ActiveModel::Model::None = ::ActiveModel::Model::None.new, connected : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, running : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, notes : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, ignore_connected : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, ignore_startstop : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, has_runtime_error : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, error_timestamp : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, control_system_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, driver_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, edge_id : String | Nil | 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::Module from
HTTP::Params
.
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
- .auto_generate_id : Bool
-
.by_control_system_id(id)
Look up instances of this model dependent on the foreign key
-
.by_driver_id(id)
Look up instances of this model dependent on the foreign key
-
.by_edge_id(id)
Look up instances of this model dependent on the foreign key
-
.changes(id : PrimaryKeyType = nil) : ChangeFeed
Changefeed at row (if
#id
passed) or whole table level. - .elastic
- .from_rs(__temp_651 : DB::ResultSet)
-
.has_edge_hint?(module_id : String)
Hint in the model id whether the module is an edge module
- .in_control_system(control_system_id : String)
- .in_zone(zone_id : String)
-
.logic_for(control_system_id : String)
Fetch
Module
s who have a direct parentControlSystem
- .on_edge(edge_id : String)
- .on_error(err : Exception | IO::Error)
- .primary_key : Symbol
- .table_name
Instance Method Summary
-
#__control_system : ControlSystem | Nil
Control System the logic module may be assigned to
-
#__control_system=(__control_system : ControlSystem | Nil)
Control System the logic module may be assigned to
-
#__driver : Driver | Nil
The binary the module is to run on
-
#__driver=(__driver : Driver | Nil)
The binary the module is to run on
-
#__edge : Edge | Nil
The edge node the module may be assigned to
-
#__edge=(__edge : Edge | Nil)
The edge node the module may be assigned to
-
#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
-
#apply_defaults
Generate code to apply default values
-
#assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, ip : String | Missing = Missing, port : Int32 | Missing = Missing, tls : Bool | Missing = Missing, udp : Bool | Missing = Missing, makebreak : Bool | Missing = Missing, uri : String | Missing = Missing, name : String | Missing = Missing, custom_name : String | Nil | Missing = Missing, role : PlaceOS::Model::Driver::Role | Missing = Missing, connected : Bool | Missing = Missing, running : Bool | Missing = Missing, notes : String | Missing = Missing, ignore_connected : Bool | Missing = Missing, ignore_startstop : Bool | Missing = Missing, has_runtime_error : Bool | Missing = Missing, error_timestamp : Time | Nil | Missing = Missing, control_system_id : String | Nil | Missing = Missing, driver_id : String | Missing = Missing, edge_id : String | Nil | 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::Module)
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
-
#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.
-
#clear_changes_information
Reset changes for all attributes.
-
#connected : Bool
#connected
getter -
#connected=(value : Bool)
#connected
setter -
#connected? : Bool | Nil
Connected state in model so we can filter and search on it
- #connected_assigned? : Bool
-
#connected_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
- #connected_changed? : Bool
-
#connected_default : Bool
#connected
's default value -
#connected_present? : Bool
Connected state in model so we can filter and search on it
- #connected_was : Bool | Nil
-
#connected_will_change! : Nil
Include
#connected
in the set of changed attributes, whether it has changed or not. -
#control_system : ControlSystem | Nil
Retrieves the parent relationship
-
#control_system! : ControlSystem
Control System the logic module may be assigned to
-
#control_system=(parent : ControlSystem)
Sets the parent relationship
-
#control_system_id : String | Nil
#control_system_id
getter -
#control_system_id=(value : String | Nil)
#control_system_id
setter - #control_system_id_assigned? : Bool
-
#control_system_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
- #control_system_id_changed? : Bool
-
#control_system_id_default : String | Nil
#control_system_id
's default value -
#control_system_id_present? : Bool
Control System the logic module may be assigned to
- #control_system_id_was : String | Nil | Nil
-
#control_system_id_will_change! : Nil
Include
#control_system_id
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. -
#custom_name : String | Nil
#custom_name
getter -
#custom_name=(value : String | Nil)
#custom_name
setter - #custom_name_assigned? : Bool
-
#custom_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
- #custom_name_changed? : Bool
-
#custom_name_default : String | Nil
#custom_name
's default value -
#custom_name_present? : Bool
Custom module names (in addition to what is defined in the driver)
- #custom_name_was : String | Nil | Nil
-
#custom_name_will_change! : Nil
Include
#custom_name
in the set of changed attributes, whether it has changed or not. -
#destroy_settings_and_versions
Encrypted yaml settings, with metadata
-
#driver : Driver | Nil
Retrieves the parent relationship
-
#driver! : Driver
The binary the module is to run on
-
#driver=(driver : Driver)
Set driver and role
-
#driver_id : String
#driver_id
getter -
#driver_id=(value : String)
#driver_id
setter -
#driver_id? : String | Nil
The binary the module is to run on
- #driver_id_assigned? : Bool
-
#driver_id_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
- #driver_id_changed? : Bool
-
#driver_id_default : String
#driver_id
's default value -
#driver_id_present? : Bool
The binary the module is to run on
- #driver_id_was : String | Nil
-
#driver_id_will_change! : Nil
Include
#driver_id
in the set of changed attributes, whether it has changed or not. -
#edge : Edge | Nil
Retrieves the parent relationship
-
#edge! : Edge
The edge node the module may be assigned to
-
#edge=(parent : Edge)
Sets the parent relationship
-
#edge_id : String | Nil
#edge_id
getter -
#edge_id=(value : String | Nil)
#edge_id
setter - #edge_id_assigned? : Bool
-
#edge_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
- #edge_id_changed? : Bool
-
#edge_id_default : String | Nil
#edge_id
's default value -
#edge_id_present? : Bool
The edge node the module may be assigned to
- #edge_id_was : String | Nil | Nil
-
#edge_id_will_change! : Nil
Include
#edge_id
in the set of changed attributes, whether it has changed or not. -
#error_timestamp : Time | Nil
#error_timestamp
getter -
#error_timestamp=(value : Time | Nil)
#error_timestamp
setter - #error_timestamp_assigned? : Bool
-
#error_timestamp_change : Tuple(Time | Nil | Nil, Time | Nil | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #error_timestamp_changed? : Bool
-
#error_timestamp_default : Time | Nil
#error_timestamp
's default value - #error_timestamp_present? : Bool
- #error_timestamp_was : Time | Nil | Nil
-
#error_timestamp_will_change! : Nil
Include
#error_timestamp
in the set of changed attributes, whether it has changed or not. -
#has_runtime_error : Bool
#has_runtime_error
getter -
#has_runtime_error=(value : Bool)
#has_runtime_error
setter -
#has_runtime_error? : Bool | Nil
Runtime Error Indicators
- #has_runtime_error_assigned? : Bool
-
#has_runtime_error_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
- #has_runtime_error_changed? : Bool
-
#has_runtime_error_default : Bool
#has_runtime_error
's default value -
#has_runtime_error_present? : Bool
Runtime Error Indicators
- #has_runtime_error_was : Bool | Nil
-
#has_runtime_error_will_change! : Nil
Include
#has_runtime_error
in the set of changed attributes, whether it has changed or not. -
#hostname
Getter for the module's host
-
#hostname=(host : String)
Setter for Device module ip
-
#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. -
#ignore_connected : Bool
#ignore_connected
getter -
#ignore_connected=(value : Bool)
#ignore_connected
setter -
#ignore_connected? : Bool | Nil
Don't include this module in statistics or disconnected searches Might be a device that commonly goes offline (like a PC or Display that only supports Wake on Lan)
- #ignore_connected_assigned? : Bool
-
#ignore_connected_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
- #ignore_connected_changed? : Bool
-
#ignore_connected_default : Bool
#ignore_connected
's default value -
#ignore_connected_present? : Bool
Don't include this module in statistics or disconnected searches Might be a device that commonly goes offline (like a PC or Display that only supports Wake on Lan)
- #ignore_connected_was : Bool | Nil
-
#ignore_connected_will_change! : Nil
Include
#ignore_connected
in the set of changed attributes, whether it has changed or not. -
#ignore_startstop : Bool
#ignore_startstop
getter -
#ignore_startstop=(value : Bool)
#ignore_startstop
setter - #ignore_startstop? : Bool | Nil
- #ignore_startstop_assigned? : Bool
-
#ignore_startstop_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
- #ignore_startstop_changed? : Bool
-
#ignore_startstop_default : Bool
#ignore_startstop
's default value - #ignore_startstop_present? : Bool
- #ignore_startstop_was : Bool | Nil
-
#ignore_startstop_will_change! : Nil
Include
#ignore_startstop
in the set of changed attributes, whether it has changed or not. -
#invoke_props
Base class for all Engine models
-
#ip : String
#ip
getter -
#ip=(value : String)
#ip
setter - #ip? : String | Nil
- #ip_assigned? : Bool
-
#ip_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
- #ip_changed? : Bool
-
#ip_default : String
#ip
's default value - #ip_present? : Bool
- #ip_was : String | Nil
-
#ip_will_change! : Nil
Include
#ip
in the set of changed attributes, whether it has changed or not. -
#makebreak : Bool
#makebreak
getter -
#makebreak=(value : Bool)
#makebreak
setter - #makebreak? : Bool | Nil
- #makebreak_assigned? : Bool
-
#makebreak_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
- #makebreak_changed? : Bool
-
#makebreak_default : Bool
#makebreak
's default value - #makebreak_present? : Bool
- #makebreak_was : Bool | Nil
-
#makebreak_will_change! : Nil
Include
#makebreak
in the set of changed attributes, whether it has changed or not. -
#merge_settings
Merge settings hierarchy to JSON
-
#name : String
#name
getter -
#name=(value : String)
#name
setter -
#name? : String | Nil
Module name
- #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
Module name
- #name_was : String | Nil
-
#name_will_change! : Nil
Include
#name
in the set of changed attributes, whether it has changed or not. -
#notes : String
#notes
getter -
#notes=(value : String)
#notes
setter - #notes? : String | Nil
- #notes_assigned? : Bool
-
#notes_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
- #notes_changed? : Bool
-
#notes_default : String
#notes
's default value - #notes_present? : Bool
- #notes_was : String | Nil
-
#notes_will_change! : Nil
Include
#notes
in the set of changed attributes, whether it has changed or not. -
#on_edge?
Whether or not module is an edge module
-
#persistent_attributes
Returns a
Hash
of all attributes that can be persisted. -
#port : Int32
#port
getter -
#port=(value : Int32)
#port
setter - #port? : Int32 | Nil
- #port_assigned? : Bool
-
#port_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
- #port_changed? : Bool
-
#port_default : Int32
#port
's default value - #port_present? : Bool
- #port_was : Int32 | Nil
-
#port_will_change! : Nil
Include
#port
in the set of changed attributes, whether it has changed or not. -
#reset_associations
The edge node the module may be assigned to
-
#resolved_name : String
Use custom name if it is defined and non-empty, otherwise use module name
- #resolved_name_changed? : Bool
-
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#role : PlaceOS::Model::Driver::Role
#role
getter -
#role=(value : PlaceOS::Model::Driver::Role)
#role
setter -
#role? : PlaceOS::Model::Driver::Role | Nil
Cache the module's driver role locally for load order
- #role_assigned? : Bool
-
#role_change : Tuple(PlaceOS::Model::Driver::Role | Nil, PlaceOS::Model::Driver::Role | Nil) | Nil
Returns a Tuple of the previous and the current value of an instance variable if it has changed
- #role_changed? : Bool
-
#role_default : Driver::Role
#role
's default value -
#role_present? : Bool
Cache the module's driver role locally for load order
- #role_was : PlaceOS::Model::Driver::Role | Nil
-
#role_will_change! : Nil
Include
#role
in the set of changed attributes, whether it has changed or not. -
#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
-
#running : Bool
#running
getter -
#running=(value : Bool)
#running
setter - #running? : Bool | Nil
- #running_assigned? : Bool
-
#running_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
- #running_changed? : Bool
-
#running_default : Bool
#running
's default value - #running_present? : Bool
- #running_was : Bool | Nil
-
#running_will_change! : Nil
Include
#running
in the set of changed attributes, whether it has changed or not. -
#settings_and_versions
Encrypted yaml settings, with metadata
-
#settings_hierarchy : Array(Settings)
Collect Settings ordered by hierarchy
-
#systems
Finds the systems for which this module is in use
- #table_name
-
#tls : Bool
#tls
getter -
#tls=(value : Bool)
#tls
setter - #tls? : Bool | Nil
- #tls_assigned? : Bool
-
#tls_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
- #tls_changed? : Bool
-
#tls_default : Bool
#tls
's default value - #tls_present? : Bool
- #tls_was : Bool | Nil
-
#tls_will_change! : Nil
Include
#tls
in the set of changed attributes, whether it has changed or not. -
#udp : Bool
#udp
getter -
#udp=(value : Bool)
#udp
setter - #udp? : Bool | Nil
- #udp_assigned? : Bool
-
#udp_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
- #udp_changed? : Bool
-
#udp_default : Bool
#udp
's default value - #udp_present? : Bool
- #udp_was : Bool | Nil
-
#udp_will_change! : Nil
Include
#udp
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. -
#uri : String
#uri
getter -
#uri=(value : String)
#uri
setter -
#uri? : String | Nil
HTTP Service module
- #uri_assigned? : Bool
-
#uri_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
- #uri_changed? : Bool
-
#uri_default : String
#uri
's default value -
#uri_present? : Bool
HTTP Service module
- #uri_was : String | Nil
-
#uri_will_change! : Nil
Include
#uri
in the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
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::Module 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.
Hint in the model id whether the module is an edge module
Fetch Module
s who have a direct parent ControlSystem
Instance Method Detail
Control System the logic module may be assigned to
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 #connected
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 #control_system_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 #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
Custom module names (in addition to what is defined in the driver)
Include #custom_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 #driver_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 #edge_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 #error_timestamp
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 #has_runtime_error
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.
Don't include this module in statistics or disconnected searches Might be a device that commonly goes offline (like a PC or Display that only supports Wake on Lan)
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Don't include this module in statistics or disconnected searches Might be a device that commonly goes offline (like a PC or Display that only supports Wake on Lan)
Include #ignore_connected
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 #ignore_startstop
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 #ip
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 #makebreak
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.
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.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #port
in the set of changed attributes, whether it has changed or not.
Use custom name if it is defined and non-empty, otherwise use module name
Cache the module's driver role locally for load order
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #role
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
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #running
in the set of changed attributes, whether it has changed or not.
Collect Settings ordered by hierarchy
Module > (Control System > Zones) > Driver
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #tls
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 #udp
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