Class: Asdawqw::Property
- Defined in:
- lib/asdawqw/models/property.rb
Overview
Property Model.
Instance Attribute Summary collapse
-
#alt_id ⇒ Integer
Alternative Id of the property (ID in your PMS system).
-
#attributes_with_quantity ⇒ List of AttributesWithQuantity
Use this param instead of previous if you need to set quantity more than 1 of attributes.
-
#bathrooms ⇒ Integer
Number of bathrooms.
-
#bedroom_configuration ⇒ BedroomConfiguration
Bedroom configuration.
-
#check_in_time ⇒ String
Time of Check in (HH:MM:SS).
-
#check_in_to_time ⇒ String
Time Check in to (HH:MM:SS).
-
#check_out_time ⇒ String
Time of Check out (HH:MM:SS).
-
#childs ⇒ Integer
Number of allowed children (from 7 to 12 years).
-
#currency ⇒ String
Property currency.
-
#id ⇒ Integer
Property ID in BookingPal.
-
#latitude ⇒ Float
Latitude of the property (Must set field latitude and longitude or location).
-
#living_room ⇒ Integer
Number of Living rooms.
-
#location ⇒ Location
Property location (Must set field latitude and longitude or location).
-
#longitude ⇒ Float
Longitude of the property (Must set field latitude and longitude or location).
-
#multi_unit ⇒ MultiUnitEnum
For regular properties (single units) you should not use this field.
-
#name ⇒ String
Name of the property to display in the list.
-
#nearby_amenities ⇒ List of NearbyAmenity
List of Nearby Attributes models.
-
#notes ⇒ Notes
Property descriptions.
-
#parent_id ⇒ Integer
This fields should not be used unless your property is not MLT (check field multiunit).
-
#persons ⇒ Integer
Maximum number of allowed adults.
-
#policy ⇒ Policy
Property policy.
-
#property_type ⇒ PropertyTypesEnum
Property type code (Enum value).
-
#rooms ⇒ Integer
Number of bedrooms.
-
#space ⇒ Float
Property size.
-
#space_unit ⇒ SpaceUnitEnum
SQ_FT Property size unit of measurement.
-
#supplier_id ⇒ Integer
Id of the Property Manager (not be used for creating new property. Property will have ID of current authorized user).
-
#supported_los_rates ⇒ Boolean
If true - means that the property supports only LOS rates.
-
#tax_number ⇒ String
Tax number for product.
-
#toilets ⇒ Integer
Number of toilets.
-
#total_beds ⇒ Integer
Property’s total number of beds.
-
#tourist_license_expiry_date ⇒ Date
Tourist license expiry date.
-
#tourist_license_number ⇒ String
Tourist license number.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, rooms = nil, bathrooms = nil, persons = nil, property_type = nil, currency = nil, supported_los_rates = nil, id = nil, alt_id = nil, supplier_id = nil, toilets = nil, total_beds = nil, space = nil, space_unit = nil, childs = nil, latitude = nil, longitude = nil, living_room = nil, notes = nil, attributes_with_quantity = nil, nearby_amenities = nil, bedroom_configuration = nil, check_in_time = nil, check_in_to_time = nil, check_out_time = nil, policy = nil, location = nil, tax_number = nil, tourist_license_number = nil, tourist_license_expiry_date = nil, multi_unit = nil, parent_id = nil) ⇒ Property
Returns a new instance of Property.
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 |
# File 'lib/asdawqw/models/property.rb', line 190 def initialize(name = nil, rooms = nil, bathrooms = nil, persons = nil, property_type = nil, currency = nil, supported_los_rates = nil, id = nil, alt_id = nil, supplier_id = nil, toilets = nil, total_beds = nil, space = nil, space_unit = nil, childs = nil, latitude = nil, longitude = nil, living_room = nil, notes = nil, attributes_with_quantity = nil, nearby_amenities = nil, bedroom_configuration = nil, check_in_time = nil, check_in_to_time = nil, check_out_time = nil, policy = nil, location = nil, tax_number = nil, tourist_license_number = nil, tourist_license_expiry_date = nil, multi_unit = nil, parent_id = nil) @name = name @id = id @alt_id = alt_id @supplier_id = supplier_id @rooms = rooms @bathrooms = bathrooms @toilets = toilets @total_beds = total_beds @space = space @space_unit = space_unit @persons = persons @childs = childs @latitude = latitude @longitude = longitude @living_room = living_room @notes = notes @attributes_with_quantity = attributes_with_quantity @nearby_amenities = nearby_amenities @property_type = property_type @bedroom_configuration = bedroom_configuration @check_in_time = check_in_time @check_in_to_time = check_in_to_time @check_out_time = check_out_time @currency = currency @policy = policy @location = location @supported_los_rates = supported_los_rates @tax_number = tax_number @tourist_license_number = tourist_license_number @tourist_license_expiry_date = tourist_license_expiry_date @multi_unit = multi_unit @parent_id = parent_id end |
Instance Attribute Details
#alt_id ⇒ Integer
Alternative Id of the property (ID in your PMS system). Note: this field you can not update, so this field will not be used during update.
20 21 22 |
# File 'lib/asdawqw/models/property.rb', line 20 def alt_id @alt_id end |
#attributes_with_quantity ⇒ List of AttributesWithQuantity
Use this param instead of previous if you need to set quantity more than 1 of attributes. If use both in POST request this will overwrite the previous list (under param attributes).
82 83 84 |
# File 'lib/asdawqw/models/property.rb', line 82 def attributes_with_quantity @attributes_with_quantity end |
#bathrooms ⇒ Integer
Number of bathrooms
34 35 36 |
# File 'lib/asdawqw/models/property.rb', line 34 def bathrooms @bathrooms end |
#bedroom_configuration ⇒ BedroomConfiguration
Bedroom configuration
94 95 96 |
# File 'lib/asdawqw/models/property.rb', line 94 def bedroom_configuration @bedroom_configuration end |
#check_in_time ⇒ String
Time of Check in (HH:MM:SS)
98 99 100 |
# File 'lib/asdawqw/models/property.rb', line 98 def check_in_time @check_in_time end |
#check_in_to_time ⇒ String
Time Check in to (HH:MM:SS)
102 103 104 |
# File 'lib/asdawqw/models/property.rb', line 102 def check_in_to_time @check_in_to_time end |
#check_out_time ⇒ String
Time of Check out (HH:MM:SS)
106 107 108 |
# File 'lib/asdawqw/models/property.rb', line 106 def check_out_time @check_out_time end |
#childs ⇒ Integer
Number of allowed children (from 7 to 12 years)
58 59 60 |
# File 'lib/asdawqw/models/property.rb', line 58 def childs @childs end |
#currency ⇒ String
Property currency. ISO 4217 code is required.
110 111 112 |
# File 'lib/asdawqw/models/property.rb', line 110 def currency @currency end |
#id ⇒ Integer
Property ID in BookingPal
15 16 17 |
# File 'lib/asdawqw/models/property.rb', line 15 def id @id end |
#latitude ⇒ Float
Latitude of the property (Must set field latitude and longitude or location)
63 64 65 |
# File 'lib/asdawqw/models/property.rb', line 63 def latitude @latitude end |
#living_room ⇒ Integer
Number of Living rooms
72 73 74 |
# File 'lib/asdawqw/models/property.rb', line 72 def living_room @living_room end |
#location ⇒ Location
Property location (Must set field latitude and longitude or location). Some location data will not be updated, since it is not expected that property change location. Similar is with coordinates and searching location from coordinates.
121 122 123 |
# File 'lib/asdawqw/models/property.rb', line 121 def location @location end |
#longitude ⇒ Float
Longitude of the property (Must set field latitude and longitude or location)
68 69 70 |
# File 'lib/asdawqw/models/property.rb', line 68 def longitude @longitude end |
#multi_unit ⇒ MultiUnitEnum
For regular properties (single units) you should not use this field. This field is to set if you want to create multiunit property or owner MLT,OWN. Also you can not update this field.
144 145 146 |
# File 'lib/asdawqw/models/property.rb', line 144 def multi_unit @multi_unit end |
#name ⇒ String
Name of the property to display in the list
11 12 13 |
# File 'lib/asdawqw/models/property.rb', line 11 def name @name end |
#nearby_amenities ⇒ List of NearbyAmenity
List of Nearby Attributes models. Check allowed values in Appendix.
86 87 88 |
# File 'lib/asdawqw/models/property.rb', line 86 def nearby_amenities @nearby_amenities end |
#notes ⇒ Notes
Property descriptions
76 77 78 |
# File 'lib/asdawqw/models/property.rb', line 76 def notes @notes end |
#parent_id ⇒ Integer
This fields should not be used unless your property is not MLT (check field multiunit). In this case you must set owner (parent) id property to which this property will belong. Also you can not update this property.
150 151 152 |
# File 'lib/asdawqw/models/property.rb', line 150 def parent_id @parent_id end |
#persons ⇒ Integer
Maximum number of allowed adults
54 55 56 |
# File 'lib/asdawqw/models/property.rb', line 54 def persons @persons end |
#policy ⇒ Policy
Property policy
114 115 116 |
# File 'lib/asdawqw/models/property.rb', line 114 def policy @policy end |
#property_type ⇒ PropertyTypesEnum
Property type code (Enum value)
90 91 92 |
# File 'lib/asdawqw/models/property.rb', line 90 def property_type @property_type end |
#rooms ⇒ Integer
Number of bedrooms. Number of bedrooms should be > 0. Value 0 is only allowed in case property type is Studio (PCT46 or PCT110)
30 31 32 |
# File 'lib/asdawqw/models/property.rb', line 30 def rooms @rooms end |
#space ⇒ Float
Property size
46 47 48 |
# File 'lib/asdawqw/models/property.rb', line 46 def space @space end |
#space_unit ⇒ SpaceUnitEnum
SQ_FT Property size unit of measurement
50 51 52 |
# File 'lib/asdawqw/models/property.rb', line 50 def space_unit @space_unit end |
#supplier_id ⇒ Integer
Id of the Property Manager (not be used for creating new property. Property will have ID of current authorized user)
25 26 27 |
# File 'lib/asdawqw/models/property.rb', line 25 def supplier_id @supplier_id end |
#supported_los_rates ⇒ Boolean
If true - means that the property supports only LOS rates. So daily rates can not be sent and updated. Default is false.
126 127 128 |
# File 'lib/asdawqw/models/property.rb', line 126 def supported_los_rates @supported_los_rates end |
#tax_number ⇒ String
Tax number for product
130 131 132 |
# File 'lib/asdawqw/models/property.rb', line 130 def tax_number @tax_number end |
#toilets ⇒ Integer
Number of toilets
38 39 40 |
# File 'lib/asdawqw/models/property.rb', line 38 def toilets @toilets end |
#total_beds ⇒ Integer
Property’s total number of beds
42 43 44 |
# File 'lib/asdawqw/models/property.rb', line 42 def total_beds @total_beds end |
#tourist_license_expiry_date ⇒ Date
Tourist license expiry date. Correct date format is YYYY-MM-DD.
138 139 140 |
# File 'lib/asdawqw/models/property.rb', line 138 def tourist_license_expiry_date @tourist_license_expiry_date end |
#tourist_license_number ⇒ String
Tourist license number
134 135 136 |
# File 'lib/asdawqw/models/property.rb', line 134 def tourist_license_number @tourist_license_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/asdawqw/models/property.rb', line 257 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash['name'] rooms = hash['rooms'] bathrooms = hash['bathrooms'] persons = hash['persons'] property_type = hash['propertyType'] currency = hash['currency'] supported_los_rates = hash['supportedLosRates'] id = hash['id'] alt_id = hash['altId'] supplier_id = hash['supplierId'] toilets = hash['toilets'] total_beds = hash['totalBeds'] space = hash['space'] space_unit = hash['spaceUnit'] childs = hash['childs'] latitude = hash['latitude'] longitude = hash['longitude'] living_room = hash['livingRoom'] notes = Notes.from_hash(hash['notes']) if hash['notes'] # Parameter is an array, so we need to iterate through it attributes_with_quantity = nil unless hash['attributesWithQuantity'].nil? attributes_with_quantity = [] hash['attributesWithQuantity'].each do |structure| attributes_with_quantity << (AttributesWithQuantity.from_hash(structure) if structure) end end # Parameter is an array, so we need to iterate through it nearby_amenities = nil unless hash['nearbyAmenities'].nil? nearby_amenities = [] hash['nearbyAmenities'].each do |structure| nearby_amenities << (NearbyAmenity.from_hash(structure) if structure) end end if hash['bedroomConfiguration'] bedroom_configuration = BedroomConfiguration.from_hash(hash['bedroomConfiguration']) end check_in_time = hash['checkInTime'] check_in_to_time = hash['checkInToTime'] check_out_time = hash['checkOutTime'] policy = Policy.from_hash(hash['policy']) if hash['policy'] location = Location.from_hash(hash['location']) if hash['location'] tax_number = hash['taxNumber'] tourist_license_number = hash['touristLicenseNumber'] tourist_license_expiry_date = hash['touristLicenseExpiryDate'] multi_unit = hash['multiUnit'] parent_id = hash['parentId'] # Create object from extracted values. Property.new(name, rooms, bathrooms, persons, property_type, currency, supported_los_rates, id, alt_id, supplier_id, toilets, total_beds, space, space_unit, childs, latitude, longitude, living_room, notes, attributes_with_quantity, nearby_amenities, bedroom_configuration, check_in_time, check_in_to_time, check_out_time, policy, location, tax_number, tourist_license_number, tourist_license_expiry_date, multi_unit, parent_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
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 181 182 183 184 185 186 187 188 |
# File 'lib/asdawqw/models/property.rb', line 153 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['id'] = 'id' @_hash['alt_id'] = 'altId' @_hash['supplier_id'] = 'supplierId' @_hash['rooms'] = 'rooms' @_hash['bathrooms'] = 'bathrooms' @_hash['toilets'] = 'toilets' @_hash['total_beds'] = 'totalBeds' @_hash['space'] = 'space' @_hash['space_unit'] = 'spaceUnit' @_hash['persons'] = 'persons' @_hash['childs'] = 'childs' @_hash['latitude'] = 'latitude' @_hash['longitude'] = 'longitude' @_hash['living_room'] = 'livingRoom' @_hash['notes'] = 'notes' @_hash['attributes_with_quantity'] = 'attributesWithQuantity' @_hash['nearby_amenities'] = 'nearbyAmenities' @_hash['property_type'] = 'propertyType' @_hash['bedroom_configuration'] = 'bedroomConfiguration' @_hash['check_in_time'] = 'checkInTime' @_hash['check_in_to_time'] = 'checkInToTime' @_hash['check_out_time'] = 'checkOutTime' @_hash['currency'] = 'currency' @_hash['policy'] = 'policy' @_hash['location'] = 'location' @_hash['supported_los_rates'] = 'supportedLosRates' @_hash['tax_number'] = 'taxNumber' @_hash['tourist_license_number'] = 'touristLicenseNumber' @_hash['tourist_license_expiry_date'] = 'touristLicenseExpiryDate' @_hash['multi_unit'] = 'multiUnit' @_hash['parent_id'] = 'parentId' @_hash end |