Class: Buildium::LeaseMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/buildium-ruby/models/lease_message.rb

Overview

This object represents a rental property lease.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ LeaseMessage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/buildium-ruby/models/lease_message.rb', line 170

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Buildium::LeaseMessage` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Buildium::LeaseMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.key?(:'property_id')
    self.property_id = attributes[:'property_id']
  end

  if attributes.key?(:'unit_id')
    self.unit_id = attributes[:'unit_id']
  end

  if attributes.key?(:'unit_number')
    self.unit_number = attributes[:'unit_number']
  end

  if attributes.key?(:'lease_from_date')
    self.lease_from_date = attributes[:'lease_from_date']
  end

  if attributes.key?(:'lease_to_date')
    self.lease_to_date = attributes[:'lease_to_date']
  end

  if attributes.key?(:'lease_type')
    self.lease_type = attributes[:'lease_type']
  end

  if attributes.key?(:'lease_status')
    self.lease_status = attributes[:'lease_status']
  end

  if attributes.key?(:'is_eviction_pending')
    self.is_eviction_pending = attributes[:'is_eviction_pending']
  end

  if attributes.key?(:'term_type')
    self.term_type = attributes[:'term_type']
  end

  if attributes.key?(:'renewal_offer_status')
    self.renewal_offer_status = attributes[:'renewal_offer_status']
  end

  if attributes.key?(:'current_tenants')
    if (value = attributes[:'current_tenants']).is_a?(Array)
      self.current_tenants = value
    end
  end

  if attributes.key?(:'current_number_of_occupants')
    self.current_number_of_occupants = attributes[:'current_number_of_occupants']
  end

  if attributes.key?(:'account_details')
    self. = attributes[:'account_details']
  end

  if attributes.key?(:'cosigners')
    if (value = attributes[:'cosigners']).is_a?(Array)
      self.cosigners = value
    end
  end

  if attributes.key?(:'automatically_move_out_tenants')
    self.automatically_move_out_tenants = attributes[:'automatically_move_out_tenants']
  end

  if attributes.key?(:'created_date_time')
    self.created_date_time = attributes[:'created_date_time']
  end

  if attributes.key?(:'last_updated_date_time')
    self.last_updated_date_time = attributes[:'last_updated_date_time']
  end

  if attributes.key?(:'move_out_data')
    if (value = attributes[:'move_out_data']).is_a?(Array)
      self.move_out_data = value
    end
  end

  if attributes.key?(:'payment_due_day')
    self.payment_due_day = attributes[:'payment_due_day']
  end

  if attributes.key?(:'tenants')
    if (value = attributes[:'tenants']).is_a?(Array)
      self.tenants = value
    end
  end
end

Instance Attribute Details

#account_detailsObject

Returns the value of attribute account_details.



58
59
60
# File 'lib/buildium-ruby/models/lease_message.rb', line 58

def 
  @account_details
end

#automatically_move_out_tenantsObject

Indicates whether to automatically move out all tenants assigned to the lease and set the lease status to past when the lease ends.



64
65
66
# File 'lib/buildium-ruby/models/lease_message.rb', line 64

def automatically_move_out_tenants
  @automatically_move_out_tenants
end

#cosignersObject

List of the cosigners on the lease.



61
62
63
# File 'lib/buildium-ruby/models/lease_message.rb', line 61

def cosigners
  @cosigners
end

#created_date_timeObject

Date and time the lease was created.



67
68
69
# File 'lib/buildium-ruby/models/lease_message.rb', line 67

def created_date_time
  @created_date_time
end

#current_number_of_occupantsObject

Count of current tenants.



56
57
58
# File 'lib/buildium-ruby/models/lease_message.rb', line 56

def current_number_of_occupants
  @current_number_of_occupants
end

#current_tenantsObject

List of the current tenants on the lease.



53
54
55
# File 'lib/buildium-ruby/models/lease_message.rb', line 53

def current_tenants
  @current_tenants
end

#idObject

Lease unique identifier.



20
21
22
# File 'lib/buildium-ruby/models/lease_message.rb', line 20

def id
  @id
end

#is_eviction_pendingObject

Indicates whether the lease has an eviction pending.



44
45
46
# File 'lib/buildium-ruby/models/lease_message.rb', line 44

def is_eviction_pending
  @is_eviction_pending
end

#last_updated_date_timeObject

The date and time the lease was last updated.



70
71
72
# File 'lib/buildium-ruby/models/lease_message.rb', line 70

def last_updated_date_time
  @last_updated_date_time
end

#lease_from_dateObject

Start date of the lease.



32
33
34
# File 'lib/buildium-ruby/models/lease_message.rb', line 32

def lease_from_date
  @lease_from_date
end

#lease_statusObject

Indicates the status of the lease.



41
42
43
# File 'lib/buildium-ruby/models/lease_message.rb', line 41

def lease_status
  @lease_status
end

#lease_to_dateObject

End date of the lease.



35
36
37
# File 'lib/buildium-ruby/models/lease_message.rb', line 35

def lease_to_date
  @lease_to_date
end

#lease_typeObject

Describes the type of lease.



38
39
40
# File 'lib/buildium-ruby/models/lease_message.rb', line 38

def lease_type
  @lease_type
end

#move_out_dataObject

Move out data of lease



73
74
75
# File 'lib/buildium-ruby/models/lease_message.rb', line 73

def move_out_data
  @move_out_data
end

#payment_due_dayObject

Day of the month payment is due.



76
77
78
# File 'lib/buildium-ruby/models/lease_message.rb', line 76

def payment_due_day
  @payment_due_day
end

#property_idObject

Rental property unique identifier.



23
24
25
# File 'lib/buildium-ruby/models/lease_message.rb', line 23

def property_id
  @property_id
end

#renewal_offer_statusObject

Describes the status of the renewal offer. Null if no renewal offer exists.



50
51
52
# File 'lib/buildium-ruby/models/lease_message.rb', line 50

def renewal_offer_status
  @renewal_offer_status
end

#tenantsObject

List of all tenants ever associated with the lease



79
80
81
# File 'lib/buildium-ruby/models/lease_message.rb', line 79

def tenants
  @tenants
end

#term_typeObject

Describes the term type of the lease.



47
48
49
# File 'lib/buildium-ruby/models/lease_message.rb', line 47

def term_type
  @term_type
end

#unit_idObject

Unit unique identifier.



26
27
28
# File 'lib/buildium-ruby/models/lease_message.rb', line 26

def unit_id
  @unit_id
end

#unit_numberObject

Unit number specified in the lease.



29
30
31
# File 'lib/buildium-ruby/models/lease_message.rb', line 29

def unit_number
  @unit_number
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



131
132
133
# File 'lib/buildium-ruby/models/lease_message.rb', line 131

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/buildium-ruby/models/lease_message.rb', line 104

def self.attribute_map
  {
    :'id' => :'Id',
    :'property_id' => :'PropertyId',
    :'unit_id' => :'UnitId',
    :'unit_number' => :'UnitNumber',
    :'lease_from_date' => :'LeaseFromDate',
    :'lease_to_date' => :'LeaseToDate',
    :'lease_type' => :'LeaseType',
    :'lease_status' => :'LeaseStatus',
    :'is_eviction_pending' => :'IsEvictionPending',
    :'term_type' => :'TermType',
    :'renewal_offer_status' => :'RenewalOfferStatus',
    :'current_tenants' => :'CurrentTenants',
    :'current_number_of_occupants' => :'CurrentNumberOfOccupants',
    :'account_details' => :'AccountDetails',
    :'cosigners' => :'Cosigners',
    :'automatically_move_out_tenants' => :'AutomaticallyMoveOutTenants',
    :'created_date_time' => :'CreatedDateTime',
    :'last_updated_date_time' => :'LastUpdatedDateTime',
    :'move_out_data' => :'MoveOutData',
    :'payment_due_day' => :'PaymentDueDay',
    :'tenants' => :'Tenants'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



380
381
382
# File 'lib/buildium-ruby/models/lease_message.rb', line 380

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



163
164
165
166
# File 'lib/buildium-ruby/models/lease_message.rb', line 163

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/buildium-ruby/models/lease_message.rb', line 136

def self.openapi_types
  {
    :'id' => :'Integer',
    :'property_id' => :'Integer',
    :'unit_id' => :'Integer',
    :'unit_number' => :'String',
    :'lease_from_date' => :'Date',
    :'lease_to_date' => :'Date',
    :'lease_type' => :'String',
    :'lease_status' => :'String',
    :'is_eviction_pending' => :'Boolean',
    :'term_type' => :'String',
    :'renewal_offer_status' => :'String',
    :'current_tenants' => :'Array<TenantMessage>',
    :'current_number_of_occupants' => :'Integer',
    :'account_details' => :'LeaseAccountDetailMessage',
    :'cosigners' => :'Array<CosignerMessage>',
    :'automatically_move_out_tenants' => :'Boolean',
    :'created_date_time' => :'Time',
    :'last_updated_date_time' => :'Time',
    :'move_out_data' => :'Array<LeaseMoveOutDataMessage>',
    :'payment_due_day' => :'Integer',
    :'tenants' => :'Array<LeaseTenantMessage>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/buildium-ruby/models/lease_message.rb', line 339

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      property_id == o.property_id &&
      unit_id == o.unit_id &&
      unit_number == o.unit_number &&
      lease_from_date == o.lease_from_date &&
      lease_to_date == o.lease_to_date &&
      lease_type == o.lease_type &&
      lease_status == o.lease_status &&
      is_eviction_pending == o.is_eviction_pending &&
      term_type == o.term_type &&
      renewal_offer_status == o.renewal_offer_status &&
      current_tenants == o.current_tenants &&
      current_number_of_occupants == o.current_number_of_occupants &&
       == o. &&
      cosigners == o.cosigners &&
      automatically_move_out_tenants == o.automatically_move_out_tenants &&
      created_date_time == o.created_date_time &&
      last_updated_date_time == o.last_updated_date_time &&
      move_out_data == o.move_out_data &&
      payment_due_day == o.payment_due_day &&
      tenants == o.tenants
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'lib/buildium-ruby/models/lease_message.rb', line 411

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Buildium.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/buildium-ruby/models/lease_message.rb', line 482

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/buildium-ruby/models/lease_message.rb', line 387

def build_from_hash(attributes)
  return unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


367
368
369
# File 'lib/buildium-ruby/models/lease_message.rb', line 367

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



373
374
375
# File 'lib/buildium-ruby/models/lease_message.rb', line 373

def hash
  [id, property_id, unit_id, unit_number, lease_from_date, lease_to_date, lease_type, lease_status, is_eviction_pending, term_type, renewal_offer_status, current_tenants, current_number_of_occupants, , cosigners, automatically_move_out_tenants, created_date_time, last_updated_date_time, move_out_data, payment_due_day, tenants].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



278
279
280
281
# File 'lib/buildium-ruby/models/lease_message.rb', line 278

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



458
459
460
# File 'lib/buildium-ruby/models/lease_message.rb', line 458

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/buildium-ruby/models/lease_message.rb', line 464

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



452
453
454
# File 'lib/buildium-ruby/models/lease_message.rb', line 452

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



285
286
287
288
289
290
291
292
293
294
295
# File 'lib/buildium-ruby/models/lease_message.rb', line 285

def valid?
  lease_type_validator = EnumAttributeValidator.new('String', ["None", "Fixed", "FixedWithRollover", "AtWill"])
  return false unless lease_type_validator.valid?(@lease_type)
  lease_status_validator = EnumAttributeValidator.new('String', ["Active", "Past", "Future"])
  return false unless lease_status_validator.valid?(@lease_status)
  term_type_validator = EnumAttributeValidator.new('String', ["MonthToMonth", "Standard", "Owner"])
  return false unless term_type_validator.valid?(@term_type)
  renewal_offer_status_validator = EnumAttributeValidator.new('String', ["NotSet", "NotStarted", "Generated", "Declined", "Renewed", "Draft", "Unsigned", "PartiallySigned", "Countersign", "Activated", "Sent", "Accepted"])
  return false unless renewal_offer_status_validator.valid?(@renewal_offer_status)
  true
end