class

PlaceOS::Model::AiApprovalRequest

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

CALLBACKS = { before_save: [] of Nil, after_save: [] 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: [] 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(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Source
new(pull : JSON::PullParser)
Source
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, incident_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, status : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, requested_by : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, request_note : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, decided_by : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, decision_note : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, proposal_json : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, execution_mode : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, decided_at : Time | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, executed_at : Time | 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::AiApprovalRequest from HTTP::Params.

Class methods

attributes

Returns all attribute keys.

by_incident_id(id)

Look up instances of this model dependent on the foreign key

Source
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_1583 : DB::ResultSet)
on_error(err : Exception | IO::Error)
primary_key

Base class for all Engine models

Source
table_name

Instance methods

__ai_incident
__ai_incident=(__ai_incident : AiIncident | Nil)
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

ai_incident

Retrieves the parent relationship

Source
ai_incident!
Source
ai_incident=(parent : AiIncident)

Sets the parent relationship

Source
apply_defaults

Generate code to apply default values

assign_attributes(created_at : Time | Missing = Missing, updated_at : Time | Missing = Missing, incident_id : String | Nil | Missing = Missing, status : String | Missing = Missing, requested_by : String | Missing = Missing, request_note : String | Nil | Missing = Missing, decided_by : String | Nil | Missing = Missing, decision_note : String | Nil | Missing = Missing, proposal_json : JSON::Any | Missing = Missing, execution_mode : String | Missing = Missing, decided_at : Time | Nil | Missing = Missing, executed_at : Time | 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 multiple attributes via HTTP::Params.

assign_attributes(model : PlaceOS::Model::AiApprovalRequest)

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.

created_at

created_at getter

created_at=(value : Time)

Setters created_at setter

created_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.

created_at_assigned?
created_at_change

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

created_at_changed?
created_at_default

created_at's default value

created_at_present?
created_at_removed?
created_at_was
created_at_will_change!

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

decided_at

decided_at getter

decided_at=(value : Time | Nil)

decided_at setter

decided_at_assigned?
decided_at_change

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

decided_at_changed?
decided_at_default

decided_at's default value

Source
decided_at_present?
decided_at_removed?
decided_at_was
decided_at_will_change!

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

decided_by

decided_by getter

decided_by=(value : String | Nil)

decided_by setter

decided_by_assigned?
decided_by_change

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

decided_by_changed?
decided_by_default

decided_by's default value

Source
decided_by_present?
decided_by_removed?
decided_by_was
decided_by_will_change!

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

decision_note

decision_note getter

decision_note=(value : String | Nil)

decision_note setter

decision_note_assigned?
decision_note_change

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

decision_note_changed?
decision_note_default

decision_note's default value

Source
decision_note_present?
decision_note_removed?
decision_note_was
decision_note_will_change!

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

executed_at

executed_at getter

executed_at=(value : Time | Nil)

executed_at setter

executed_at_assigned?
executed_at_change

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

executed_at_changed?
executed_at_default

executed_at's default value

Source
executed_at_present?
executed_at_removed?
executed_at_was
executed_at_will_change!

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

execution_mode

execution_mode getter

execution_mode=(value : String)

execution_mode setter

execution_mode?

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.

execution_mode_assigned?
execution_mode_change

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

execution_mode_changed?
execution_mode_default

execution_mode's default value

Source
execution_mode_present?
execution_mode_removed?
execution_mode_was
execution_mode_will_change!

Include execution_mode 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.

incident_id

incident_id getter

incident_id=(value : String | Nil)

incident_id setter

incident_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.

incident_id_assigned?
incident_id_change

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

incident_id_changed?
incident_id_default

incident_id's default value

incident_id_present?
incident_id_removed?
incident_id_was
incident_id_will_change!

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

invoke_props

Base class for all Engine models

persistent_attributes

Returns a Hash of all attributes that can be persisted.

primary_key

Base class for all Engine models

Source
primary_key_hash
proposal_json

proposal_json getter

proposal_json=(value : JSON::Any)

proposal_json setter

proposal_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.

proposal_json_assigned?
proposal_json_change

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

proposal_json_changed?
proposal_json_default

proposal_json's default value

Source
proposal_json_present?
proposal_json_removed?
proposal_json_was
proposal_json_will_change!

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

request_note

request_note getter

request_note=(value : String | Nil)

request_note setter

request_note_assigned?
request_note_change

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

request_note_changed?
request_note_default

request_note's default value

Source
request_note_present?
request_note_removed?
request_note_was
request_note_will_change!

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

requested_by

requested_by getter

requested_by=(value : String)

requested_by setter

requested_by?

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.

requested_by_assigned?
requested_by_change

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

requested_by_changed?
requested_by_default

requested_by's default value

Source
requested_by_present?
requested_by_removed?
requested_by_was
requested_by_will_change!

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

reset_associations
Source
restore_attributes

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

status

status getter

status=(value : String)

status setter

status?

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.

status_assigned?
status_change

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

status_changed?
status_default

status's default value

Source
status_present?
status_removed?
status_was
status_will_change!

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

table_name
updated_at

updated_at getter

updated_at=(value : Time)

updated_at setter

updated_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.

updated_at_assigned?
updated_at_change

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

updated_at_changed?
updated_at_default

updated_at's default value

updated_at_present?
updated_at_removed?
updated_at_was
updated_at_will_change!

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.

Nested types