class Utils::PlaceOSHelpers::CalendarSelection
- Utils::PlaceOSHelpers::CalendarSelection
- Params
- ActiveModel::Model
- Reference
- Object
Defined in:
controllers/utilities/placeos-helpers.crConstructors
- .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. - .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)
- .new(pull : JSON::PullParser)
- .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)
-
.new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Initialize Utils::PlaceOSHelpers::CalendarSelection from
HTTP::Params.
Class Method Summary
-
.attributes : Array(Symbol)
Returns all attribute keys.
Instance Method Summary
- #after_initialize(trusted : Bool)
-
#apply_defaults
Generate code to apply default values
-
#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.
-
#assign_attributes(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
Assign to mulitple attributes via
HTTP::Params. -
#assign_attributes(model : Utils::PlaceOSHelpers::CalendarSelection)
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
Hashof all attribute values -
#attributes_tuple
Returns a
NamedTupleof all attribute values. -
#bookable : Bool | Nil
#bookablegetter -
#bookable=(value : Bool | Nil)
#bookablesetter - #bookable_assigned? : Bool
-
#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
- #bookable_changed? : Bool
-
#bookable_default : Bool | Nil
#bookable's default value - #bookable_present? : Bool
- #bookable_was : Bool | Nil | Nil
-
#bookable_will_change! : Nil
Include
#bookablein the set of changed attributes, whether it has changed or not. -
#calendars : String | Nil
#calendarsgetter -
#calendars=(value : String | Nil)
Setters
#calendarssetter - #calendars_assigned? : Bool
-
#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
- #calendars_changed? : Bool
-
#calendars_default : String | Nil
#calendars's default value - #calendars_present? : Bool
- #calendars_was : String | Nil | Nil
-
#calendars_will_change! : Nil
Include
#calendarsin the set of changed attributes, whether it has changed or not. -
#capacity : Int32 | Nil
#capacitygetter -
#capacity=(value : Int32 | Nil)
#capacitysetter - #capacity_assigned? : Bool
-
#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
- #capacity_changed? : Bool
-
#capacity_default : Int32 | Nil
#capacity's default value - #capacity_present? : Bool
- #capacity_was : Int32 | Nil | Nil
-
#capacity_will_change! : Nil
Include
#capacityin the set of changed attributes, whether it has changed or not. -
#changed?
Check if any attributes have changed.
-
#changed_attributes
Returns a
Hashwith all changed attributes. -
#changed_json(io : IO) : Nil
Serialize the set of changed attributes to JSON.
-
#changed_json : String
Serialize the set of changed attributes to JSON.
-
#changed_yaml(io : IO) : Nil
Serialize the set of changed attributes to YAML.
-
#changed_yaml : String
Serialize the set of changed attributes to YAML.
-
#clear_changes_information
Reset changes for all attributes.
-
#features : String | Nil
#featuresgetter -
#features=(value : String | Nil)
#featuressetter - #features_assigned? : Bool
-
#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
- #features_changed? : Bool
-
#features_default : String | Nil
#features's default value - #features_present? : Bool
- #features_was : String | Nil | Nil
-
#features_will_change! : Nil
Include
#featuresin the set of changed attributes, whether it has changed or not. -
#persistent_attributes
Returns a
Hashof all attributes that can be persisted. -
#restore_attributes
Reset each attribute to their previous values and clears all changes.
-
#system_ids : String | Nil
#system_idsgetter -
#system_ids=(value : String | Nil)
#system_idssetter - #system_ids_assigned? : Bool
-
#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
- #system_ids_changed? : Bool
-
#system_ids_default : String | Nil
#system_ids's default value - #system_ids_present? : Bool
- #system_ids_was : String | Nil | Nil
-
#system_ids_will_change! : Nil
Include
#system_idsin the set of changed attributes, whether it has changed or not. -
#validate_nilability
Validate that all non-nillable fields have values.
-
#zone_ids : String | Nil
#zone_idsgetter -
#zone_ids=(value : String | Nil)
#zone_idssetter - #zone_ids_assigned? : Bool
-
#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
- #zone_ids_changed? : Bool
-
#zone_ids_default : String | Nil
#zone_ids's default value - #zone_ids_present? : Bool
- #zone_ids_was : String | Nil | Nil
-
#zone_ids_will_change! : Nil
Include
#zone_idsin the set of changed attributes, whether it has changed or not.
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
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">
Serialize from a trusted JSON source
Serialize from a trusted YAML source
Initialize Utils::PlaceOSHelpers::CalendarSelection from HTTP::Params.
Class Method Detail
Instance Method Detail
Assign to multiple attributes.
Assign to mulitple attributes via HTTP::Params.
Assign to multiple attributes from a model object
Assign each field from JSON if field exists in JSON and has changed in model
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #bookable in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #calendars in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #capacity in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #features in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #system_ids in the set of changed attributes, whether it has changed or not.
Returns a Tuple of the previous and the current value of an instance variable if it has changed