Class: Propertyware::SaveUnit
- Inherits:
-
Object
- Object
- Propertyware::SaveUnit
- Defined in:
- lib/propertyware/models/save_unit.rb
Overview
SaveUnit
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#abbreviation ⇒ Object
Abbreviation of Unit.
-
#address ⇒ Object
Returns the value of attribute address.
-
#available_date ⇒ Object
Unit Available date to lease.
-
#building_id ⇒ Object
Id of the building associated with this unit.
-
#category ⇒ Object
Unit Category.
-
#county ⇒ Object
Unit region of a state.
-
#description ⇒ Object
Marketing Description.
-
#floor_number ⇒ Object
Floor number.
-
#name ⇒ Object
Name of the unit.
-
#neighborhood ⇒ Object
Neighborhood.
-
#number_bathrooms ⇒ Object
Number of bathrooms in the unit.
-
#number_bedrooms ⇒ Object
Number of bedrooms in the unit.
-
#portfolio_id ⇒ Object
Id of the portfolio associated with this unit.
-
#ready ⇒ Object
Indicates if property is ready to be leased.
-
#reason_for_property_lost ⇒ Object
Reason for property lost.
-
#residential ⇒ Object
Is Unit is Residential or Commercial.
-
#search_tag ⇒ Object
Search tag.
-
#target_deposit ⇒ Object
Target deposit amount.
-
#target_rent ⇒ Object
Market rent for the unit.
-
#target_rent_units ⇒ Object
Property target rent units.
-
#total_area ⇒ Object
Unit Area.
-
#type ⇒ Object
Indicates Unit type like Business Office,Medical Office,Showroom,R and D,Assigned Parking (Indoor),Assigned Parking (Outdoor),Warehouse,Restaurant,Shopping Mall Retail,Street Retail,Manufacturing,House,Town House,Apartment,Flat,Studio,Loft,Assigned Parking (Indoor),Assigned Parking (Outdoor) etc.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ SaveUnit
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ SaveUnit
Initializes the object
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 |
# File 'lib/propertyware/models/save_unit.rb', line 175 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Propertyware::SaveUnit` 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::SaveUnit`. 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?(:'available_date') self.available_date = attributes[:'available_date'] end if attributes.key?(:'building_id') self.building_id = attributes[:'building_id'] end if attributes.key?(:'category') self.category = attributes[:'category'] end if attributes.key?(:'county') self.county = attributes[:'county'] 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?(:'name') self.name = attributes[:'name'] 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?(:'portfolio_id') self.portfolio_id = attributes[:'portfolio_id'] end if attributes.key?(:'ready') self.ready = attributes[:'ready'] end if attributes.key?(:'reason_for_property_lost') self.reason_for_property_lost = attributes[:'reason_for_property_lost'] end if attributes.key?(:'residential') self.residential = attributes[:'residential'] end if attributes.key?(:'search_tag') self.search_tag = attributes[:'search_tag'] 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?(:'target_rent_units') self.target_rent_units = attributes[:'target_rent_units'] end if attributes.key?(:'total_area') self.total_area = attributes[:'total_area'] end if attributes.key?(:'type') self.type = attributes[:'type'] end end |
Instance Attribute Details
#abbreviation ⇒ Object
Abbreviation of Unit.
20 21 22 |
# File 'lib/propertyware/models/save_unit.rb', line 20 def abbreviation @abbreviation end |
#address ⇒ Object
Returns the value of attribute address.
22 23 24 |
# File 'lib/propertyware/models/save_unit.rb', line 22 def address @address end |
#available_date ⇒ Object
Unit Available date to lease.
25 26 27 |
# File 'lib/propertyware/models/save_unit.rb', line 25 def available_date @available_date end |
#building_id ⇒ Object
Id of the building associated with this unit.
28 29 30 |
# File 'lib/propertyware/models/save_unit.rb', line 28 def building_id @building_id end |
#category ⇒ Object
Unit Category.
31 32 33 |
# File 'lib/propertyware/models/save_unit.rb', line 31 def category @category end |
#county ⇒ Object
Unit region of a state.
34 35 36 |
# File 'lib/propertyware/models/save_unit.rb', line 34 def county @county end |
#description ⇒ Object
Marketing Description.
37 38 39 |
# File 'lib/propertyware/models/save_unit.rb', line 37 def description @description end |
#floor_number ⇒ Object
Floor number.
40 41 42 |
# File 'lib/propertyware/models/save_unit.rb', line 40 def floor_number @floor_number end |
#name ⇒ Object
Name of the unit.
43 44 45 |
# File 'lib/propertyware/models/save_unit.rb', line 43 def name @name end |
#neighborhood ⇒ Object
Neighborhood.
46 47 48 |
# File 'lib/propertyware/models/save_unit.rb', line 46 def neighborhood @neighborhood end |
#number_bathrooms ⇒ Object
Number of bathrooms in the unit.
49 50 51 |
# File 'lib/propertyware/models/save_unit.rb', line 49 def number_bathrooms @number_bathrooms end |
#number_bedrooms ⇒ Object
Number of bedrooms in the unit.
52 53 54 |
# File 'lib/propertyware/models/save_unit.rb', line 52 def number_bedrooms @number_bedrooms end |
#portfolio_id ⇒ Object
Id of the portfolio associated with this unit.
55 56 57 |
# File 'lib/propertyware/models/save_unit.rb', line 55 def portfolio_id @portfolio_id end |
#ready ⇒ Object
Indicates if property is ready to be leased.
58 59 60 |
# File 'lib/propertyware/models/save_unit.rb', line 58 def ready @ready end |
#reason_for_property_lost ⇒ Object
Reason for property lost.
61 62 63 |
# File 'lib/propertyware/models/save_unit.rb', line 61 def reason_for_property_lost @reason_for_property_lost end |
#residential ⇒ Object
Is Unit is Residential or Commercial.
64 65 66 |
# File 'lib/propertyware/models/save_unit.rb', line 64 def residential @residential end |
#search_tag ⇒ Object
Search tag.
67 68 69 |
# File 'lib/propertyware/models/save_unit.rb', line 67 def search_tag @search_tag end |
#target_deposit ⇒ Object
Target deposit amount.
70 71 72 |
# File 'lib/propertyware/models/save_unit.rb', line 70 def target_deposit @target_deposit end |
#target_rent ⇒ Object
Market rent for the unit.
73 74 75 |
# File 'lib/propertyware/models/save_unit.rb', line 73 def target_rent @target_rent end |
#target_rent_units ⇒ Object
Property target rent units.
76 77 78 |
# File 'lib/propertyware/models/save_unit.rb', line 76 def target_rent_units @target_rent_units end |
#total_area ⇒ Object
Unit Area.
79 80 81 |
# File 'lib/propertyware/models/save_unit.rb', line 79 def total_area @total_area end |
#type ⇒ Object
Indicates Unit type like Business Office,Medical Office,Showroom,R and D,Assigned Parking (Indoor),Assigned Parking (Outdoor),Warehouse,Restaurant,Shopping Mall Retail,Street Retail,Manufacturing,House,Town House,Apartment,Flat,Studio,Loft,Assigned Parking (Indoor),Assigned Parking (Outdoor) etc.
82 83 84 |
# File 'lib/propertyware/models/save_unit.rb', line 82 def type @type end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
135 136 137 |
# File 'lib/propertyware/models/save_unit.rb', line 135 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
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_unit.rb', line 107 def self.attribute_map { :'abbreviation' => :'abbreviation', :'address' => :'address', :'available_date' => :'availableDate', :'building_id' => :'buildingID', :'category' => :'category', :'county' => :'county', :'description' => :'description', :'floor_number' => :'floorNumber', :'name' => :'name', :'neighborhood' => :'neighborhood', :'number_bathrooms' => :'numberBathrooms', :'number_bedrooms' => :'numberBedrooms', :'portfolio_id' => :'portfolioID', :'ready' => :'ready', :'reason_for_property_lost' => :'reasonForPropertyLost', :'residential' => :'residential', :'search_tag' => :'searchTag', :'target_deposit' => :'targetDeposit', :'target_rent' => :'targetRent', :'target_rent_units' => :'targetRentUnits', :'total_area' => :'totalArea', :'type' => :'type' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
548 549 550 |
# File 'lib/propertyware/models/save_unit.rb', line 548 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
168 169 170 171 |
# File 'lib/propertyware/models/save_unit.rb', line 168 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
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_unit.rb', line 140 def self.openapi_types { :'abbreviation' => :'String', :'address' => :'SaveAddress', :'available_date' => :'Date', :'building_id' => :'Integer', :'category' => :'String', :'county' => :'String', :'description' => :'String', :'floor_number' => :'Integer', :'name' => :'String', :'neighborhood' => :'String', :'number_bathrooms' => :'Float', :'number_bedrooms' => :'Integer', :'portfolio_id' => :'Integer', :'ready' => :'Boolean', :'reason_for_property_lost' => :'String', :'residential' => :'Boolean', :'search_tag' => :'String', :'target_deposit' => :'Float', :'target_rent' => :'Float', :'target_rent_units' => :'String', :'total_area' => :'Float', :'type' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/propertyware/models/save_unit.rb', line 506 def ==(o) return true if self.equal?(o) self.class == o.class && abbreviation == o.abbreviation && address == o.address && available_date == o.available_date && building_id == o.building_id && category == o.category && county == o.county && description == o.description && floor_number == o.floor_number && name == o.name && neighborhood == o.neighborhood && number_bathrooms == o.number_bathrooms && number_bedrooms == o.number_bedrooms && portfolio_id == o.portfolio_id && ready == o.ready && reason_for_property_lost == o.reason_for_property_lost && residential == o.residential && search_tag == o.search_tag && target_deposit == o.target_deposit && target_rent == o.target_rent && target_rent_units == o.target_rent_units && total_area == o.total_area && type == o.type end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
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 606 607 608 609 610 611 612 613 614 615 616 |
# File 'lib/propertyware/models/save_unit.rb', line 579 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
650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/propertyware/models/save_unit.rb', line 650 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
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/propertyware/models/save_unit.rb', line 555 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
535 536 537 |
# File 'lib/propertyware/models/save_unit.rb', line 535 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
541 542 543 |
# File 'lib/propertyware/models/save_unit.rb', line 541 def hash [abbreviation, address, available_date, building_id, category, county, description, floor_number, name, neighborhood, number_bathrooms, number_bedrooms, portfolio_id, ready, reason_for_property_lost, residential, search_tag, target_deposit, target_rent, target_rent_units, total_area, type].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/propertyware/models/save_unit.rb', line 279 def list_invalid_properties invalid_properties = Array.new if @abbreviation.nil? invalid_properties.push('invalid value for "abbreviation", abbreviation cannot be nil.') end if @abbreviation.to_s.length > 12 invalid_properties.push('invalid value for "abbreviation", the character length must be smaller than or equal to 12.') end if @abbreviation.to_s.length < 1 invalid_properties.push('invalid value for "abbreviation", the character length must be great than or equal to 1.') end if @building_id.nil? invalid_properties.push('invalid value for "building_id", building_id cannot be nil.') end if @category.nil? invalid_properties.push('invalid value for "category", category cannot be nil.') end if !@description.nil? && @description.to_s.length > 65535 invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 65535.') end if !@description.nil? && @description.to_s.length < 0 invalid_properties.push('invalid value for "description", the character length must be great than or equal to 0.') end if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if !@neighborhood.nil? && @neighborhood.to_s.length > 30 invalid_properties.push('invalid value for "neighborhood", the character length must be smaller than or equal to 30.') end if !@neighborhood.nil? && @neighborhood.to_s.length < 0 invalid_properties.push('invalid value for "neighborhood", the character length must be great than or equal to 0.') end if !@number_bedrooms.nil? && @number_bedrooms > 20 invalid_properties.push('invalid value for "number_bedrooms", must be smaller than or equal to 20.') end if !@number_bedrooms.nil? && @number_bedrooms < 0 invalid_properties.push('invalid value for "number_bedrooms", must be greater than or equal to 0.') end if @portfolio_id.nil? invalid_properties.push('invalid value for "portfolio_id", portfolio_id cannot be nil.') end if !@search_tag.nil? && @search_tag.to_s.length > 25 invalid_properties.push('invalid value for "search_tag", the character length must be smaller than or equal to 25.') end if !@search_tag.nil? && @search_tag.to_s.length < 0 invalid_properties.push('invalid value for "search_tag", the character length must be great than or equal to 0.') end if @type.nil? invalid_properties.push('invalid value for "type", type cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
626 627 628 |
# File 'lib/propertyware/models/save_unit.rb', line 626 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
632 633 634 635 636 637 638 639 640 641 642 643 644 |
# File 'lib/propertyware/models/save_unit.rb', line 632 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_s ⇒ String
Returns the string representation of the object
620 621 622 |
# File 'lib/propertyware/models/save_unit.rb', line 620 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
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 |
# File 'lib/propertyware/models/save_unit.rb', line 350 def valid? return false if @abbreviation.nil? return false if @abbreviation.to_s.length > 12 return false if @abbreviation.to_s.length < 1 return false if @building_id.nil? return false if @category.nil? category_validator = EnumAttributeValidator.new('String', ["RESIDENTIAL", "COMMERCIAL"]) return false unless category_validator.valid?(@category) return false if !@description.nil? && @description.to_s.length > 65535 return false if !@description.nil? && @description.to_s.length < 0 floor_number_validator = EnumAttributeValidator.new('Integer', [0, 1, 2]) return false unless floor_number_validator.valid?(@floor_number) return false if @name.nil? return false if !@neighborhood.nil? && @neighborhood.to_s.length > 30 return false if !@neighborhood.nil? && @neighborhood.to_s.length < 0 number_bathrooms_validator = EnumAttributeValidator.new('Float', [0, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10]) return false unless number_bathrooms_validator.valid?(@number_bathrooms) return false if !@number_bedrooms.nil? && @number_bedrooms > 20 return false if !@number_bedrooms.nil? && @number_bedrooms < 0 return false if @portfolio_id.nil? reason_for_property_lost_validator = EnumAttributeValidator.new('String', ["EMPTY", "ABANDONED", "FORECLOSURE", "MGR_RETURNED_TO_OWNER", "OTB_AS_FRBO", "OWNER_MOVED_BACK", "REFERRED_TO_SALES", "REFERRED_TO_SALES_OR_SOLD"]) return false unless reason_for_property_lost_validator.valid?(@reason_for_property_lost) return false if !@search_tag.nil? && @search_tag.to_s.length > 25 return false if !@search_tag.nil? && @search_tag.to_s.length < 0 target_rent_units_validator = EnumAttributeValidator.new('String', ["DOLLAR_PER_SQ_FT_MONTH", "DOLLAR_PER_SQ_FT_YEAR", "DOLLAR_PER_SQ_M_MONTH", "DOLLAR_PER_SQ_M_YEAR", "DOLLAR_PER_MONTH", "DOLLAR_PER_WEEK", "DOLLAR_PER_NIGHT"]) return false unless target_rent_units_validator.valid?(@target_rent_units) return false if @type.nil? true end |