Class: Propertyware::SaveBuilding

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

Overview

SaveBuilding

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SaveBuilding

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
278
279
280
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/propertyware/models/save_building.rb', line 235

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#abbreviationObject

Abbreviation of Building.



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

def abbreviation
  @abbreviation
end

#addressObject

Returns the value of attribute address.



22
23
24
# File 'lib/propertyware/models/save_building.rb', line 22

def address
  @address
end

#allocation_methodObject

Allocation method.



25
26
27
# File 'lib/propertyware/models/save_building.rb', line 25

def allocation_method
  @allocation_method
end

#available_dateObject

Date the building is available for leasing.



28
29
30
# File 'lib/propertyware/models/save_building.rb', line 28

def available_date
  @available_date
end

#categoryObject

Building category.



31
32
33
# File 'lib/propertyware/models/save_building.rb', line 31

def category
  @category
end

#count_unitObject

Indicates number of units in the building.



34
35
36
# File 'lib/propertyware/models/save_building.rb', line 34

def count_unit
  @count_unit
end

#descriptionObject

Marketing description.



37
38
39
# File 'lib/propertyware/models/save_building.rb', line 37

def description
  @description
end

#floor_numberObject

Floor number.



40
41
42
# File 'lib/propertyware/models/save_building.rb', line 40

def floor_number
  @floor_number
end

#management_fee_typeObject

Indicates management fee type of a building.



43
44
45
# File 'lib/propertyware/models/save_building.rb', line 43

def management_fee_type
  @management_fee_type
end

#management_flat_feeObject

Indicates management flat fee.



46
47
48
# File 'lib/propertyware/models/save_building.rb', line 46

def management_flat_fee
  @management_flat_fee
end

#marketing_nameObject

Marketing name.



49
50
51
# File 'lib/propertyware/models/save_building.rb', line 49

def marketing_name
  @marketing_name
end

#multi_unitObject

Indicates if the building is multi family or single family.



52
53
54
# File 'lib/propertyware/models/save_building.rb', line 52

def multi_unit
  @multi_unit
end

#nameObject

Name of the building.



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

def name
  @name
end

#namingObject

Unit naming (Unit, Suite, Space, Custom).



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

def naming
  @naming
end

#neighborhoodObject

Neighborhood.



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

def neighborhood
  @neighborhood
end

#number_bathroomsObject

Number of bathrooms in the building.



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

def number_bathrooms
  @number_bathrooms
end

#number_bedroomsObject

Number of bedrooms in the building.



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

def number_bedrooms
  @number_bedrooms
end

#number_floorsObject

Number of floors.



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

def number_floors
  @number_floors
end

#numberedObject

Numbered alpha, numeric.



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

def numbered
  @numbered
end

#other_tenant_chargesObject

Other tenant charges.



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

def other_tenant_charges
  @other_tenant_charges
end

#parcel_numberObject

Parcel number.



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

def parcel_number
  @parcel_number
end

#pets_allowedObject

Pets allowed.



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

def pets_allowed
  @pets_allowed
end

#portfolio_idObject

ID of the portfolio associated with this building.



85
86
87
# File 'lib/propertyware/models/save_building.rb', line 85

def portfolio_id
  @portfolio_id
end

#posting_titleObject

Marketing posting title.



88
89
90
# File 'lib/propertyware/models/save_building.rb', line 88

def posting_title
  @posting_title
end

#property_typeObject

Property type.



91
92
93
# File 'lib/propertyware/models/save_building.rb', line 91

def property_type
  @property_type
end

#published_for_rentObject

Published for rent.



94
95
96
# File 'lib/propertyware/models/save_building.rb', line 94

def published_for_rent
  @published_for_rent
end

#rentableObject

Indicates if the building is rentable.



97
98
99
# File 'lib/propertyware/models/save_building.rb', line 97

def rentable
  @rentable
end

#search_tagObject

Search tag name.



100
101
102
# File 'lib/propertyware/models/save_building.rb', line 100

def search_tag
  @search_tag
end

#short_descriptionObject

Marketing short description.



103
104
105
# File 'lib/propertyware/models/save_building.rb', line 103

def short_description
  @short_description
end

#target_depositObject

Target deposit amount.



106
107
108
# File 'lib/propertyware/models/save_building.rb', line 106

def target_deposit
  @target_deposit
end

#target_rentObject

Market rent for the building.



109
110
111
# File 'lib/propertyware/models/save_building.rb', line 109

def target_rent
  @target_rent
end

#total_areaObject

Building area.



112
113
114
# File 'lib/propertyware/models/save_building.rb', line 112

def total_area
  @total_area
end

#typeObject

Indicates Building type like Office, Industrial, Retail, Healthcare, Government, Airport, Garage/Parking, Apartment Building, Duplex / Triplex, Mobile Home / RV Community etc.



115
116
117
# File 'lib/propertyware/models/save_building.rb', line 115

def type
  @type
end

#year_built_as_stringObject

Building built year.



118
119
120
# File 'lib/propertyware/models/save_building.rb', line 118

def year_built_as_string
  @year_built_as_string
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



183
184
185
# File 'lib/propertyware/models/save_building.rb', line 183

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/propertyware/models/save_building.rb', line 143

def self.attribute_map
  {
    :'abbreviation' => :'abbreviation',
    :'address' => :'address',
    :'allocation_method' => :'allocationMethod',
    :'available_date' => :'availableDate',
    :'category' => :'category',
    :'count_unit' => :'countUnit',
    :'description' => :'description',
    :'floor_number' => :'floorNumber',
    :'management_fee_type' => :'managementFeeType',
    :'management_flat_fee' => :'managementFlatFee',
    :'marketing_name' => :'marketingName',
    :'multi_unit' => :'multiUnit',
    :'name' => :'name',
    :'naming' => :'naming',
    :'neighborhood' => :'neighborhood',
    :'number_bathrooms' => :'numberBathrooms',
    :'number_bedrooms' => :'numberBedrooms',
    :'number_floors' => :'numberFloors',
    :'numbered' => :'numbered',
    :'other_tenant_charges' => :'otherTenantCharges',
    :'parcel_number' => :'parcelNumber',
    :'pets_allowed' => :'petsAllowed',
    :'portfolio_id' => :'portfolioID',
    :'posting_title' => :'postingTitle',
    :'property_type' => :'propertyType',
    :'published_for_rent' => :'publishedForRent',
    :'rentable' => :'rentable',
    :'search_tag' => :'searchTag',
    :'short_description' => :'shortDescription',
    :'target_deposit' => :'targetDeposit',
    :'target_rent' => :'targetRent',
    :'total_area' => :'totalArea',
    :'type' => :'type',
    :'year_built_as_string' => :'yearBuiltAsString'
  }
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



537
538
539
# File 'lib/propertyware/models/save_building.rb', line 537

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

.openapi_nullableObject

List of attributes with nullable: true



228
229
230
231
# File 'lib/propertyware/models/save_building.rb', line 228

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/propertyware/models/save_building.rb', line 188

def self.openapi_types
  {
    :'abbreviation' => :'String',
    :'address' => :'SaveAddress',
    :'allocation_method' => :'String',
    :'available_date' => :'Date',
    :'category' => :'String',
    :'count_unit' => :'Integer',
    :'description' => :'String',
    :'floor_number' => :'Integer',
    :'management_fee_type' => :'String',
    :'management_flat_fee' => :'Float',
    :'marketing_name' => :'String',
    :'multi_unit' => :'Boolean',
    :'name' => :'String',
    :'naming' => :'String',
    :'neighborhood' => :'String',
    :'number_bathrooms' => :'Float',
    :'number_bedrooms' => :'Integer',
    :'number_floors' => :'Integer',
    :'numbered' => :'String',
    :'other_tenant_charges' => :'String',
    :'parcel_number' => :'String',
    :'pets_allowed' => :'Boolean',
    :'portfolio_id' => :'Integer',
    :'posting_title' => :'String',
    :'property_type' => :'String',
    :'published_for_rent' => :'String',
    :'rentable' => :'Boolean',
    :'search_tag' => :'String',
    :'short_description' => :'String',
    :'target_deposit' => :'Float',
    :'target_rent' => :'Float',
    :'total_area' => :'Float',
    :'type' => :'String',
    :'year_built_as_string' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
# File 'lib/propertyware/models/save_building.rb', line 483

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      abbreviation == o.abbreviation &&
      address == o.address &&
      allocation_method == o.allocation_method &&
      available_date == o.available_date &&
      category == o.category &&
      count_unit == o.count_unit &&
      description == o.description &&
      floor_number == o.floor_number &&
      management_fee_type == o.management_fee_type &&
      management_flat_fee == o.management_flat_fee &&
      marketing_name == o.marketing_name &&
      multi_unit == o.multi_unit &&
      name == o.name &&
      naming == o.naming &&
      neighborhood == o.neighborhood &&
      number_bathrooms == o.number_bathrooms &&
      number_bedrooms == o.number_bedrooms &&
      number_floors == o.number_floors &&
      numbered == o.numbered &&
      other_tenant_charges == o.other_tenant_charges &&
      parcel_number == o.parcel_number &&
      pets_allowed == o.pets_allowed &&
      portfolio_id == o.portfolio_id &&
      posting_title == o.posting_title &&
      property_type == o.property_type &&
      published_for_rent == o.published_for_rent &&
      rentable == o.rentable &&
      search_tag == o.search_tag &&
      short_description == o.short_description &&
      target_deposit == o.target_deposit &&
      target_rent == o.target_rent &&
      total_area == o.total_area &&
      type == o.type &&
      year_built_as_string == o.year_built_as_string
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



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/propertyware/models/save_building.rb', line 568

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



639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/propertyware/models/save_building.rb', line 639

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



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/propertyware/models/save_building.rb', line 544

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


524
525
526
# File 'lib/propertyware/models/save_building.rb', line 524

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



530
531
532
# File 'lib/propertyware/models/save_building.rb', line 530

def hash
  [abbreviation, address, allocation_method, available_date, category, count_unit, description, floor_number, management_fee_type, management_flat_fee, marketing_name, multi_unit, name, naming, neighborhood, number_bathrooms, number_bedrooms, number_floors, numbered, other_tenant_charges, parcel_number, pets_allowed, portfolio_id, posting_title, property_type, published_for_rent, rentable, search_tag, short_description, target_deposit, target_rent, total_area, type, year_built_as_string].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/propertyware/models/save_building.rb', line 387

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

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

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

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

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

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

  if @type.nil?
    invalid_properties.push('invalid value for "type", type 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



615
616
617
# File 'lib/propertyware/models/save_building.rb', line 615

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



621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'lib/propertyware/models/save_building.rb', line 621

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



609
610
611
# File 'lib/propertyware/models/save_building.rb', line 609

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



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/propertyware/models/save_building.rb', line 422

def valid?
  return false if @abbreviation.nil?
  allocation_method_validator = EnumAttributeValidator.new('String', ["By Square Foot", "By Percent"])
  return false unless allocation_method_validator.valid?(@allocation_method)
  return false if @category.nil?
  category_validator = EnumAttributeValidator.new('String', ["RESIDENTIAL", "COMMERCIAL"])
  return false unless category_validator.valid?(@category)
  return false if @count_unit.nil?
  return false if @name.nil?
  return false if @portfolio_id.nil?
  return false if @property_type.nil?
  property_type_validator = EnumAttributeValidator.new('String', ["NONE", "APARTMENT", "CONDO", "COMMERCIAL", "DU_FOUR_PLEX", "HOUSE", "SECTION_8_AFFORDABLE", "SENIOR", "SHORT_TERM_VACATION", "STUDENT", "TOWNHOUSE", "OTHER"])
  return false unless property_type_validator.valid?(@property_type)
  published_for_rent_validator = EnumAttributeValidator.new('String', ["Yes", "No"])
  return false unless published_for_rent_validator.valid?(@published_for_rent)
  return false if @type.nil?
  true
end