class

PlaceOS::Model::AiTrendReport

Inherits 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

CALLBACKS = { before_save: [] of Nil, after_save: [] of Nil, before_create: [] of Nil, after_create: [] of Nil, before_update: [] of Nil, after_update: [] of Nil, before_destroy: [] of Nil, after_destroy: [] of Nil, }
Log = ::Log.for(self)
PRIMARY_KEY_TYPES = {:id => (String | Nil)} of Nil => Nil

macro level key => type

PRIMARY_KEYS = [{:id}]

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. 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">
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(rs : DB::ResultSet)
new(policy_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, policy_version : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, policy_hash : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, window_start : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, window_end : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, summary_json : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, markdown : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, generated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new)

Initialize PlaceOS::Model::AiTrendReport from HTTP::Params.

Class methods

attributes

Returns all attribute keys.

changes(id : String | Nil | Nil = nil) : ChangeFeed

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.

elastic
from_rs(__temp_1676 : DB::ResultSet)
on_error(err : Exception | IO::Error)
primary_key

Base class for all Engine models

Source
table_name

Instance methods

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(policy_id : String | Missing = Missing, policy_version : Int32 | Missing = Missing, policy_hash : String | Missing = Missing, window_start : Time | Missing = Missing, window_end : Time | Missing = Missing, summary_json : JSON::Any | Missing = Missing, markdown : String | Missing = Missing, generated_at : Time | Missing = Missing, id : String | Nil | Missing = Missing)

Assign to multiple attributes.

assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))

Assign to multiple attributes via HTTP::Params.

assign_attributes(model : PlaceOS::Model::AiTrendReport)

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

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

Serialize the set of changed attributes to YAML.

clear_changes_information

Reset changes for all attributes.

generated_at

generated_at getter

generated_at=(value : Time)

generated_at setter

generated_at?

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.

generated_at_assigned?
generated_at_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

generated_at_changed?
generated_at_default

generated_at's default value

Source
generated_at_present?
generated_at_removed?
generated_at_was
generated_at_will_change!

Include generated_at in the set of changed attributes, whether it has changed or not.

id

id getter

id=(value : String | Nil)

id setter

id?
id_assigned?
id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

id_changed?
id_default

id's default value

id_present?
id_removed?
id_was
id_will_change!

Include id in the set of changed attributes, whether it has changed or not.

invoke_props

Base class for all Engine models

markdown

markdown getter

markdown=(value : String)

markdown setter

markdown?

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.

markdown_assigned?
markdown_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

markdown_changed?
markdown_default

markdown's default value

Source
markdown_present?
markdown_removed?
markdown_was
markdown_will_change!

Include markdown in the set of changed attributes, whether it has changed or not.

persistent_attributes

Returns a Hash of all attributes that can be persisted.

policy_hash

policy_hash getter

policy_hash=(value : String)

policy_hash setter

policy_hash?

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.

policy_hash_assigned?
policy_hash_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

policy_hash_changed?
policy_hash_default

policy_hash's default value

Source
policy_hash_present?
policy_hash_removed?
policy_hash_was
policy_hash_will_change!

Include policy_hash in the set of changed attributes, whether it has changed or not.

policy_id

policy_id getter

policy_id=(value : String)

Setters policy_id setter

policy_id?

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.

policy_id_assigned?
policy_id_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

policy_id_changed?
policy_id_default

policy_id's default value

Source
policy_id_present?
policy_id_removed?
policy_id_was
policy_id_will_change!

Include policy_id in the set of changed attributes, whether it has changed or not.

policy_version

policy_version getter

policy_version=(value : Int32)

policy_version setter

policy_version?

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.

policy_version_assigned?
policy_version_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

policy_version_changed?
policy_version_default

policy_version's default value

Source
policy_version_present?
policy_version_removed?
policy_version_was
policy_version_will_change!

Include policy_version in the set of changed attributes, whether it has changed or not.

primary_key

Base class for all Engine models

Source
primary_key_hash
restore_attributes

Reset each attribute to their previous values and clears all changes.

summary_json

summary_json getter

summary_json=(value : JSON::Any)

summary_json setter

summary_json?

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.

summary_json_assigned?
summary_json_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

summary_json_changed?
summary_json_default

summary_json's default value

Source
summary_json_present?
summary_json_removed?
summary_json_was
summary_json_will_change!

Include summary_json in the set of changed attributes, whether it has changed or not.

table_name
validate_nilability

Validate that all non-nillable fields have values.

window_end

window_end getter

window_end=(value : Time)

window_end setter

window_end?

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.

window_end_assigned?
window_end_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

window_end_changed?
window_end_default

window_end's default value

Source
window_end_present?
window_end_removed?
window_end_was
window_end_will_change!

Include window_end in the set of changed attributes, whether it has changed or not.

window_start

window_start getter

window_start=(value : Time)

window_start setter

window_start?

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.

window_start_assigned?
window_start_change

Returns a Tuple of the previous and the current value of an instance variable if it has changed

window_start_changed?
window_start_default

window_start's default value

Source
window_start_present?
window_start_removed?
window_start_was
window_start_will_change!

Include window_start in the set of changed attributes, whether it has changed or not.

Nested types