Class: Propertyware::SaveLease

Inherits:
Object
  • Object
show all
Defined in:
lib/propertyware/models/save_lease.rb

Overview

Lease for Request

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SaveLease

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
275
276
277
# File 'lib/propertyware/models/save_lease.rb', line 175

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Propertyware::SaveLease` 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 `Propertyware::SaveLease`. 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?(:'base_rent')
    self.base_rent = attributes[:'base_rent']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#base_rentObject

Property base rent.



20
21
22
# File 'lib/propertyware/models/save_lease.rb', line 20

def base_rent
  @base_rent
end

#commentsObject

Comments.



23
24
25
# File 'lib/propertyware/models/save_lease.rb', line 23

def comments
  @comments
end

#end_dateObject

End date of the lease term.



26
27
28
# File 'lib/propertyware/models/save_lease.rb', line 26

def end_date
  @end_date
end

#leasing_fee_amountObject

Move in leasing fee amount.



29
30
31
# File 'lib/propertyware/models/save_lease.rb', line 29

def leasing_fee_amount
  @leasing_fee_amount
end

#leasing_fee_dateObject

Move in leasing fee post date.



32
33
34
# File 'lib/propertyware/models/save_lease.rb', line 32

def leasing_fee_date
  @leasing_fee_date
end

#leasing_fee_ref_noObject

Move in leasing fee reference number.



35
36
37
# File 'lib/propertyware/models/save_lease.rb', line 35

def leasing_fee_ref_no
  @leasing_fee_ref_no
end

#move_in_dateObject

Move In Date.



38
39
40
# File 'lib/propertyware/models/save_lease.rb', line 38

def move_in_date
  @move_in_date
end

#move_out_dateObject

Move Out Date.



41
42
43
# File 'lib/propertyware/models/save_lease.rb', line 41

def move_out_date
  @move_out_date
end

#post_first_chargeObject

Indicates how to post first rent charge while move in.



44
45
46
# File 'lib/propertyware/models/save_lease.rb', line 44

def post_first_charge
  @post_first_charge
end

#primary_contact_idObject

Primary contact ID, Should be one of tenant IDs.



47
48
49
# File 'lib/propertyware/models/save_lease.rb', line 47

def primary_contact_id
  @primary_contact_id
end

#prorate_monthObject

Indicates how to post first rent charge while move in.



50
51
52
# File 'lib/propertyware/models/save_lease.rb', line 50

def prorate_month
  @prorate_month
end

#public_assistance_programObject

Public assistance program. Allowed values are ‘None’, ‘Section 8’, ‘SCRIE’, ‘Rent Control’, ‘EDEN INC. - Shelter Care Plus’, ‘CLC’, ‘DHAP’, ‘FEMA’, ‘Harris County’ etc.



53
54
55
# File 'lib/propertyware/models/save_lease.rb', line 53

def public_assistance_program
  @public_assistance_program
end

#rent_auto_chargeObject

Returns the value of attribute rent_auto_charge.



55
56
57
# File 'lib/propertyware/models/save_lease.rb', line 55

def rent_auto_charge
  @rent_auto_charge
end

#schedule_move_out_dateObject

Scheduled move out date.



58
59
60
# File 'lib/propertyware/models/save_lease.rb', line 58

def schedule_move_out_date
  @schedule_move_out_date
end

#search_tagObject

Search tag.



61
62
63
# File 'lib/propertyware/models/save_lease.rb', line 61

def search_tag
  @search_tag
end

#sec_dep_amountObject

Move in security deposit amount.



64
65
66
# File 'lib/propertyware/models/save_lease.rb', line 64

def sec_dep_amount
  @sec_dep_amount
end

#sec_dep_charge_dateObject

Move in security deposit charge date.



67
68
69
# File 'lib/propertyware/models/save_lease.rb', line 67

def sec_dep_charge_date
  @sec_dep_charge_date
end

#signed_dateObject

Lease signed date.



70
71
72
# File 'lib/propertyware/models/save_lease.rb', line 70

def signed_date
  @signed_date
end

#start_dateObject

Start date of the lease term.



73
74
75
# File 'lib/propertyware/models/save_lease.rb', line 73

def start_date
  @start_date
end

#statusObject

Indicates lease status. Allowed values are ‘Active’, ‘Active - Notice Given’, ‘Draft’, ‘Eviction’, ‘Terminated’ etc.



76
77
78
# File 'lib/propertyware/models/save_lease.rb', line 76

def status
  @status
end

#tenant_idsObject

List of tenant IDs.



79
80
81
# File 'lib/propertyware/models/save_lease.rb', line 79

def tenant_ids
  @tenant_ids
end

#unit_idObject

Unit/Building ID associated with this lease.



82
83
84
# File 'lib/propertyware/models/save_lease.rb', line 82

def unit_id
  @unit_id
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



135
136
137
# File 'lib/propertyware/models/save_lease.rb', line 135

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/propertyware/models/save_lease.rb', line 107

def self.attribute_map
  {
    :'base_rent' => :'baseRent',
    :'comments' => :'comments',
    :'end_date' => :'endDate',
    :'leasing_fee_amount' => :'leasingFeeAmount',
    :'leasing_fee_date' => :'leasingFeeDate',
    :'leasing_fee_ref_no' => :'leasingFeeRefNo',
    :'move_in_date' => :'moveInDate',
    :'move_out_date' => :'moveOutDate',
    :'post_first_charge' => :'postFirstCharge',
    :'primary_contact_id' => :'primaryContactID',
    :'prorate_month' => :'prorateMonth',
    :'public_assistance_program' => :'publicAssistanceProgram',
    :'rent_auto_charge' => :'rentAutoCharge',
    :'schedule_move_out_date' => :'scheduleMoveOutDate',
    :'search_tag' => :'searchTag',
    :'sec_dep_amount' => :'secDepAmount',
    :'sec_dep_charge_date' => :'secDepChargeDate',
    :'signed_date' => :'signedDate',
    :'start_date' => :'startDate',
    :'status' => :'status',
    :'tenant_ids' => :'tenantIDs',
    :'unit_id' => :'unitID'
  }
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



378
379
380
# File 'lib/propertyware/models/save_lease.rb', line 378

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

.openapi_nullableObject

List of attributes with nullable: true



168
169
170
171
# File 'lib/propertyware/models/save_lease.rb', line 168

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

.openapi_typesObject

Attribute type mapping.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/propertyware/models/save_lease.rb', line 140

def self.openapi_types
  {
    :'base_rent' => :'Float',
    :'comments' => :'String',
    :'end_date' => :'Date',
    :'leasing_fee_amount' => :'Float',
    :'leasing_fee_date' => :'Date',
    :'leasing_fee_ref_no' => :'String',
    :'move_in_date' => :'Date',
    :'move_out_date' => :'Date',
    :'post_first_charge' => :'Boolean',
    :'primary_contact_id' => :'Integer',
    :'prorate_month' => :'String',
    :'public_assistance_program' => :'String',
    :'rent_auto_charge' => :'SaveAutoCharge',
    :'schedule_move_out_date' => :'Date',
    :'search_tag' => :'String',
    :'sec_dep_amount' => :'Float',
    :'sec_dep_charge_date' => :'Date',
    :'signed_date' => :'Date',
    :'start_date' => :'Date',
    :'status' => :'String',
    :'tenant_ids' => :'Array<Integer>',
    :'unit_id' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/propertyware/models/save_lease.rb', line 336

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      base_rent == o.base_rent &&
      comments == o.comments &&
      end_date == o.end_date &&
      leasing_fee_amount == o.leasing_fee_amount &&
      leasing_fee_date == o.leasing_fee_date &&
      leasing_fee_ref_no == o.leasing_fee_ref_no &&
      move_in_date == o.move_in_date &&
      move_out_date == o.move_out_date &&
      post_first_charge == o.post_first_charge &&
      primary_contact_id == o.primary_contact_id &&
      prorate_month == o.prorate_month &&
      public_assistance_program == o.public_assistance_program &&
      rent_auto_charge == o.rent_auto_charge &&
      schedule_move_out_date == o.schedule_move_out_date &&
      search_tag == o.search_tag &&
      sec_dep_amount == o.sec_dep_amount &&
      sec_dep_charge_date == o.sec_dep_charge_date &&
      signed_date == o.signed_date &&
      start_date == o.start_date &&
      status == o.status &&
      tenant_ids == o.tenant_ids &&
      unit_id == o.unit_id
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



409
410
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
# File 'lib/propertyware/models/save_lease.rb', line 409

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 = Propertyware.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



480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/propertyware/models/save_lease.rb', line 480

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



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/propertyware/models/save_lease.rb', line 385

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


365
366
367
# File 'lib/propertyware/models/save_lease.rb', line 365

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



371
372
373
# File 'lib/propertyware/models/save_lease.rb', line 371

def hash
  [base_rent, comments, end_date, leasing_fee_amount, leasing_fee_date, leasing_fee_ref_no, move_in_date, move_out_date, post_first_charge, primary_contact_id, prorate_month, public_assistance_program, rent_auto_charge, schedule_move_out_date, search_tag, sec_dep_amount, sec_dep_charge_date, signed_date, start_date, status, tenant_ids, unit_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/propertyware/models/save_lease.rb', line 281

def list_invalid_properties
  invalid_properties = Array.new
  if @end_date.nil?
    invalid_properties.push('invalid value for "end_date", end_date cannot be nil.')
  end

  if @move_in_date.nil?
    invalid_properties.push('invalid value for "move_in_date", move_in_date cannot be nil.')
  end

  if @primary_contact_id.nil?
    invalid_properties.push('invalid value for "primary_contact_id", primary_contact_id cannot be nil.')
  end

  if @start_date.nil?
    invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
  end

  if @tenant_ids.nil?
    invalid_properties.push('invalid value for "tenant_ids", tenant_ids cannot be nil.')
  end

  if @unit_id.nil?
    invalid_properties.push('invalid value for "unit_id", unit_id cannot be nil.')
  end

  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



456
457
458
# File 'lib/propertyware/models/save_lease.rb', line 456

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



462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/propertyware/models/save_lease.rb', line 462

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



450
451
452
# File 'lib/propertyware/models/save_lease.rb', line 450

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



312
313
314
315
316
317
318
319
320
321
322
# File 'lib/propertyware/models/save_lease.rb', line 312

def valid?
  return false if @end_date.nil?
  return false if @move_in_date.nil?
  return false if @primary_contact_id.nil?
  prorate_month_validator = EnumAttributeValidator.new('String', ["DO_NOT_PRORATE", "FIRST_MONTH_PRORATE", "SECOND_MONTH_PRORATE"])
  return false unless prorate_month_validator.valid?(@prorate_month)
  return false if @start_date.nil?
  return false if @tenant_ids.nil?
  return false if @unit_id.nil?
  true
end