Class: Repull::Reservation
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Repull::Reservation
- Defined in:
- lib/repull/models/reservation.rb
Overview
A booking/reservation from a connected PMS. Identical shape between list-row (‘GET /v1/reservations`) and detail (`GET /v1/reservations/#id`) — SDK consumers can use the same type for both. The canonical (post-2026-05) shape uses nested `primaryGuest`, `occupancy`, `financials` blocks. The legacy flat fields (`guestId`, `totalPrice`, `currency`, `guestDetails`) remain populated for back-compat and are marked `deprecated` here. New consumers should read from the nested blocks; existing consumers continue to work unchanged.
Instance Attribute Summary collapse
-
#booked_at ⇒ Object
When the booking was made on the source channel (when reported by the channel).
-
#check_in ⇒ Object
Returns the value of attribute check_in.
-
#check_out ⇒ Object
Returns the value of attribute check_out.
-
#confirmation_code ⇒ Object
Channel-side confirmation code (Airbnb HMxxx, Booking.com numeric, etc.).
-
#created_at ⇒ Object
When the reservation row was created in Repull (not the booking-on-channel timestamp).
-
#currency ⇒ Object
DEPRECATED — use ‘financials.currency`.
-
#financials ⇒ Object
Normalized money block.
-
#guest_details ⇒ Object
DEPRECATED — use ‘occupancy` for normalized counts and `primaryGuest` for guest identity.
-
#guest_id ⇒ Object
DEPRECATED — use ‘primaryGuest.id`.
-
#guest_name ⇒ Object
Pre-resolved display name (‘firstName lastName`) from the joined guest row.
-
#id ⇒ Object
Internal Repull reservation ID.
-
#listing_id ⇒ Object
Internal Repull listing ID this reservation is on.
-
#occupancy ⇒ Object
Normalized guest counts.
-
#platform ⇒ Object
DEPRECATED alias for ‘source`.
-
#primary_guest ⇒ Object
Inline guest summary.
-
#source ⇒ Object
Booking source / channel.
-
#status ⇒ Object
Lifecycle status.
-
#total_price ⇒ Object
DEPRECATED — use ‘financials.totalPrice` (a number).
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.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.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Reservation
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Reservation
Initializes the object
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 166 167 168 169 170 171 172 173 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 |
# File 'lib/repull/models/reservation.rb', line 141 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::Reservation` 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::Reservation`. 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?(:'id') self.id = attributes[:'id'] else self.id = nil end if attributes.key?(:'listing_id') self.listing_id = attributes[:'listing_id'] else self.listing_id = nil end if attributes.key?(:'guest_id') self.guest_id = attributes[:'guest_id'] end if attributes.key?(:'check_in') self.check_in = attributes[:'check_in'] else self.check_in = nil end if attributes.key?(:'check_out') self.check_out = attributes[:'check_out'] else self.check_out = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'source') self.source = attributes[:'source'] end if attributes.key?(:'platform') self.platform = attributes[:'platform'] end if attributes.key?(:'confirmation_code') self.confirmation_code = attributes[:'confirmation_code'] else self.confirmation_code = nil end if attributes.key?(:'primary_guest') self.primary_guest = attributes[:'primary_guest'] end if attributes.key?(:'occupancy') self.occupancy = attributes[:'occupancy'] end if attributes.key?(:'financials') self.financials = attributes[:'financials'] end if attributes.key?(:'total_price') self.total_price = attributes[:'total_price'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'guest_details') if (value = attributes[:'guest_details']).is_a?(Hash) self.guest_details = value end end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] else self.created_at = nil end if attributes.key?(:'booked_at') self.booked_at = attributes[:'booked_at'] end if attributes.key?(:'guest_name') self.guest_name = attributes[:'guest_name'] end end |
Instance Attribute Details
#booked_at ⇒ Object
When the booking was made on the source channel (when reported by the channel).
66 67 68 |
# File 'lib/repull/models/reservation.rb', line 66 def booked_at @booked_at end |
#check_in ⇒ Object
Returns the value of attribute check_in.
28 29 30 |
# File 'lib/repull/models/reservation.rb', line 28 def check_in @check_in end |
#check_out ⇒ Object
Returns the value of attribute check_out.
30 31 32 |
# File 'lib/repull/models/reservation.rb', line 30 def check_out @check_out end |
#confirmation_code ⇒ Object
Channel-side confirmation code (Airbnb HMxxx, Booking.com numeric, etc.).
42 43 44 |
# File 'lib/repull/models/reservation.rb', line 42 def confirmation_code @confirmation_code end |
#created_at ⇒ Object
When the reservation row was created in Repull (not the booking-on-channel timestamp).
63 64 65 |
# File 'lib/repull/models/reservation.rb', line 63 def created_at @created_at end |
#currency ⇒ Object
DEPRECATED — use ‘financials.currency`. ISO 4217 currency code.
57 58 59 |
# File 'lib/repull/models/reservation.rb', line 57 def currency @currency end |
#financials ⇒ Object
Normalized money block. Always populated for paid reservations.
51 52 53 |
# File 'lib/repull/models/reservation.rb', line 51 def financials @financials end |
#guest_details ⇒ Object
DEPRECATED — use ‘occupancy` for normalized counts and `primaryGuest` for guest identity. Raw guest details from the source channel; shape varies by platform.
60 61 62 |
# File 'lib/repull/models/reservation.rb', line 60 def guest_details @guest_details end |
#guest_id ⇒ Object
DEPRECATED — use ‘primaryGuest.id`. Internal Repull guest ID. Kept populated for back-compat.
26 27 28 |
# File 'lib/repull/models/reservation.rb', line 26 def guest_id @guest_id end |
#guest_name ⇒ Object
Pre-resolved display name (‘firstName lastName`) from the joined guest row. Undefined when no first name is available.
69 70 71 |
# File 'lib/repull/models/reservation.rb', line 69 def guest_name @guest_name end |
#id ⇒ Object
Internal Repull reservation ID
20 21 22 |
# File 'lib/repull/models/reservation.rb', line 20 def id @id end |
#listing_id ⇒ Object
Internal Repull listing ID this reservation is on.
23 24 25 |
# File 'lib/repull/models/reservation.rb', line 23 def listing_id @listing_id end |
#occupancy ⇒ Object
Normalized guest counts. May be undefined when the source channel did not provide counts.
48 49 50 |
# File 'lib/repull/models/reservation.rb', line 48 def occupancy @occupancy end |
#platform ⇒ Object
DEPRECATED alias for ‘source`. Same value, kept for back-compat.
39 40 41 |
# File 'lib/repull/models/reservation.rb', line 39 def platform @platform end |
#primary_guest ⇒ Object
Inline guest summary. May be undefined for owner-blocks / pre-arrival rows.
45 46 47 |
# File 'lib/repull/models/reservation.rb', line 45 def primary_guest @primary_guest end |
#source ⇒ Object
Booking source / channel. Lowercase. May be null on legacy rows. Canonical name as of 2026-05; ‘platform` is kept as an alias.
36 37 38 |
# File 'lib/repull/models/reservation.rb', line 36 def source @source end |
#status ⇒ Object
Lifecycle status. The API normalises a multi-decade internal taxonomy down to these four buckets, so the value you receive is always one of the enum constants. ‘completed` is derived from `checkOut < today`.
33 34 35 |
# File 'lib/repull/models/reservation.rb', line 33 def status @status end |
#total_price ⇒ Object
DEPRECATED — use ‘financials.totalPrice` (a number). Decimal-as-string (precision 10, scale 2) kept for back-compat.
54 55 56 |
# File 'lib/repull/models/reservation.rb', line 54 def total_price @total_price end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
96 97 98 |
# File 'lib/repull/models/reservation.rb', line 96 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
101 102 103 |
# File 'lib/repull/models/reservation.rb', line 101 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/repull/models/reservation.rb', line 72 def self.attribute_map { :'id' => :'id', :'listing_id' => :'listingId', :'guest_id' => :'guestId', :'check_in' => :'checkIn', :'check_out' => :'checkOut', :'status' => :'status', :'source' => :'source', :'platform' => :'platform', :'confirmation_code' => :'confirmationCode', :'primary_guest' => :'primaryGuest', :'occupancy' => :'occupancy', :'financials' => :'financials', :'total_price' => :'totalPrice', :'currency' => :'currency', :'guest_details' => :'guestDetails', :'created_at' => :'createdAt', :'booked_at' => :'bookedAt', :'guest_name' => :'guestName' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
# File 'lib/repull/models/reservation.rb', line 404 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_nullable ⇒ Object
List of attributes with nullable: true
130 131 132 133 134 135 136 137 |
# File 'lib/repull/models/reservation.rb', line 130 def self.openapi_nullable Set.new([ :'source', :'platform', :'booked_at', :'guest_name' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/repull/models/reservation.rb', line 106 def self.openapi_types { :'id' => :'String', :'listing_id' => :'String', :'guest_id' => :'String', :'check_in' => :'Date', :'check_out' => :'Date', :'status' => :'String', :'source' => :'String', :'platform' => :'String', :'confirmation_code' => :'String', :'primary_guest' => :'ReservationPrimaryGuest', :'occupancy' => :'ReservationOccupancy', :'financials' => :'ReservationFinancials', :'total_price' => :'String', :'currency' => :'String', :'guest_details' => :'Hash<String, Object>', :'created_at' => :'Time', :'booked_at' => :'Time', :'guest_name' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/repull/models/reservation.rb', line 366 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && listing_id == o.listing_id && guest_id == o.guest_id && check_in == o.check_in && check_out == o.check_out && status == o.status && source == o.source && platform == o.platform && confirmation_code == o.confirmation_code && primary_guest == o.primary_guest && occupancy == o.occupancy && financials == o.financials && total_price == o.total_price && currency == o.currency && guest_details == o.guest_details && created_at == o.created_at && booked_at == o.booked_at && guest_name == o.guest_name end |
#eql?(o) ⇒ Boolean
391 392 393 |
# File 'lib/repull/models/reservation.rb', line 391 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
397 398 399 |
# File 'lib/repull/models/reservation.rb', line 397 def hash [id, listing_id, guest_id, check_in, check_out, status, source, platform, confirmation_code, primary_guest, occupancy, financials, total_price, currency, guest_details, created_at, booked_at, guest_name].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 |
# File 'lib/repull/models/reservation.rb', line 246 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @id.nil? invalid_properties.push('invalid value for "id", id cannot be nil.') end if @listing_id.nil? invalid_properties.push('invalid value for "listing_id", listing_id cannot be nil.') end if @check_in.nil? invalid_properties.push('invalid value for "check_in", check_in cannot be nil.') end if @check_out.nil? invalid_properties.push('invalid value for "check_out", check_out cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @confirmation_code.nil? invalid_properties.push('invalid value for "confirmation_code", confirmation_code cannot be nil.') end if @created_at.nil? invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
426 427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/repull/models/reservation.rb', line 426 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
282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/repull/models/reservation.rb', line 282 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? return false if @listing_id.nil? return false if @check_in.nil? return false if @check_out.nil? return false if @status.nil? return false if @confirmation_code.nil? return false if @created_at.nil? true end |