class PlaceOS::Model::Trigger::Actions

Defined in:

placeos-models/trigger/actions.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class PlaceOS::Model::SubModel

apply_defaults apply_defaults, assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
assign_attributes
assign_attributes
, attributes attributes, attributes_tuple attributes_tuple, persistent_attributes persistent_attributes, to_reql to_reql

Class methods inherited from class PlaceOS::Model::SubModel

attributes : Array(Symbol) attributes

Constructor Detail

def self.from_trusted_json(string_or_io : String | IO) : self #

Serialize from a trusted JSON source


def self.from_trusted_yaml(string_or_io : String | IO) : self #

Serialize from a trusted YAML source


def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

def self.new(functions : Array(PlaceOS::Model::Trigger::Actions::Function) | Nil = nil, mailers : Array(PlaceOS::Model::Trigger::Actions::Email) | Nil = nil) #

def self.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String)) #

Initialize PlaceOS::Model::Trigger::Actions from HTTP::Params.


Class Method Detail

def self.attributes : Array(Symbol) #

Returns all attribute keys.


Instance Method Detail

def apply_defaults #

Generate code to apply default values


def assign_attributes(functions : Array(PlaceOS::Model::Trigger::Actions::Function) | Missing = Missing, mailers : Array(PlaceOS::Model::Trigger::Actions::Email) | Missing = Missing) #

Assign to multiple attributes.


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

Assign to mulitple attributes via HTTP::Params.


def assign_attributes_from_json(json) #

def assign_attributes_from_trusted_json(json) #

def assign_attributes_from_trusted_yaml(yaml) #

def assign_attributes_from_yaml(yaml) #

Uses the YAML parser as JSON is valid YAML


def attributes #

Returns a Hash of all attribute values


def attributes_tuple #

Returns a NamedTuple of all attribute values.


def changed? #

Check if any attributes have changed.


def changed_attributes #

Returns a Hash with all changed attributes.


def changed_json(io : IO) : Nil #

Serialize the set of changed attributes to JSON.


def changed_json : String #

Serialize the set of changed attributes to JSON.


def changed_yaml(io : IO) : Nil #

Serialize the set of changed attributes to YAML.


def changed_yaml : String #

Serialize the set of changed attributes to YAML.


def clear_changes_information #

Reset changes for all attributes.


#functions getter


def functions=(value : Array(PlaceOS::Model::Trigger::Actions::Function)) #

Override the map json #functions setter


def functions_change #

Returns { functions_was, functions } if #functions has changed.


def functions_changed? #

Check if #functions is in the set of changed attributes.


def functions_default : Array(Function) #

#functions's default value


[View source]
def functions_was : Array(PlaceOS::Model::Trigger::Actions::Function)? #

Returns the previous value of #functions.


def functions_will_change! #

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


#mailers getter


def mailers=(value : Array(PlaceOS::Model::Trigger::Actions::Email)) #

#mailers setter


def mailers_change #

Returns { mailers_was, mailers } if #mailers has changed.


def mailers_changed? #

Check if #mailers is in the set of changed attributes.


def mailers_default : Array(Email) #

#mailers's default value


[View source]
def mailers_was : Array(PlaceOS::Model::Trigger::Actions::Email)? #

Returns the previous value of #mailers.


def mailers_will_change! #

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


def persistent_attributes #

Returns a Hash of all attributes that can be persisted.


def restore_attributes #

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


def to_json(json : JSON::Builder) #

def to_yaml(__temp_1573 : YAML::Nodes::Builder) #

def validate_nilability #

Validate that all non-nillable fields have values.