class Utils::PlaceOSHelpers::CalendarSelection

Defined in:

controllers/utilities/placeos-helpers.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Params

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

Constructor methods inherited from class Params

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

Class methods inherited from class Params

attributes : Array(Symbol) attributes

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(calendars : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, zone_ids : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, system_ids : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, features : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, capacity : Int32 | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, bookable : Bool | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new) #

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

Initialize Utils::PlaceOSHelpers::CalendarSelection from HTTP::Params.


Class Method Detail

def self.attributes : Array(Symbol) #

Returns all attribute keys.


Instance Method Detail

def after_initialize(trusted : Bool) #

def apply_defaults #

Generate code to apply default values


def assign_attributes(calendars : String | Nil | Missing = Missing, zone_ids : String | Nil | Missing = Missing, system_ids : String | Nil | Missing = Missing, features : String | Nil | Missing = Missing, capacity : Int32 | Nil | Missing = Missing, bookable : Bool | Nil | 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 : Utils::PlaceOSHelpers::CalendarSelection) #

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 attributes #

Returns a Hash of all attribute values


def attributes_tuple #

Returns a NamedTuple of all attribute values.


def bookable : Bool | Nil #

#bookable getter


def bookable=(value : Bool | Nil) #

#bookable setter


def bookable_assigned? : Bool #

def bookable_change : Tuple(Bool | Nil | Nil, Bool | Nil | Nil) | Nil #

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


def bookable_changed? : Bool #

def bookable_default : Bool | Nil #

#bookable's default value


[View source]
def bookable_present? : Bool #

def bookable_was : Bool | Nil | Nil #

def bookable_will_change! : Nil #

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


def calendars : String | Nil #

#calendars getter


def calendars=(value : String | Nil) #

Setters #calendars setter


def calendars_assigned? : Bool #

def calendars_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 calendars_changed? : Bool #

def calendars_default : String | Nil #

#calendars's default value


[View source]
def calendars_present? : Bool #

def calendars_was : String | Nil | Nil #

def calendars_will_change! : Nil #

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


def capacity : Int32 | Nil #

#capacity getter


def capacity=(value : Int32 | Nil) #

#capacity setter


def capacity_assigned? : Bool #

def capacity_change : Tuple(Int32 | Nil | Nil, Int32 | Nil | Nil) | Nil #

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


def capacity_changed? : Bool #

def capacity_default : Int32 | Nil #

#capacity's default value


[View source]
def capacity_present? : Bool #

def capacity_was : Int32 | Nil | Nil #

def capacity_will_change! : Nil #

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


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.


def features : String | Nil #

#features getter


def features=(value : String | Nil) #

#features setter


def features_assigned? : Bool #

def features_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 features_changed? : Bool #

def features_default : String | Nil #

#features's default value


[View source]
def features_present? : Bool #

def features_was : String | Nil | Nil #

def features_will_change! : Nil #

Include #features 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 system_ids : String | Nil #

#system_ids getter


def system_ids=(value : String | Nil) #

#system_ids setter


def system_ids_assigned? : Bool #

def system_ids_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 system_ids_changed? : Bool #

def system_ids_default : String | Nil #

#system_ids's default value


[View source]
def system_ids_present? : Bool #

def system_ids_was : String | Nil | Nil #

def system_ids_will_change! : Nil #

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


def validate_nilability #

Validate that all non-nillable fields have values.


def zone_ids : String | Nil #

#zone_ids getter


def zone_ids=(value : String | Nil) #

#zone_ids setter


def zone_ids_assigned? : Bool #

def zone_ids_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 zone_ids_changed? : Bool #

def zone_ids_default : String | Nil #

#zone_ids's default value


[View source]
def zone_ids_present? : Bool #

def zone_ids_was : String | Nil | Nil #

def zone_ids_will_change! : Nil #

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