class PlaceOS::Model::Tenant
  
  - PlaceOS::Model::Tenant
 - PlaceOS::Model::ModelWithAutoKey
 - PgORM::Base
 - ActiveModel::Model
 - Reference
 - Object
 
Included Modules
- OpenAPI::Generator::Serializable::Adapters::ActiveModel
 - PlaceOS::Model::Associations
 - PlaceOS::Model::Scope
 - PlaceOS::Model::Timestamps
 
Extended Modules
- OpenAPI::Generator::Serializable
 
Defined in:
placeos-models/tenant.crplaceos-models/tenant/outlook_config.cr
Constant Summary
- 
        CALLBACKS = 
{before_save: [:set_delegated, :"encrypt!"] 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: [:destroy_attendees, :destroy_guests, :destroy_event_metadata] of Nil, after_destroy: [] of Nil} - 
        Log = 
::Log.for(self) - 
        VALID_PLATFORMS = 
["office365", "google"] 
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. - .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(rs : DB::ResultSet)
 - .new(name : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, domain : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, email_domain : String | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, platform : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, credentials : String | ActiveModel::Model::None = ::ActiveModel::Model::None.new, booking_limits : JSON::Any | ActiveModel::Model::None = ::ActiveModel::Model::None.new, outlook_config : PlaceOS::Model::Tenant::OutlookConfig | Nil | ActiveModel::Model::None = ::ActiveModel::Model::None.new, delegated : Bool | ActiveModel::Model::None = ::ActiveModel::Model::None.new, service_account : String | 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)
 - 
        .new(params : HTTP::Params | Hash(String, String) | Tuple(String, String))
        
          
Initialize PlaceOS::Model::Tenant from
HTTP::Params. 
Class Method Summary
- 
        .attributes : Array(Symbol)
        
          
Returns all attribute keys.
 - .auto_generate_id : Bool
 - 
        .changes(id : PrimaryKeyType = nil) : ChangeFeed
        
          
Changefeed at row (if
#idpassed) or whole table level. - .elastic
 - .from_rs(__temp_513 : DB::ResultSet)
 - .on_error(err : Exception | IO::Error)
 - .primary_key : Symbol
 - .table_name
 
Instance Method Summary
- 
        #after_create
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #after_destroy
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - #after_initialize(trusted : Bool)
 - 
        #after_save
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #after_update
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #apply_defaults
        
          
Generate code to apply default values
 - #as_json
 - 
        #assign_attributes(name : String | Nil | Missing = Missing, domain : String | Missing = Missing, email_domain : String | Nil | Missing = Missing, platform : String | Missing = Missing, credentials : String | Missing = Missing, booking_limits : JSON::Any | Missing = Missing, outlook_config : PlaceOS::Model::Tenant::OutlookConfig | Nil | Missing = Missing, delegated : Bool | Missing = Missing, service_account : String | Nil | Missing = Missing, id : Int64 | Nil | Missing = Missing, created_at : Time | Missing = Missing, updated_at : Time | 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 : PlaceOS::Model::Tenant)
        
          
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
 - #attendees
 - 
        #attributes
        
          
Returns a
Hashof all attribute values - 
        #attributes_tuple
        
          
Returns a
NamedTupleof all attribute values. - 
        #before_create
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #before_destroy
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #before_save
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #before_update
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #booking_limits : JSON::Any
        
          
#booking_limitsgetter - 
        #booking_limits=(value : JSON::Any)
        
          
#booking_limitssetter - #booking_limits? : JSON::Any | Nil
 - #booking_limits_assigned? : Bool
 - 
        #booking_limits_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
 - #booking_limits_changed? : Bool
 - 
        #booking_limits_default : JSON::Any
        
          
#booking_limits's default value - #booking_limits_present? : Bool
 - #booking_limits_was : JSON::Any | Nil
 - 
        #booking_limits_will_change! : Nil
        
          
Include
#booking_limitsin 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_persist_attributes
 - 
        #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.
 - 
        #created_at : Time
        
          
#created_atgetter - 
        #created_at=(value : Time)
        
          
#created_atsetter - #created_at? : Time | Nil
 - #created_at_assigned? : Bool
 - 
        #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
 - #created_at_changed? : Bool
 - 
        #created_at_default : Time
        
          
#created_at's default value - #created_at_present? : Bool
 - #created_at_was : Time | Nil
 - 
        #created_at_will_change! : Nil
        
          
Include
#created_atin the set of changed attributes, whether it has changed or not. - 
        #credentials : String
        
          
#credentialsgetter - 
        #credentials=(value : String)
        
          
#credentialssetter - #credentials? : String | Nil
 - #credentials_assigned? : Bool
 - 
        #credentials_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
 - #credentials_changed? : Bool
 - 
        #credentials_default : String
        
          
#credentials's default value - #credentials_present? : Bool
 - #credentials_was : String | Nil
 - 
        #credentials_will_change! : Nil
        
          
Include
#credentialsin the set of changed attributes, whether it has changed or not. - 
        #decrypt_for(user) : String
        
          
Decrypts (if user has correct privilege) and returns the credentials string
 - #decrypt_for!(user)
 - 
        #delegated : Bool
        
          
#delegatedgetter - 
        #delegated=(value : Bool)
        
          
#delegatedsetter - #delegated? : Bool | Nil
 - #delegated_assigned? : Bool
 - 
        #delegated_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
 - #delegated_changed? : Bool
 - 
        #delegated_default : Bool
        
          
#delegated's default value - #delegated_present? : Bool
 - #delegated_was : Bool | Nil
 - 
        #delegated_will_change! : Nil
        
          
Include
#delegatedin the set of changed attributes, whether it has changed or not. - #destroy_attendees
 - #destroy_event_metadata
 - #destroy_guests
 - 
        #domain : String
        
          
#domaingetter - 
        #domain=(value : String)
        
          
#domainsetter - #domain? : String | Nil
 - #domain_assigned? : Bool
 - 
        #domain_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
 - #domain_changed? : Bool
 - 
        #domain_default : String
        
          
#domain's default value - #domain_present? : Bool
 - #domain_was : String | Nil
 - 
        #domain_will_change! : Nil
        
          
Include
#domainin the set of changed attributes, whether it has changed or not. - 
        #email_domain : String | Nil
        
          
#email_domaingetter - 
        #email_domain=(value : String | Nil)
        
          
#email_domainsetter - #email_domain_assigned? : Bool
 - 
        #email_domain_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
 - #email_domain_changed? : Bool
 - 
        #email_domain_default : String | Nil
        
          
#email_domain's default value - #email_domain_present? : Bool
 - #email_domain_was : String | Nil | Nil
 - 
        #email_domain_will_change! : Nil
        
          
Include
#email_domainin the set of changed attributes, whether it has changed or not. - 
        #encrypt!
        
          
Encrypt in place
 - #event_metadata
 - #guests
 - 
        #id : Int64 | Nil
        
          
#idgetter - 
        #id=(value : Int64 | Nil)
        
          
#idsetter - 
        #id? : Int64 | Nil | Nil
        
          
Same as
#idbut may returnnilwhen the record hasn't been saved instead of raising. - #id_assigned? : Bool
 - 
        #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
 - #id_changed? : Bool
 - 
        #id_default : Int64 | Nil
        
          
#id's default value - #id_present? : Bool
 - #id_was : Int64 | Nil | Nil
 - 
        #id_will_change! : Nil
        
          
Include
#idin the set of changed attributes, whether it has changed or not. - 
        #invoke_props
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #is_encrypted? : Bool
        
          
Determine if attributes are encrypted
 - 
        #name : String | Nil
        
          
#namegetter - 
        #name=(value : String | Nil)
        
          
Setters
#namesetter - #name_assigned? : Bool
 - 
        #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
 - #name_changed? : Bool
 - 
        #name_default : String | Nil
        
          
#name's default value - #name_present? : Bool
 - #name_was : String | Nil | Nil
 - 
        #name_will_change! : Nil
        
          
Include
#namein the set of changed attributes, whether it has changed or not. - 
        #outlook_config : PlaceOS::Model::Tenant::OutlookConfig | Nil
        
          
#outlook_configgetter - 
        #outlook_config=(value : PlaceOS::Model::Tenant::OutlookConfig | Nil)
        
          
#outlook_configsetter - #outlook_config_assigned? : Bool
 - 
        #outlook_config_change : Tuple(PlaceOS::Model::Tenant::OutlookConfig | Nil | Nil, PlaceOS::Model::Tenant::OutlookConfig | Nil | Nil) | Nil
        
          
Returns a Tuple of the previous and the current value of an instance variable if it has changed
 - #outlook_config_changed? : Bool
 - 
        #outlook_config_default : OutlookConfig | Nil
        
          
#outlook_config's default value - #outlook_config_present? : Bool
 - #outlook_config_was : PlaceOS::Model::Tenant::OutlookConfig | Nil | Nil
 - 
        #outlook_config_will_change! : Nil
        
          
Include
#outlook_configin the set of changed attributes, whether it has changed or not. - 
        #persistent_attributes
        
          
Returns a
Hashof all attributes that can be persisted. - #place_calendar_client(bearer_token : String, expires : Int64 | Nil)
 - #place_calendar_client
 - 
        #platform : String
        
          
#platformgetter - 
        #platform=(value : String)
        
          
#platformsetter - #platform? : String | Nil
 - #platform_assigned? : Bool
 - 
        #platform_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
 - #platform_changed? : Bool
 - 
        #platform_default : String
        
          
#platform's default value - #platform_present? : Bool
 - #platform_was : String | Nil
 - 
        #platform_will_change! : Nil
        
          
Include
#platformin the set of changed attributes, whether it has changed or not. - 
        #restore_attributes
        
          
Reset each attribute to their previous values and clears all changes.
 - 
        #run_create_callbacks(&)
        
          
Wrap a block with callbacks for the appropriate crud operation
 - 
        #run_destroy_callbacks(&)
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #run_save_callbacks(&)
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #run_update_callbacks(&)
        
          
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
 - 
        #service_account : String | Nil
        
          
#service_accountgetter - 
        #service_account=(value : String | Nil)
        
          
#service_accountsetter - #service_account_assigned? : Bool
 - 
        #service_account_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
 - #service_account_changed? : Bool
 - 
        #service_account_default : String | Nil
        
          
#service_account's default value - #service_account_present? : Bool
 - #service_account_was : String | Nil | Nil
 - 
        #service_account_will_change! : Nil
        
          
Include
#service_accountin the set of changed attributes, whether it has changed or not. - 
        #set_delegated
        
          
ensure delegated column has been defined
 - #table_name
 - 
        #updated_at : Time
        
          
#updated_atgetter - 
        #updated_at=(value : Time)
        
          
#updated_atsetter - #updated_at? : Time | Nil
 - #updated_at_assigned? : Bool
 - 
        #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
 - #updated_at_changed? : Bool
 - 
        #updated_at_default : Time
        
          
#updated_at's default value - #updated_at_present? : Bool
 - #updated_at_was : Time | Nil
 - 
        #updated_at_will_change! : Nil
        
          
Include
#updated_atin the set of changed attributes, whether it has changed or not. - #using_service_account?
 - #valid_json?(value : String)
 - 
        #validate_nilability
        
          
Validate that all non-nillable fields have values.
 - 
        #which_account(user_email : String, resources = [] of String) : String
        
          
distribute load as much as possible when using service accounts
 
Macro Summary
Instance methods inherited from module PlaceOS::Model::Associations
  
  
    
      reset_associations
    reset_associations
    
  
    
    
  
    
    
    
  
    
  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
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 PlaceOS::Model::Tenant from HTTP::Params.
Class Method Detail
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.
Instance Method Detail
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
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
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #booking_limits 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 #created_at 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 #credentials in the set of changed attributes, whether it has changed or not.
Decrypts (if user has correct privilege) and returns the credentials string
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #delegated 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 #domain 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 #email_domain in the set of changed attributes, whether it has changed or not.
Same as #id but may return nil when the record hasn't been saved
instead of raising.
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #id in the set of changed attributes, whether it has changed or not.
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #name 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 #outlook_config 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 #platform in the set of changed attributes, whether it has changed or not.
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Base class for all models which have auto-generated bigint as pk and doesn't require string based auto generated pk
Returns a Tuple of the previous and the current value of an instance variable if it has changed
Include #service_account 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 #updated_at in the set of changed attributes, whether it has changed or not.
distribute load as much as possible when using service accounts