class PlaceOS::Model::Booking

Included Modules

Defined in:

placeos-models/booking.cr

Constant Summary

CALLBACKS = {before_save: [do @user_id || (@user_id = booked_by_id) @user_email || (@user_email = booked_by_email) @user_name || (@user_name = booked_by_name) @email_digest || (@email_digest = user_email.digest) @booked_by_email_digest = booked_by_email.digest @booked_from || (@booked_from = utm_source) @history = current_history if history.size > 3 Log.error do {message: "History contains more than 3 events.", id: id} end end update_assets survey_trigger end] of Nil, after_save: [] of Nil, before_create: [:set_created, do self.created_at = self.updated_at = Time.utc end] of Nil, after_create: [] of Nil, before_update: [:cleanup_recurring_instances, do if parent? if booking_start_changed? || booking_end_changed? linked_bookings = Booking.where(parent_id: id) clashing = linked_bookings.select do |booking| booking.booking_start = booking_start booking.booking_end = booking_end booking.clashing? end if clashing.empty? else (Booking.where({:id => clashing.map(&.id)})).update_all({:rejected => true, :rejected_at => Time.utc.to_unix}) end Booking.where(parent_id: id).update_all({:booking_start => booking_start, :booking_end => booking_end}) else if deleted_changed? || deleted_at_changed? Booking.where(parent_id: id).update_all({:deleted => deleted, :deleted_at => deleted_at}) else if (((((approved_changed? || approved_at_changed?) || rejected_changed?) || rejected_at_changed?) || approver_id_changed?) || approver_name_changed?) || approver_email_changed? Booking.where(parent_id: id).update_all({:approved => approved, :approved_at => approved_at, :rejected => rejected, :rejected_at => rejected_at, :approver_id => approver_id, :approver_name => approver_name, :approver_email => approver_email}) end end end end end, do if linked? if booking_start_changed? || booking_end_changed? meta = linked_event.not_nil! self.booking_start = meta.event_start self.booking_end = meta.event_end end end end, do self.updated_at = Time.utc end] of Nil, after_update: [] of Nil, before_destroy: [:destroy_attendees] of Nil, after_destroy: [] of Nil}
DAY_BITS = {Time::DayOfWeek::Sunday => 1, Time::DayOfWeek::Monday => 1 << 1, Time::DayOfWeek::Tuesday => 1 << 2, Time::DayOfWeek::Wednesday => 1 << 3, Time::DayOfWeek::Thursday => 1 << 4, Time::DayOfWeek::Friday => 1 << 5, Time::DayOfWeek::Saturday => 1 << 6}
DEFAULT_LIMIT = 100000
Log = ::Log.for(self)
TRUTHY = {true, "true"}

Constructors

Class Method Summary

Macro Summary

Instance Method Summary

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

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

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::ModelWithAutoKey)
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::ModelWithAutoKey

new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
new(pull : JSON::PullParser)
new(rs : DB::ResultSet)
new

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

attributes : Array(Symbol) attributes, auto_generate_id : Bool auto_generate_id, from_rs(rs : DB::ResultSet) from_rs, primary_key : Symbol primary_key

Constructor Detail

def self.from_json(string_or_io : String | IO, trusted : Bool = false) : self #

def 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">

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

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.from_yaml(string_or_io : String | IO, trusted : Bool = false) : self #

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

[View source]
def self.new(pull : JSON::PullParser) #

[View source]
def self.new(rs : DB::ResultSet) #

def self.new(booking_type : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booking_start : Int64 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booking_end : Int64 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, timezone : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, asset_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_email : PlaceOS::Model::Email | ActiveModel::Model::None = ::ActiveModel::Model::None.new, user_name : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, zones : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, process_state : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, last_changed : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, approved : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, approved_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, rejected : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, rejected_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, approver_id : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, approver_name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, approver_email : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, department : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, title : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, checked_in : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, checked_in_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, checked_out_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, description : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, deleted : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, deleted_at : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booked_by_email : PlaceOS::Model::Email | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booked_by_name : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booked_from : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, extension_data : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, history : Array(PlaceOS::Model::Booking::History) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, email_digest : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booked_by_id : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booked_by_email_digest : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, created : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, parent_id : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, event_id : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, instance : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, utm_source : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, asset_ids : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, images : Array(String) | ActiveModel::Model::None = ::ActiveModel::Model::None.new, induction : PlaceOS::Model::Booking::Induction | ActiveModel::Model::None = ::ActiveModel::Model::None.new, permission : PlaceOS::Model::Booking::Permission | ActiveModel::Model::None = ::ActiveModel::Model::None.new, recurrence_type : PlaceOS::Model::Booking::Recurrence | ActiveModel::Model::None = ::ActiveModel::Model::None.new, recurrence_days : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, recurrence_nth_of_month : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, recurrence_interval : Int32 | ActiveModel::Model::None = ::ActiveModel::Model::None.new, recurrence_end : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, tenant_id : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, id : Int64 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, created_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new, updated_at : Time | ActiveModel::Model::None = ::ActiveModel::Model::None.new) #

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

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


Class Method Detail

def self.attributes : Array(Symbol) #

Returns all attribute keys.


def self.auto_generate_id : Bool #

def self.booked_between(tenant_id, period_start, period_end) #

[View source]
def self.by_tenant(tenant_id) #

[View source]
def self.by_tenant_id(id) #

Look up instances of this model dependent on the foreign key


[View source]
def self.by_user_id(user_id) #

[View source]
def self.by_user_or_email(user_id_value, user_email_value, include_booked_by, include_open_permission, include_public_permission) #

[View source]
def self.by_user_or_email(user_id_value, user_email_value, include_booked_by) #

[View source]
def self.by_zones(zones) #

Bookings have the zones in an array.

In case of multiple zones as input, we return all bookings that have any of the input zones in their zones array


[View source]
def self.changes(id : PrimaryKeyType = 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.


def self.elastic #

def self.expand_bookings!(starting : Time, ending : Time, parents : Array(Booking), limit : Int32 = DEFAULT_LIMIT, skip : Int32 = 0, is_checked_out : Bool | Nil = nil) : ExpansionDetails #

modifies the array, injecting the recurrences ameba:disable Metrics/CyclomaticComplexity


[View source]
def self.from_rs(__temp_579 : DB::ResultSet) #

def self.is_approved(value) #

[View source]
def self.is_booking_type(booking_type) #

[View source]
def self.is_checked_in(value) #

[View source]
def self.is_created_after(time) #

[View source]
def self.is_created_before(time) #

[View source]
def self.is_department(value) #

[View source]
def self.is_extension_data(value) #

[View source]
def self.is_rejected(value) #

[View source]
def self.is_state(state) #

[View source]
def self.on_error(err : Exception | IO::Error) #

def self.primary_key : Symbol #

def self.table_name #

Macro Detail

macro scope(name, &block) #

Instance Method Detail

def __guests_rel : Array(Guest) #

NOTE : not to be used directly, only here for caching


def __tenant : Tenant | Nil #

def __tenant=(__tenant : Tenant | Nil) #

def after_create #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_destroy #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_initialize(trusted : Bool) #

def after_save #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def after_update #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def apply_defaults #

Generate code to apply default values


def approved : Bool #

#approved getter


def approved=(value : Bool) #

#approved setter


def approved? : Bool | Nil #

Assign instance variable to correct type


def approved_assigned? : Bool #

def approved_at : Int64 | Nil #

#approved_at getter


def approved_at=(value : Int64 | Nil) #

#approved_at setter


def approved_at_assigned? : Bool #

def approved_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def approved_at_changed? : Bool #

def approved_at_default : Int64 | Nil #

#approved_at's default value


[View source]
def approved_at_present? : Bool #

def approved_at_was : Int64 | Nil | Nil #

def approved_at_will_change! : Nil #

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


def approved_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


def approved_changed? : Bool #

def approved_default : Bool #

#approved's default value


[View source]
def approved_present? : Bool #

def approved_was : Bool | Nil #

def approved_will_change! : Nil #

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


def approver_email : String | Nil #

def approver_email=(value : String | Nil) #

def approver_email_assigned? : Bool #

def approver_email_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


def approver_email_changed? : Bool #

def approver_email_default : String | Nil #

#approver_email's default value


[View source]
def approver_email_present? : Bool #

def approver_email_was : String | Nil | Nil #

def approver_email_will_change! : Nil #

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


def approver_id : String | Nil #

#approver_id getter


def approver_id=(value : String | Nil) #

#approver_id setter


def approver_id_assigned? : Bool #

def approver_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


def approver_id_changed? : Bool #

def approver_id_default : String | Nil #

#approver_id's default value


[View source]
def approver_id_present? : Bool #

def approver_id_was : String | Nil | Nil #

def approver_id_will_change! : Nil #

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


def approver_name : String | Nil #

def approver_name=(value : String | Nil) #

def approver_name_assigned? : Bool #

def approver_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


def approver_name_changed? : Bool #

def approver_name_default : String | Nil #

#approver_name's default value


[View source]
def approver_name_present? : Bool #

def approver_name_was : String | Nil | Nil #

def approver_name_will_change! : Nil #

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


def as_h(include_attendees : Bool = true) #

[View source]
def as_instance #

[View source]
def asset_id : String #

#asset_id getter


def asset_id=(value : String) #

#asset_id setter


def asset_id? : String | Nil #

Assign instance variable to correct type


def asset_id_assigned? : Bool #

def asset_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


def asset_id_changed? : Bool #

def asset_id_default : String #

#asset_id's default value


[View source]
def asset_id_present? : Bool #

def asset_id_was : String | Nil #

def asset_id_will_change! : Nil #

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


def asset_ids : Array(String) #

#asset_ids getter


def asset_ids=(value : Array(String)) #

#asset_ids setter


def asset_ids? : Array(String) | Nil #

Assign instance variable to correct type


def asset_ids_assigned? : Bool #

def asset_ids_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


def asset_ids_changed? : Bool #

def asset_ids_default : Array(String) #

#asset_ids's default value


[View source]
def asset_ids_present? : Bool #

def asset_ids_was : Array(String) | Nil #

def asset_ids_will_change! : Nil #

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


def assign_attributes(booking_type : String | Missing = Missing, booking_start : Int64 | Missing = Missing, booking_end : Int64 | Missing = Missing, timezone : String | Nil | Missing = Missing, asset_id : String | Missing = Missing, user_id : String | Nil | Missing = Missing, user_email : PlaceOS::Model::Email | Missing = Missing, user_name : String | Missing = Missing, zones : Array(String) | Missing = Missing, process_state : String | Nil | Missing = Missing, last_changed : Int64 | Nil | Missing = Missing, approved : Bool | Missing = Missing, approved_at : Int64 | Nil | Missing = Missing, rejected : Bool | Missing = Missing, rejected_at : Int64 | Nil | Missing = Missing, approver_id : String | Nil | Missing = Missing, approver_name : String | Nil | Missing = Missing, approver_email : String | Nil | Missing = Missing, department : String | Nil | Missing = Missing, title : String | Nil | Missing = Missing, checked_in : Bool | Missing = Missing, checked_in_at : Int64 | Nil | Missing = Missing, checked_out_at : Int64 | Nil | Missing = Missing, description : String | Nil | Missing = Missing, deleted : Bool | Missing = Missing, deleted_at : Int64 | Nil | Missing = Missing, booked_by_email : PlaceOS::Model::Email | Missing = Missing, booked_by_name : String | Missing = Missing, booked_from : String | Nil | Missing = Missing, extension_data : JSON::Any | Missing = Missing, history : Array(PlaceOS::Model::Booking::History) | Missing = Missing, email_digest : String | Nil | Missing = Missing, booked_by_id : String | Missing = Missing, booked_by_email_digest : String | Nil | Missing = Missing, created : Int64 | Nil | Missing = Missing, parent_id : Int64 | Nil | Missing = Missing, event_id : Int64 | Nil | Missing = Missing, instance : Int64 | Nil | Missing = Missing, utm_source : String | Nil | Missing = Missing, asset_ids : Array(String) | Missing = Missing, images : Array(String) | Missing = Missing, induction : PlaceOS::Model::Booking::Induction | Missing = Missing, permission : PlaceOS::Model::Booking::Permission | Missing = Missing, recurrence_type : PlaceOS::Model::Booking::Recurrence | Missing = Missing, recurrence_days : Int32 | Missing = Missing, recurrence_nth_of_month : Int32 | Missing = Missing, recurrence_interval : Int32 | Missing = Missing, recurrence_end : Int64 | Nil | Missing = Missing, tenant_id : Int64 | Nil | Missing = Missing, id : Int64 | Nil | Missing = Missing, created_at : Time | Missing = Missing, updated_at : Time | 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(model : PlaceOS::Model::Booking) #

Assign to multiple attributes from a model object


def assign_attributes_from_json(json, root : String) #

def assign_attributes_from_json(json) #

def assign_attributes_from_trusted_json(json, root : String) #

def assign_attributes_from_trusted_json(json) #

Assign each field from JSON if field exists in JSON and has changed in model


def assign_attributes_from_trusted_yaml(yaml) #

def assign_attributes_from_yaml(yaml) #

Uses the YAML parser as JSON is valid YAML


def attendees #

[View source]
def attributes #

Returns a Hash of all attribute values


def attributes_tuple #

Returns a NamedTuple of all attribute values.


def before_create #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_destroy #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_save #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def before_update #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def booked_by_email : PlaceOS::Model::Email #

def booked_by_email=(value : PlaceOS::Model::Email) #

def booked_by_email? : PlaceOS::Model::Email | Nil #

Assign instance variable to correct type


def booked_by_email_assigned? : Bool #

def booked_by_email_change : Tuple(PlaceOS::Model::Email | Nil, PlaceOS::Model::Email | Nil) | Nil #

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


def booked_by_email_changed? : Bool #

def booked_by_email_default : PlaceOS::Model::Email #

#booked_by_email's default value


[View source]
def booked_by_email_digest : String | Nil #

def booked_by_email_digest=(value : String | Nil) #

def booked_by_email_digest_assigned? : Bool #

def booked_by_email_digest_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


def booked_by_email_digest_changed? : Bool #

def booked_by_email_digest_default : String | Nil #

#booked_by_email_digest's default value


[View source]
def booked_by_email_digest_present? : Bool #

def booked_by_email_digest_was : String | Nil | Nil #

def booked_by_email_digest_will_change! : Nil #

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


def booked_by_email_present? : Bool #

def booked_by_email_was : PlaceOS::Model::Email | Nil #

def booked_by_email_will_change! : Nil #

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


def booked_by_id : String #

#booked_by_id getter


def booked_by_id=(value : String) #

#booked_by_id setter


def booked_by_id? : String | Nil #

Assign instance variable to correct type


def booked_by_id_assigned? : Bool #

def booked_by_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


def booked_by_id_changed? : Bool #

def booked_by_id_default : String #

#booked_by_id's default value


[View source]
def booked_by_id_present? : Bool #

def booked_by_id_was : String | Nil #

def booked_by_id_will_change! : Nil #

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


def booked_by_name : String #

def booked_by_name=(value : String) #

def booked_by_name? : String | Nil #

Assign instance variable to correct type


def booked_by_name_assigned? : Bool #

def booked_by_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


def booked_by_name_changed? : Bool #

def booked_by_name_default : String #

#booked_by_name's default value


[View source]
def booked_by_name_present? : Bool #

def booked_by_name_was : String | Nil #

def booked_by_name_will_change! : Nil #

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


def booked_from : String | Nil #

#booked_from getter


def booked_from=(value : String | Nil) #

#booked_from setter


def booked_from_assigned? : Bool #

def booked_from_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


def booked_from_changed? : Bool #

def booked_from_default : String | Nil #

#booked_from's default value


[View source]
def booked_from_present? : Bool #

if we want to record the system that performed the bookings (kiosk, mobile, swipe etc)


def booked_from_was : String | Nil | Nil #

def booked_from_will_change! : Nil #

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


def booking_current_state : State #

[View source]
def booking_end : Int64 #

#booking_end getter


def booking_end=(value : Int64) #

#booking_end setter


def booking_end? : Int64 | Nil #

Assign instance variable to correct type


def booking_end_assigned? : Bool #

def booking_end_change : Tuple(Int64 | Nil, Int64 | Nil) | Nil #

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


def booking_end_changed? : Bool #

def booking_end_default : Int64 #

#booking_end's default value


[View source]
def booking_end_present? : Bool #

def booking_end_was : Int64 | Nil #

def booking_end_will_change! : Nil #

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


def booking_instances #

[View source]
def booking_start : Int64 #

def booking_start=(value : Int64) #

def booking_start? : Int64 | Nil #

Assign instance variable to correct type


def booking_start_assigned? : Bool #

def booking_start_change : Tuple(Int64 | Nil, Int64 | Nil) | Nil #

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


def booking_start_changed? : Bool #

def booking_start_default : Int64 #

#booking_start's default value


[View source]
def booking_start_present? : Bool #

def booking_start_was : Int64 | Nil #

def booking_start_will_change! : Nil #

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


def booking_type : String #

#booking_type getter


def booking_type=(value : String) #

Setters #booking_type setter


def booking_type? : String | Nil #

Assign instance variable to correct type


def booking_type_assigned? : Bool #

def booking_type_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


def booking_type_changed? : Bool #

def booking_type_default : String #

#booking_type's default value


[View source]
def booking_type_present? : Bool #

def booking_type_was : String | Nil #

def booking_type_will_change! : Nil #

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


def calculate_daily(start_date : Time, end_date : Time, multiplier : Int32 = 1, limit : Int32 = Int32::MAX) : RecurrenceDetails #

[View source]
def calculate_monthly(start_date : Time, end_date : Time, limit : Int32 = Int32::MAX) : RecurrenceDetails #

[View source]
def calculate_weekly(start_date : Time, end_date : Time, limit : Int32 = Int32::MAX) : RecurrenceDetails #

[View source]
def change_extension_data(data : JSON::Any) #

[View source]
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_persist_attributes #

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 checked_in : Bool #

#checked_in getter


def checked_in=(value : Bool) #

#checked_in setter


def checked_in? : Bool | Nil #

Assign instance variable to correct type


def checked_in_assigned? : Bool #

def checked_in_at : Int64 | Nil #

def checked_in_at=(value : Int64 | Nil) #

def checked_in_at_assigned? : Bool #

def checked_in_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def checked_in_at_changed? : Bool #

def checked_in_at_default : Int64 | Nil #

#checked_in_at's default value


[View source]
def checked_in_at_present? : Bool #

def checked_in_at_was : Int64 | Nil | Nil #

def checked_in_at_will_change! : Nil #

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


def checked_in_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


def checked_in_changed? : Bool #

def checked_in_default : Bool #

#checked_in's default value


[View source]
def checked_in_present? : Bool #

def checked_in_was : Bool | Nil #

def checked_in_will_change! : Nil #

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


def checked_out_at : Int64 | Nil #

def checked_out_at=(value : Int64 | Nil) #

def checked_out_at_assigned? : Bool #

def checked_out_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def checked_out_at_changed? : Bool #

def checked_out_at_default : Int64 | Nil #

#checked_out_at's default value


[View source]
def checked_out_at_present? : Bool #

def checked_out_at_was : Int64 | Nil | Nil #

def checked_out_at_will_change! : Nil #

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


def children : Array(Booking) | Nil #

[View source]
def clashing? : Bool #

[View source]
def clashing_bookings : Array(Booking) #

[View source]
def cleanup_recurring_instances : Nil #

remove any instance overrides if start times have changed


[View source]
def clear_changes_information #

Reset changes for all attributes.


def created : Int64 | Nil #

#created getter


def created=(value : Int64 | Nil) #

#created setter


def created_assigned? : Bool #

def created_at : Time #

#created_at getter


def created_at=(value : Time) #

#created_at setter


def created_at? : Time | Nil #

Assign instance variable to correct type


def created_at_assigned? : Bool #

def 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


def created_at_changed? : Bool #

def created_at_default : Time #

#created_at's default value


def created_at_present? : Bool #

def created_at_was : Time | Nil #

def created_at_will_change! : Nil #

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


def created_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def created_changed? : Bool #

def created_default : Int64 | Nil #

#created's default value


[View source]
def created_present? : Bool #

def created_was : Int64 | Nil | Nil #

def created_will_change! : Nil #

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


def current_history : Array(History) #

[View source]
def current_state : State #

[View source]
def deleted : Bool #

#deleted getter


def deleted=(value : Bool) #

#deleted setter


def deleted? : Bool | Nil #

Assign instance variable to correct type


def deleted_assigned? : Bool #

def deleted_at : Int64 | Nil #

#deleted_at getter


def deleted_at=(value : Int64 | Nil) #

#deleted_at setter


def deleted_at_assigned? : Bool #

def deleted_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def deleted_at_changed? : Bool #

def deleted_at_default : Int64 | Nil #

#deleted_at's default value


[View source]
def deleted_at_present? : Bool #

def deleted_at_was : Int64 | Nil | Nil #

def deleted_at_will_change! : Nil #

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


def deleted_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


def deleted_changed? : Bool #

def deleted_default : Bool #

#deleted's default value


[View source]
def deleted_present? : Bool #

def deleted_was : Bool | Nil #

def deleted_will_change! : Nil #

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


def department : String | Nil #

#department getter


def department=(value : String | Nil) #

#department setter


def department_assigned? : Bool #

def department_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


def department_changed? : Bool #

def department_default : String | Nil #

#department's default value


[View source]
def department_present? : Bool #

def department_was : String | Nil | Nil #

def department_will_change! : Nil #

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


def description : String | Nil #

#description getter


def description=(value : String | Nil) #

#description setter


def description_assigned? : Bool #

def description_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


def description_changed? : Bool #

def description_default : String | Nil #

#description's default value


[View source]
def description_present? : Bool #

def description_was : String | Nil | Nil #

def description_will_change! : Nil #

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


def destroy_attendees #

def email_digest : String | Nil #

#email_digest getter


def email_digest=(value : String | Nil) #

#email_digest setter


def email_digest_assigned? : Bool #

def email_digest_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


def email_digest_changed? : Bool #

def email_digest_default : String | Nil #

#email_digest's default value


[View source]
def email_digest_present? : Bool #

def email_digest_was : String | Nil | Nil #

def email_digest_will_change! : Nil #

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


def ending_tz : Time #

[View source]
def event_id : Int64 | Nil #

#event_id getter


def event_id=(value : Int64 | Nil) #

#event_id setter


def event_id_assigned? : Bool #

def event_id_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def event_id_changed? : Bool #

def event_id_default : Int64 | Nil #

#event_id's default value


[View source]
def event_id_present? : Bool #

def event_id_was : Int64 | Nil | Nil #

def event_id_will_change! : Nil #

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


def extension_data : JSON::Any #

def extension_data=(value : JSON::Any) #

def extension_data? : JSON::Any | Nil #

Assign instance variable to correct type


def extension_data_assigned? : Bool #

def extension_data_change : Tuple(JSON::Any | Nil, JSON::Any | Nil) | Nil #

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


def extension_data_changed? : Bool #

def extension_data_default : JSON::Any #

#extension_data's default value


[View source]
def extension_data_present? : Bool #

def extension_data_was : JSON::Any | Nil #

def extension_data_will_change! : Nil #

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


def first_recurrence_month(start_date : Time, interval_months : Int32, year : Int32) : Int32 #

[View source]
def get_nth_weekday_of_month(year : Int32, month : Int32, nth : Int32, valid_days : Array(Time::DayOfWeek), time_zone : Time::Location) : Int32 #

Helper function to find the nth day of a month


[View source]
def guests #

NOTE : not to be used directly, only here for caching


[View source]
def history : Array(PlaceOS::Model::Booking::History) #

#history getter


def history=(value : Array(PlaceOS::Model::Booking::History)) #

#history setter


def history? : Array(PlaceOS::Model::Booking::History) | Nil #

Assign instance variable to correct type


def history_assigned? : Bool #

def history_change : Tuple(Array(PlaceOS::Model::Booking::History) | Nil, Array(PlaceOS::Model::Booking::History) | Nil) | Nil #

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


def history_changed? : Bool #

def history_default : Array(History) #

#history's default value


[View source]
def history_present? : Bool #

def history_was : Array(PlaceOS::Model::Booking::History) | Nil #

def history_will_change! : Nil #

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


def hydrate_instance(starting_at : Int64) : Booking #

[View source]
def id : Int64 | Nil #

#id getter


def id=(value : Int64 | Nil) #

#id setter


def id? : Int64 | Nil | Nil #
Description copied from class PgORM::Base

Same as #id but may return nil when the record hasn't been saved instead of raising.


def id_assigned? : Bool #

def id_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def id_changed? : Bool #

def id_default : Int64 | Nil #

#id's default value


def id_present? : Bool #

def id_was : Int64 | Nil | Nil #

def id_will_change! : Nil #

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


def images : Array(String) #

#images getter


def images=(value : Array(String)) #

#images setter


def images? : Array(String) | Nil #

Assign instance variable to correct type


def images_assigned? : Bool #

def 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


def images_changed? : Bool #

def images_default : Array(String) #

#images's default value


[View source]
def images_present? : Bool #

def images_was : Array(String) | Nil #

def images_will_change! : Nil #

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


#induction getter


def induction=(value : PlaceOS::Model::Booking::Induction) #

#induction setter


def induction? : PlaceOS::Model::Booking::Induction | Nil #

Assign instance variable to correct type


def induction_assigned? : Bool #

def induction_change : Tuple(PlaceOS::Model::Booking::Induction | Nil, PlaceOS::Model::Booking::Induction | Nil) | Nil #

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


def induction_changed? : Bool #

def induction_default : Induction #

#induction's default value


[View source]
def induction_present? : Bool #

def induction_was : PlaceOS::Model::Booking::Induction | Nil #

def induction_will_change! : Nil #

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


def instance : Int64? #

Accessors for attributes without JSON mapping


def instance=(value : Int64 | Nil) #

#instance setter


def instance=(instance) #

Accessors for attributes without JSON mapping


def instance_assigned? : Bool #

def instance_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def instance_changed? : Bool #

def instance_default : Int64 | Nil #

#instance's default value


[View source]
def instance_present? : Bool #

def instance_was : Int64 | Nil | Nil #

def instance_will_change! : Nil #

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


def invoke_props #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def last_changed : Int64 | Nil #

#last_changed getter


def last_changed=(value : Int64 | Nil) #

#last_changed setter


def last_changed_assigned? : Bool #

def last_changed_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def last_changed_changed? : Bool #

def last_changed_default : Int64 | Nil #

#last_changed's default value


[View source]
def last_changed_present? : Bool #

def last_changed_was : Int64 | Nil | Nil #

def last_changed_will_change! : Nil #

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


def linked? #

[View source]
def linked_event : EventMetadata | Nil #

[View source]
def parent? #

[View source]
def parent_id : Int64 | Nil #

#parent_id getter


def parent_id=(value : Int64 | Nil) #

#parent_id setter


def parent_id_assigned? : Bool #

def parent_id_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def parent_id_changed? : Bool #

def parent_id_default : Int64 | Nil #

#parent_id's default value


[View source]
def parent_id_present? : Bool #

def parent_id_was : Int64 | Nil | Nil #

def parent_id_will_change! : Nil #

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


#permission getter


def permission=(value : PlaceOS::Model::Booking::Permission) #

#permission setter


def permission? : PlaceOS::Model::Booking::Permission | Nil #

Assign instance variable to correct type


def permission_assigned? : Bool #

def permission_change : Tuple(PlaceOS::Model::Booking::Permission | Nil, PlaceOS::Model::Booking::Permission | Nil) | Nil #

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


def permission_changed? : Bool #

def permission_default : Permission #

#permission's default value


[View source]
def permission_present? : Bool #

def permission_was : PlaceOS::Model::Booking::Permission | Nil #

def permission_will_change! : Nil #

Include #permission 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 process_state : String | Nil #

def process_state=(value : String | Nil) #

def process_state_assigned? : Bool #

def process_state_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


def process_state_changed? : Bool #

def process_state_default : String | Nil #

#process_state's default value


[View source]
def process_state_present? : Bool #

used to hold information relating to the state of the booking process


def process_state_was : String | Nil | Nil #

def process_state_will_change! : Nil #

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


def recurrence_days : Int32 #

def recurrence_days=(bitmap : Int32) #

reset recurrence_on when the bitmap changes


[View source]
def recurrence_days? : Int32 | Nil #

Assign instance variable to correct type


def recurrence_days_assigned? : Bool #

def recurrence_days_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


def recurrence_days_changed? : Bool #

def recurrence_days_default : Int32 #

#recurrence_days's default value


[View source]
def recurrence_days_present? : Bool #

def recurrence_days_was : Int32 | Nil #

def recurrence_days_will_change! : Nil #

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


def recurrence_end : Int64 | Nil #

def recurrence_end=(value : Int64 | Nil) #

def recurrence_end_assigned? : Bool #

def recurrence_end_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def recurrence_end_changed? : Bool #

def recurrence_end_default : Int64 | Nil #

#recurrence_end's default value


[View source]
def recurrence_end_present? : Bool #

def recurrence_end_was : Int64 | Nil | Nil #

def recurrence_end_will_change! : Nil #

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


def recurrence_interval : Int32 #

def recurrence_interval=(value : Int32) #

def recurrence_interval? : Int32 | Nil #

Assign instance variable to correct type


def recurrence_interval_assigned? : Bool #

def recurrence_interval_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


def recurrence_interval_changed? : Bool #

def recurrence_interval_default : Int32 #

#recurrence_interval's default value


[View source]
def recurrence_interval_present? : Bool #

def recurrence_interval_was : Int32 | Nil #

def recurrence_interval_will_change! : Nil #

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


def recurrence_nth_of_month : Int32 #

def recurrence_nth_of_month=(value : Int32) #

def recurrence_nth_of_month? : Int32 | Nil #

Assign instance variable to correct type


def recurrence_nth_of_month_assigned? : Bool #

def recurrence_nth_of_month_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


def recurrence_nth_of_month_changed? : Bool #

def recurrence_nth_of_month_default : Int32 #

#recurrence_nth_of_month's default value


[View source]
def recurrence_nth_of_month_present? : Bool #

def recurrence_nth_of_month_was : Int32 | Nil #

def recurrence_nth_of_month_will_change! : Nil #

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


def recurrence_on : Array(Time::DayOfWeek) #

[View source]
def recurrence_type : PlaceOS::Model::Booking::Recurrence #

def recurrence_type=(value : PlaceOS::Model::Booking::Recurrence) #

def recurrence_type? : PlaceOS::Model::Booking::Recurrence | Nil #

Assign instance variable to correct type


def recurrence_type_assigned? : Bool #

def recurrence_type_change : Tuple(PlaceOS::Model::Booking::Recurrence | Nil, PlaceOS::Model::Booking::Recurrence | Nil) | Nil #

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


def recurrence_type_changed? : Bool #

def recurrence_type_default : Recurrence #

#recurrence_type's default value


[View source]
def recurrence_type_present? : Bool #

def recurrence_type_was : PlaceOS::Model::Booking::Recurrence | Nil #

def recurrence_type_will_change! : Nil #

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


def recurring_booking? : Bool #

[View source]
def recurring_instance? : Bool #

[View source]
def rejected : Bool #

#rejected getter


def rejected=(value : Bool) #

#rejected setter


def rejected? : Bool | Nil #

Assign instance variable to correct type


def rejected_assigned? : Bool #

def rejected_at : Int64 | Nil #

#rejected_at getter


def rejected_at=(value : Int64 | Nil) #

#rejected_at setter


def rejected_at_assigned? : Bool #

def rejected_at_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def rejected_at_changed? : Bool #

def rejected_at_default : Int64 | Nil #

#rejected_at's default value


[View source]
def rejected_at_present? : Bool #

def rejected_at_was : Int64 | Nil | Nil #

def rejected_at_will_change! : Nil #

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


def rejected_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


def rejected_changed? : Bool #

def rejected_default : Bool #

#rejected's default value


[View source]
def rejected_present? : Bool #

def rejected_was : Bool | Nil #

def rejected_will_change! : Nil #

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


def render_event : Bool #

[View source]
def render_event=(render_event : Bool) #

[View source]
def req_attendees : Array(PlaceCalendar::Event::Attendee) | Nil #

[View source]
def req_attendees=(req_attendees : Array(PlaceCalendar::Event::Attendee) | Nil) #

[View source]
def reset_associations #

[View source]
def resp_attendees : Array(Attendee) | Nil #

[View source]
def restore_attributes #

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


def run_create_callbacks(&) #

Wrap a block with callbacks for the appropriate crud operation


[View source]
def run_destroy_callbacks(&) #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def run_save_callbacks(&) #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def run_update_callbacks(&) #
Description copied from class PlaceOS::Model::ModelWithAutoKey

Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk


[View source]
def save #

reset recurrence_on when the bitmap changes


[View source]
def save! #

reset recurrence_on when the bitmap changes


[View source]
def set_created #

[View source]
def starting_tz : Time #

[View source]
def survey_trigger #

[View source]
def table_name #

def tenant : Tenant | Nil #

Retrieves the parent relationship


[View source]
def tenant! : Tenant #

[View source]
def tenant=(parent : Tenant) #

Sets the parent relationship


[View source]
def tenant_id : Int64 | Nil #

#tenant_id getter


def tenant_id=(value : Int64 | Nil) #

#tenant_id setter


def tenant_id_assigned? : Bool #

def tenant_id_change : Tuple(Int64 | Nil | Nil, Int64 | Nil | Nil) | Nil #

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


def tenant_id_changed? : Bool #

def tenant_id_default : Int64 | Nil #

#tenant_id's default value


def tenant_id_present? : Bool #

def tenant_id_was : Int64 | Nil | Nil #

def tenant_id_will_change! : Nil #

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


def timezone : String | Nil #

#timezone getter


def timezone=(value : String | Nil) #

#timezone setter


def timezone_assigned? : Bool #

def timezone_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


def timezone_changed? : Bool #

def timezone_default : String | Nil #

#timezone's default value


[View source]
def timezone_present? : Bool #

def timezone_was : String | Nil | Nil #

def timezone_will_change! : Nil #

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


def title : String | Nil #

#title getter


def title=(value : String | Nil) #

#title setter


def title_assigned? : Bool #

def title_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


def title_changed? : Bool #

def title_default : String | Nil #

#title's default value


[View source]
def title_present? : Bool #

def title_was : String | Nil | Nil #

def title_will_change! : Nil #

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


def to_instance(starting_at : Int64 = self.booking_start) #

[View source]
def to_json(json : JSON::Builder) #

[View source]
def unique_ids? #

[View source]
def update_assets #

[View source]
def updated_at : Time #

#updated_at getter


def updated_at=(value : Time) #

#updated_at setter


def updated_at? : Time | Nil #

Assign instance variable to correct type


def updated_at_assigned? : Bool #

def 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


def updated_at_changed? : Bool #

def updated_at_default : Time #

#updated_at's default value


def updated_at_present? : Bool #

def updated_at_was : Time | Nil #

def updated_at_will_change! : Nil #

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


def user_email : PlaceOS::Model::Email #

#user_email getter


def user_email=(value : PlaceOS::Model::Email) #

#user_email setter


def user_email? : PlaceOS::Model::Email | Nil #

Assign instance variable to correct type


def user_email_assigned? : Bool #

def user_email_change : Tuple(PlaceOS::Model::Email | Nil, PlaceOS::Model::Email | Nil) | Nil #

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


def user_email_changed? : Bool #

def user_email_default : PlaceOS::Model::Email #

#user_email's default value


[View source]
def user_email_present? : Bool #

def user_email_was : PlaceOS::Model::Email | Nil #

def user_email_will_change! : Nil #

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


def user_id : String | Nil #

#user_id getter


def user_id=(value : String | Nil) #

#user_id setter


def user_id_assigned? : Bool #

def user_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


def user_id_changed? : Bool #

def user_id_default : String | Nil #

#user_id's default value


[View source]
def user_id_present? : Bool #

def user_id_was : String | Nil | Nil #

def user_id_will_change! : Nil #

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


def user_name : String #

#user_name getter


def user_name=(value : String) #

#user_name setter


def user_name? : String | Nil #

Assign instance variable to correct type


def user_name_assigned? : Bool #

def user_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


def user_name_changed? : Bool #

def user_name_default : String #

#user_name's default value


[View source]
def user_name_present? : Bool #

def user_name_was : String | Nil #

def user_name_will_change! : Nil #

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


def utm_source : String? #

Assign instance variable to correct type


def utm_source=(value : String | Nil) #

#utm_source setter


def utm_source=(utm_source) #

def utm_source_assigned? : Bool #

def utm_source_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


def utm_source_changed? : Bool #

def utm_source_default : String | Nil #

#utm_source's default value


[View source]
def utm_source_present? : Bool #

def utm_source_was : String | Nil | Nil #

def utm_source_will_change! : Nil #

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


def validate_nilability #

Validate that all non-nillable fields have values.


def zones : Array(String) #

#zones getter


def zones=(value : Array(String)) #

#zones setter


def zones? : Array(String) | Nil #

Assign instance variable to correct type


def zones_assigned? : Bool #

def 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


def zones_changed? : Bool #

def zones_default : Array(String) #

#zones's default value


[View source]
def zones_present? : Bool #

def zones_was : Array(String) | Nil #

def zones_will_change! : Nil #

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