Class: Repull::ListingDetails

Inherits:
ApiModelBase show all
Defined in:
lib/repull/models/listing_details.rb

Overview

Structural detail slab for a listing — bedrooms/bathrooms/beds, person capacity, check-in window, wifi credentials, house manual, directions. Sourced from ‘listings_details` (one row per listing). Surfaced on `GET /v1/listings/id` and `GET /v1/listings` only when the caller passes `?include=details`. All fields are individually nullable.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ListingDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
275
# File 'lib/repull/models/listing_details.rb', line 174

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#advance_booking_daysObject

How far in advance bookings are allowed.



52
53
54
# File 'lib/repull/models/listing_details.rb', line 52

def advance_booking_days
  @advance_booking_days
end

#bathroomsObject

Numeric value carried as a string to preserve fractional bathrooms (e.g. ‘"1.5"`).



31
32
33
# File 'lib/repull/models/listing_details.rb', line 31

def bathrooms
  @bathrooms
end

#bedroomsObject

Returns the value of attribute bedrooms.



28
29
30
# File 'lib/repull/models/listing_details.rb', line 28

def bedrooms
  @bedrooms
end

#bedsObject

Returns the value of attribute beds.



33
34
35
# File 'lib/repull/models/listing_details.rb', line 33

def beds
  @beds
end

#check_in_time_endObject

Latest check-in time.



42
43
44
# File 'lib/repull/models/listing_details.rb', line 42

def check_in_time_end
  @check_in_time_end
end

#check_in_time_startObject

Earliest check-in time, free-form (e.g. ‘"15:00"`, `"3 PM"`, `"flexible"`).



39
40
41
# File 'lib/repull/models/listing_details.rb', line 39

def check_in_time_start
  @check_in_time_start
end

#check_out_timeObject

Check-out time.



45
46
47
# File 'lib/repull/models/listing_details.rb', line 45

def check_out_time
  @check_out_time
end

#directionsObject

Long-form arrival directions.



65
66
67
# File 'lib/repull/models/listing_details.rb', line 65

def directions
  @directions
end

#house_manualObject

Long-form house manual / welcome guide.



62
63
64
# File 'lib/repull/models/listing_details.rb', line 62

def house_manual
  @house_manual
end

#listing_floorObject

Which floor the listing is on.



76
77
78
# File 'lib/repull/models/listing_details.rb', line 76

def listing_floor
  @listing_floor
end

#max_nightsObject

Returns the value of attribute max_nights.



49
50
51
# File 'lib/repull/models/listing_details.rb', line 49

def max_nights
  @max_nights
end

#min_nightsObject

Returns the value of attribute min_nights.



47
48
49
# File 'lib/repull/models/listing_details.rb', line 47

def min_nights
  @min_nights
end

#number_of_floorsObject

Total floors in the building.



73
74
75
# File 'lib/repull/models/listing_details.rb', line 73

def number_of_floors
  @number_of_floors
end

#person_capacityObject

Maximum guest capacity.



36
37
38
# File 'lib/repull/models/listing_details.rb', line 36

def person_capacity
  @person_capacity
end

#property_sizeObject

Structured size info (JSON; e.g. ‘{ "value": 65, "unit": "sqm" }`). Shape evolves with the listings_details schema.



68
69
70
# File 'lib/repull/models/listing_details.rb', line 68

def property_size
  @property_size
end

#property_typeObject

Specific property type (e.g. ‘apartment`, `townhouse`, `cabin`).



20
21
22
# File 'lib/repull/models/listing_details.rb', line 20

def property_type
  @property_type
end

#property_type_categoryObject

Coarser grouping above propertyType (e.g. ‘house`, `apartment`).



23
24
25
# File 'lib/repull/models/listing_details.rb', line 23

def property_type_category
  @property_type_category
end

#room_type_categoryObject

Sleeping arrangement (e.g. ‘entire_home`, `private_room`, `shared_room`).



26
27
28
# File 'lib/repull/models/listing_details.rb', line 26

def room_type_category
  @room_type_category
end

#turnover_daysObject

Required gap (in days) between consecutive bookings.



55
56
57
# File 'lib/repull/models/listing_details.rb', line 55

def turnover_days
  @turnover_days
end

#wifi_networkObject

Returns the value of attribute wifi_network.



57
58
59
# File 'lib/repull/models/listing_details.rb', line 57

def wifi_network
  @wifi_network
end

#wifi_passwordObject

Returns the value of attribute wifi_password.



59
60
61
# File 'lib/repull/models/listing_details.rb', line 59

def wifi_password
  @wifi_password
end

#year_builtObject

Returns the value of attribute year_built.



70
71
72
# File 'lib/repull/models/listing_details.rb', line 70

def year_built
  @year_built
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



107
108
109
# File 'lib/repull/models/listing_details.rb', line 107

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



112
113
114
# File 'lib/repull/models/listing_details.rb', line 112

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/repull/models/listing_details.rb', line 79

def self.attribute_map
  {
    :'property_type' => :'propertyType',
    :'property_type_category' => :'propertyTypeCategory',
    :'room_type_category' => :'roomTypeCategory',
    :'bedrooms' => :'bedrooms',
    :'bathrooms' => :'bathrooms',
    :'beds' => :'beds',
    :'person_capacity' => :'personCapacity',
    :'check_in_time_start' => :'checkInTimeStart',
    :'check_in_time_end' => :'checkInTimeEnd',
    :'check_out_time' => :'checkOutTime',
    :'min_nights' => :'minNights',
    :'max_nights' => :'maxNights',
    :'advance_booking_days' => :'advanceBookingDays',
    :'turnover_days' => :'turnoverDays',
    :'wifi_network' => :'wifiNetwork',
    :'wifi_password' => :'wifiPassword',
    :'house_manual' => :'houseManual',
    :'directions' => :'directions',
    :'property_size' => :'propertySize',
    :'year_built' => :'yearBuilt',
    :'number_of_floors' => :'numberOfFloors',
    :'listing_floor' => :'listingFloor'
  }
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



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/repull/models/listing_details.rb', line 336

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{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[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



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
# File 'lib/repull/models/listing_details.rb', line 145

def self.openapi_nullable
  Set.new([
    :'property_type',
    :'property_type_category',
    :'room_type_category',
    :'bedrooms',
    :'bathrooms',
    :'beds',
    :'person_capacity',
    :'check_in_time_start',
    :'check_in_time_end',
    :'check_out_time',
    :'min_nights',
    :'max_nights',
    :'advance_booking_days',
    :'turnover_days',
    :'wifi_network',
    :'wifi_password',
    :'house_manual',
    :'directions',
    :'property_size',
    :'year_built',
    :'number_of_floors',
    :'listing_floor'
  ])
end

.openapi_typesObject

Attribute type mapping.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/repull/models/listing_details.rb', line 117

def self.openapi_types
  {
    :'property_type' => :'String',
    :'property_type_category' => :'String',
    :'room_type_category' => :'String',
    :'bedrooms' => :'Integer',
    :'bathrooms' => :'String',
    :'beds' => :'Integer',
    :'person_capacity' => :'Integer',
    :'check_in_time_start' => :'String',
    :'check_in_time_end' => :'String',
    :'check_out_time' => :'String',
    :'min_nights' => :'Integer',
    :'max_nights' => :'Integer',
    :'advance_booking_days' => :'Integer',
    :'turnover_days' => :'Integer',
    :'wifi_network' => :'String',
    :'wifi_password' => :'String',
    :'house_manual' => :'String',
    :'directions' => :'String',
    :'property_size' => :'Object',
    :'year_built' => :'Integer',
    :'number_of_floors' => :'Integer',
    :'listing_floor' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/repull/models/listing_details.rb', line 294

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      property_type == o.property_type &&
      property_type_category == o.property_type_category &&
      room_type_category == o.room_type_category &&
      bedrooms == o.bedrooms &&
      bathrooms == o.bathrooms &&
      beds == o.beds &&
      person_capacity == o.person_capacity &&
      check_in_time_start == o.check_in_time_start &&
      check_in_time_end == o.check_in_time_end &&
      check_out_time == o.check_out_time &&
      min_nights == o.min_nights &&
      max_nights == o.max_nights &&
      advance_booking_days == o.advance_booking_days &&
      turnover_days == o.turnover_days &&
      wifi_network == o.wifi_network &&
      wifi_password == o.wifi_password &&
      house_manual == o.house_manual &&
      directions == o.directions &&
      property_size == o.property_size &&
      year_built == o.year_built &&
      number_of_floors == o.number_of_floors &&
      listing_floor == o.listing_floor
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


323
324
325
# File 'lib/repull/models/listing_details.rb', line 323

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



329
330
331
# File 'lib/repull/models/listing_details.rb', line 329

def hash
  [property_type, property_type_category, room_type_category, bedrooms, bathrooms, beds, person_capacity, check_in_time_start, check_in_time_end, check_out_time, min_nights, max_nights, advance_booking_days, turnover_days, wifi_network, wifi_password, house_manual, directions, property_size, year_built, number_of_floors, listing_floor].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



279
280
281
282
283
# File 'lib/repull/models/listing_details.rb', line 279

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/repull/models/listing_details.rb', line 358

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



287
288
289
290
# File 'lib/repull/models/listing_details.rb', line 287

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end