repull 0.2.15 → 0.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +147 -52
  3. data/lib/repull/api/billing_api.rb +4 -4
  4. data/lib/repull/api/booking_com_api.rb +36 -27
  5. data/lib/repull/api/conversations_api.rb +398 -4
  6. data/lib/repull/api/guests_api.rb +2 -2
  7. data/lib/repull/api/listings_api.rb +4 -4
  8. data/lib/repull/api/reservations_api.rb +157 -6
  9. data/lib/repull/api/webhooks_api.rb +10 -3
  10. data/lib/repull/models/accept_reservation_request200_response.rb +321 -0
  11. data/lib/repull/models/account_created_event.rb +95 -31
  12. data/lib/repull/models/account_disconnected_event.rb +95 -31
  13. data/lib/repull/models/ai_operation_completed_event.rb +95 -31
  14. data/lib/repull/models/ai_operation_failed_event.rb +95 -31
  15. data/lib/repull/models/airbnb_reservation_action200_response.rb +157 -0
  16. data/lib/repull/models/airbnb_reservation_action_request.rb +248 -0
  17. data/lib/repull/models/booking_availability_update.rb +4 -20
  18. data/lib/repull/models/booking_availability_update_date_range.rb +193 -0
  19. data/lib/repull/models/booking_availability_update_request.rb +14 -3
  20. data/lib/repull/models/booking_pricing_rate_update.rb +32 -4
  21. data/lib/repull/models/booking_pricing_rate_update_date_range.rb +3 -0
  22. data/lib/repull/models/booking_pricing_rate_update_restrictions.rb +10 -10
  23. data/lib/repull/models/booking_pricing_response.rb +16 -4
  24. data/lib/repull/models/booking_pricing_update_response.rb +82 -18
  25. data/lib/repull/models/booking_property.rb +107 -36
  26. data/lib/repull/models/booking_property_listings_inner.rb +244 -0
  27. data/lib/repull/models/booking_rate_write_occupancy.rb +187 -0
  28. data/lib/repull/models/booking_rate_write_price_half.rb +188 -0
  29. data/lib/repull/models/booking_rate_write_restriction_half.rb +212 -0
  30. data/lib/repull/models/booking_rate_write_verification.rb +200 -0
  31. data/lib/repull/models/booking_rate_write_verification_row.rb +196 -0
  32. data/lib/repull/models/booking_restriction_request_row.rb +199 -0
  33. data/lib/repull/models/booking_restriction_verification.rb +208 -0
  34. data/lib/repull/models/booking_restriction_verification_row.rb +203 -0
  35. data/lib/repull/models/booking_restriction_verification_row_booking_value.rb +105 -0
  36. data/lib/repull/models/booking_restriction_verification_row_expected.rb +105 -0
  37. data/lib/repull/models/booking_rooms_rates_response.rb +41 -7
  38. data/lib/repull/models/booking_rooms_rates_response_rooms_inner.rb +12 -1
  39. data/lib/repull/models/booking_rooms_rates_response_rooms_inner_rates_inner.rb +1 -0
  40. data/lib/repull/models/booking_upstream_failure.rb +204 -0
  41. data/lib/repull/models/calendar_updated_event.rb +95 -31
  42. data/lib/repull/models/conversation_message_attachment.rb +28 -1
  43. data/lib/repull/models/create_airbnb_offer_request.rb +93 -8
  44. data/lib/repull/models/create_airbnb_offer_request_guest_details.rb +279 -0
  45. data/lib/repull/models/create_conversation_special_offer201_response.rb +293 -0
  46. data/lib/repull/models/create_conversation_special_offer201_response_guests.rb +189 -0
  47. data/lib/repull/models/create_conversation_special_offer_request.rb +263 -0
  48. data/lib/repull/models/create_conversation_special_offer_request_guests.rb +263 -0
  49. data/lib/repull/models/decline_reservation_request_request.rb +234 -0
  50. data/lib/repull/models/get_airbnb_offer200_response.rb +289 -0
  51. data/lib/repull/models/get_usage_summary200_response.rb +10 -1
  52. data/lib/repull/models/get_usage_summary200_response_limits.rb +11 -1
  53. data/lib/repull/models/get_usage_summary200_response_remaining.rb +11 -1
  54. data/lib/repull/models/get_usage_summary200_response_used.rb +10 -1
  55. data/lib/repull/models/get_usage_tier200_response.rb +10 -1
  56. data/lib/repull/models/get_usage_tier200_response_limits.rb +11 -1
  57. data/lib/repull/models/get_usage_tier200_response_remaining.rb +11 -1
  58. data/lib/repull/models/get_usage_tier200_response_used.rb +10 -1
  59. data/lib/repull/models/inquiry_created_event.rb +281 -0
  60. data/lib/repull/models/inquiry_created_payload.rb +185 -0
  61. data/lib/repull/models/inquiry_updated_event.rb +281 -0
  62. data/lib/repull/models/inquiry_updated_payload.rb +213 -0
  63. data/lib/repull/models/inquiry_webhook_object.rb +323 -0
  64. data/lib/repull/models/inquiry_webhook_object_expected_payout.rb +158 -0
  65. data/lib/repull/models/inquiry_webhook_object_guests.rb +188 -0
  66. data/lib/repull/models/list_airbnb_thread_messages200_response.rb +170 -0
  67. data/lib/repull/models/list_airbnb_thread_messages200_response_data_inner.rb +274 -0
  68. data/lib/repull/models/list_airbnb_thread_messages200_response_pagination.rb +158 -0
  69. data/lib/repull/models/list_inquiries200_response.rb +192 -0
  70. data/lib/repull/models/list_inquiries200_response_data_inner.rb +418 -0
  71. data/lib/repull/models/list_inquiries200_response_data_inner_expected_payout.rb +159 -0
  72. data/lib/repull/models/list_inquiries200_response_data_inner_guests.rb +188 -0
  73. data/lib/repull/models/listing_created_event.rb +95 -31
  74. data/lib/repull/models/listing_deleted_event.rb +95 -31
  75. data/lib/repull/models/listing_deleted_payload.rb +55 -21
  76. data/lib/repull/models/listing_reactivated_event.rb +281 -0
  77. data/lib/repull/models/listing_suspended_event.rb +281 -0
  78. data/lib/repull/models/listing_suspension_payload.rb +202 -0
  79. data/lib/repull/models/listing_updated_event.rb +95 -31
  80. data/lib/repull/models/listing_updated_payload.rb +50 -22
  81. data/lib/repull/models/listing_webhook_object.rb +291 -0
  82. data/lib/repull/models/listing_webhook_object_address.rb +168 -0
  83. data/lib/repull/models/listing_webhook_object_channels_inner.rb +184 -0
  84. data/lib/repull/models/message.rb +1 -0
  85. data/lib/repull/models/payment_completed_event.rb +95 -31
  86. data/lib/repull/models/payment_completed_payload.rb +46 -44
  87. data/lib/repull/models/payment_refunded_event.rb +95 -31
  88. data/lib/repull/models/payment_refunded_payload.rb +46 -44
  89. data/lib/repull/models/payment_webhook_object.rb +351 -0
  90. data/lib/repull/models/preapprove_conversation201_response.rb +253 -0
  91. data/lib/repull/models/preapprove_conversation_request.rb +150 -0
  92. data/lib/repull/models/replay_webhook_delivery_request.rb +150 -0
  93. data/lib/repull/models/repull_ping_event.rb +95 -31
  94. data/lib/repull/models/reservation.rb +22 -2
  95. data/lib/repull/models/reservation_alteration_created_event.rb +95 -31
  96. data/lib/repull/models/reservation_alteration_responded_event.rb +95 -31
  97. data/lib/repull/models/reservation_cancelled_event.rb +95 -31
  98. data/lib/repull/models/reservation_created_event.rb +95 -32
  99. data/lib/repull/models/reservation_message_received_event.rb +95 -31
  100. data/lib/repull/models/reservation_message_received_payload.rb +17 -4
  101. data/lib/repull/models/reservation_request_created_event.rb +281 -0
  102. data/lib/repull/models/reservation_request_created_payload.rb +224 -0
  103. data/lib/repull/models/reservation_request_updated_event.rb +281 -0
  104. data/lib/repull/models/reservation_request_updated_payload.rb +251 -0
  105. data/lib/repull/models/reservation_updated_event.rb +95 -31
  106. data/lib/repull/models/review_created_event.rb +95 -31
  107. data/lib/repull/models/review_responded_event.rb +95 -31
  108. data/lib/repull/models/send_airbnb_message201_response.rb +104 -0
  109. data/lib/repull/models/send_airbnb_message_request.rb +4 -20
  110. data/lib/repull/models/send_message_attachment.rb +225 -0
  111. data/lib/repull/models/send_message_part.rb +201 -0
  112. data/lib/repull/models/send_message_request.rb +44 -19
  113. data/lib/repull/models/send_message_response.rb +29 -5
  114. data/lib/repull/models/sent_attachment.rb +196 -0
  115. data/lib/repull/models/usage_quota_warning_event.rb +281 -0
  116. data/lib/repull/models/usage_quota_warning_payload.rb +224 -0
  117. data/lib/repull/models/usage_quota_warning_payload_top_operation.rb +167 -0
  118. data/lib/repull/models/webhook_event.rb +17 -3
  119. data/lib/repull/models/webhook_event_account.rb +171 -0
  120. data/lib/repull/models/webhook_event_type.rb +8 -1
  121. data/lib/repull/models/withdraw_conversation_special_offer200_response.rb +240 -0
  122. data/lib/repull/version.rb +1 -1
  123. data/lib/repull.rb +60 -0
  124. data/openapi/v1.json +19295 -13620
  125. data/scripts/regen.sh +1 -1
  126. metadata +62 -2
@@ -15,15 +15,29 @@ require 'time'
15
15
 
16
16
  module Repull
17
17
  class CreateAirbnbOfferRequest < ApiModelBase
18
- # Which kind of offer to create.
18
+ # What to create.
19
19
  attr_accessor :type
20
20
 
21
- # Airbnb thread id. Required when `type` is `preapproval`.
21
+ # Airbnb message-thread id the offer answers. (`threadId` is accepted too.)
22
22
  attr_accessor :thread_id
23
23
 
24
- # For `preapproval` whether to block instant booking.
24
+ # Pre-approval only: require the guest to book through the pre-approval rather than Instant Book. (`blockInstantBooking` is accepted too.)
25
25
  attr_accessor :block_instant_booking
26
26
 
27
+ # Offer only (required): the AIRBNB listing id, as a string.
28
+ attr_accessor :listing_id
29
+
30
+ # Offer only (required): first night.
31
+ attr_accessor :start_date
32
+
33
+ # Offer only (required).
34
+ attr_accessor :nights
35
+
36
+ # Offer only (required): total for the stay, in the listing’s Airbnb currency.
37
+ attr_accessor :total_price
38
+
39
+ attr_accessor :guest_details
40
+
27
41
  class EnumAttributeValidator
28
42
  attr_reader :datatype
29
43
  attr_reader :allowable_values
@@ -50,8 +64,13 @@ module Repull
50
64
  def self.attribute_map
51
65
  {
52
66
  :'type' => :'type',
53
- :'thread_id' => :'threadId',
54
- :'block_instant_booking' => :'blockInstantBooking'
67
+ :'thread_id' => :'thread_id',
68
+ :'block_instant_booking' => :'block_instant_booking',
69
+ :'listing_id' => :'listing_id',
70
+ :'start_date' => :'start_date',
71
+ :'nights' => :'nights',
72
+ :'total_price' => :'total_price',
73
+ :'guest_details' => :'guest_details'
55
74
  }
56
75
  end
57
76
 
@@ -70,7 +89,12 @@ module Repull
70
89
  {
71
90
  :'type' => :'String',
72
91
  :'thread_id' => :'String',
73
- :'block_instant_booking' => :'Boolean'
92
+ :'block_instant_booking' => :'Boolean',
93
+ :'listing_id' => :'String',
94
+ :'start_date' => :'Date',
95
+ :'nights' => :'Integer',
96
+ :'total_price' => :'Float',
97
+ :'guest_details' => :'CreateAirbnbOfferRequestGuestDetails'
74
98
  }
75
99
  end
76
100
 
@@ -104,6 +128,8 @@ module Repull
104
128
 
105
129
  if attributes.key?(:'thread_id')
106
130
  self.thread_id = attributes[:'thread_id']
131
+ else
132
+ self.thread_id = nil
107
133
  end
108
134
 
109
135
  if attributes.key?(:'block_instant_booking')
@@ -111,6 +137,26 @@ module Repull
111
137
  else
112
138
  self.block_instant_booking = false
113
139
  end
140
+
141
+ if attributes.key?(:'listing_id')
142
+ self.listing_id = attributes[:'listing_id']
143
+ end
144
+
145
+ if attributes.key?(:'start_date')
146
+ self.start_date = attributes[:'start_date']
147
+ end
148
+
149
+ if attributes.key?(:'nights')
150
+ self.nights = attributes[:'nights']
151
+ end
152
+
153
+ if attributes.key?(:'total_price')
154
+ self.total_price = attributes[:'total_price']
155
+ end
156
+
157
+ if attributes.key?(:'guest_details')
158
+ self.guest_details = attributes[:'guest_details']
159
+ end
114
160
  end
115
161
 
116
162
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -122,6 +168,14 @@ module Repull
122
168
  invalid_properties.push('invalid value for "type", type cannot be nil.')
123
169
  end
124
170
 
171
+ if @thread_id.nil?
172
+ invalid_properties.push('invalid value for "thread_id", thread_id cannot be nil.')
173
+ end
174
+
175
+ if !@nights.nil? && @nights < 1
176
+ invalid_properties.push('invalid value for "nights", must be greater than or equal to 1.')
177
+ end
178
+
125
179
  invalid_properties
126
180
  end
127
181
 
@@ -132,6 +186,8 @@ module Repull
132
186
  return false if @type.nil?
133
187
  type_validator = EnumAttributeValidator.new('String', ["offer", "preapproval"])
134
188
  return false unless type_validator.valid?(@type)
189
+ return false if @thread_id.nil?
190
+ return false if !@nights.nil? && @nights < 1
135
191
  true
136
192
  end
137
193
 
@@ -145,6 +201,30 @@ module Repull
145
201
  @type = type
146
202
  end
147
203
 
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] thread_id Value to be assigned
206
+ def thread_id=(thread_id)
207
+ if thread_id.nil?
208
+ fail ArgumentError, 'thread_id cannot be nil'
209
+ end
210
+
211
+ @thread_id = thread_id
212
+ end
213
+
214
+ # Custom attribute writer method with validation
215
+ # @param [Object] nights Value to be assigned
216
+ def nights=(nights)
217
+ if nights.nil?
218
+ fail ArgumentError, 'nights cannot be nil'
219
+ end
220
+
221
+ if nights < 1
222
+ fail ArgumentError, 'invalid value for "nights", must be greater than or equal to 1.'
223
+ end
224
+
225
+ @nights = nights
226
+ end
227
+
148
228
  # Checks equality by comparing each attribute.
149
229
  # @param [Object] Object to be compared
150
230
  def ==(o)
@@ -152,7 +232,12 @@ module Repull
152
232
  self.class == o.class &&
153
233
  type == o.type &&
154
234
  thread_id == o.thread_id &&
155
- block_instant_booking == o.block_instant_booking
235
+ block_instant_booking == o.block_instant_booking &&
236
+ listing_id == o.listing_id &&
237
+ start_date == o.start_date &&
238
+ nights == o.nights &&
239
+ total_price == o.total_price &&
240
+ guest_details == o.guest_details
156
241
  end
157
242
 
158
243
  # @see the `==` method
@@ -164,7 +249,7 @@ module Repull
164
249
  # Calculates hash code according to all attributes.
165
250
  # @return [Integer] Hash code
166
251
  def hash
167
- [type, thread_id, block_instant_booking].hash
252
+ [type, thread_id, block_instant_booking, listing_id, start_date, nights, total_price, guest_details].hash
168
253
  end
169
254
 
170
255
  # Builds the object from hash
@@ -0,0 +1,279 @@
1
+ =begin
2
+ #Repull API
3
+
4
+ #The unified API for vacation rental tech. Connect to 50+ PMS platforms and 4 OTA channels through one REST API. Built-in AI operations for guest communication, pricing, and listing optimization. ## Designed for AI agents Every error response on this API includes machine-parseable fields so an LLM (Claude in MCP, Cursor, Cline, GPT, etc.) can self-recover without escalating to a human: - `error.code` — stable string identifier (e.g. `invalid_params`, `rate_limit_exceeded`) - `error.message` — human-readable cause - `error.fix` — exact recovery steps (e.g. \"Pass `check_in_after` as ISO 8601: `?check_in_after=2026-01-15`\") - `error.docs_url` — link to the canonical write-up at `https://repull.dev/docs/errors/{code}` - `error.request_id` — id to correlate with server-side logs - `error.field` / `error.value_received` / `error.valid_values` / `error.did_you_mean` — when the error is parameter-specific - `error.retry_after` — seconds to wait before retrying (rate-limit + transient upstream) `Access-Control-Expose-Headers` lists `x-request-id` and the `X-RateLimit-*` family so browsers can read them on cross-origin responses. ## Quick Start 1. Get an API key at https://repull.dev/dashboard 2. Connect a PMS: `POST /v1/connect/{provider}` 3. List properties: `GET /v1/properties` 4. Get reservations: `GET /v1/reservations` ## Authentication All requests require a Bearer token: ``` Authorization: Bearer sk_live_YOUR_API_KEY ``` ## Request Correlation (X-Request-ID) Every response carries an `X-Request-ID` header, e.g. `X-Request-ID: req_01HXY...`. Include this id in support tickets and bug reports — we can trace the full request lifecycle (auth, rate limit, handler, downstream calls, log row) from a single id. You may set the header on the inbound request to forward your own trace id; we will echo it back instead of generating a new one. Accepted format: `^[\\\\w.-]{1,128}$`. The id is also embedded in error envelopes as `request_id` so server-side log diffs work even when the response headers are stripped by an intermediate proxy. ## Rate Limits The public API enforces a per-API-key sliding-window rate limit on top of the per-tier monthly + daily-AI quotas. **Default policy:** 600 requests per 60 seconds, per API key. Sliding window — there is no fixed-minute boundary you can burst across. Every response includes: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests permitted in the current window. | | `X-RateLimit-Remaining` | Requests left in the current window after this call. | | `X-RateLimit-Reset` | Unix epoch (seconds) when the next slot opens. | | `X-RateLimit-Policy` | Machine-readable policy descriptor, e.g. `600;w=60`. | | `Retry-After` | Seconds to wait before retrying. **Only present on 429 responses.** | **On 429 (rate_limit_exceeded):** the response body matches the standard error envelope with `code: \"rate_limit_exceeded\"`, plus `limit`, `window_seconds`, `retry_after`, and `request_id` fields. SDKs MUST honor `Retry-After` and use exponential backoff with jitter on subsequent retries — never a tight loop. Recommended backoff: ``` sleep_ms = (Retry-After * 1000) + random(0..250) ``` Monthly + daily-AI tier quotas (`free`, `starter`, `custom`) are enforced separately and also surface as 429s; they include `tier`, `scope`, and `resetsAt` fields. ## Plan Limits (402 — `listings_limit_exceeded`) The Repull API also enforces a per-tier cap on **active listings**: | Tier | Active listings cap | |---|---| | `free` | 3 | | `starter` | 50 | | `custom` | unlimited | When a customer's active-listing count is above their tier cap, the API returns **`402 Payment Required`** with `error.code = \"listings_limit_exceeded\"` on every route EXCEPT: - `/v1/health` — uptime probes are never gated. - `/v1/usage/*` — so dashboards can render the over-cap state. - Any `DELETE` — so the customer can trim listings to get back under the cap without paying. Unlike 429, 402 is NOT a \"wait and retry\" condition — `Retry-After` is not set. The only paths back to 200 are: 1. `DELETE` enough listings to come back under the cap, or 2. Upgrade at `https://repull.dev/dashboard/billing`. The server-side usage cache is 60s, so the first 200 after an upgrade may take up to a minute. The envelope mirrors `rate_limit_exceeded` for SDK ergonomics: `tier`, `limit`, `active_listings`, `upgrade_url`, plus the standard `code` / `message` / `fix` / `docs_url` / `request_id`.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: ivan@vanio.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Repull
17
+ # Offer only (required). `number_of_guests` is adults + children; if omitted it is computed from them.
18
+ class CreateAirbnbOfferRequestGuestDetails < ApiModelBase
19
+ attr_accessor :number_of_guests
20
+
21
+ attr_accessor :number_of_adults
22
+
23
+ attr_accessor :number_of_children
24
+
25
+ attr_accessor :number_of_infants
26
+
27
+ attr_accessor :number_of_pets
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'number_of_guests' => :'number_of_guests',
33
+ :'number_of_adults' => :'number_of_adults',
34
+ :'number_of_children' => :'number_of_children',
35
+ :'number_of_infants' => :'number_of_infants',
36
+ :'number_of_pets' => :'number_of_pets'
37
+ }
38
+ end
39
+
40
+ # Returns attribute mapping this model knows about
41
+ def self.acceptable_attribute_map
42
+ attribute_map
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ acceptable_attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'number_of_guests' => :'Integer',
54
+ :'number_of_adults' => :'Integer',
55
+ :'number_of_children' => :'Integer',
56
+ :'number_of_infants' => :'Integer',
57
+ :'number_of_pets' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::CreateAirbnbOfferRequestGuestDetails` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!acceptable_attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::CreateAirbnbOfferRequestGuestDetails`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'number_of_guests')
84
+ self.number_of_guests = attributes[:'number_of_guests']
85
+ end
86
+
87
+ if attributes.key?(:'number_of_adults')
88
+ self.number_of_adults = attributes[:'number_of_adults']
89
+ end
90
+
91
+ if attributes.key?(:'number_of_children')
92
+ self.number_of_children = attributes[:'number_of_children']
93
+ end
94
+
95
+ if attributes.key?(:'number_of_infants')
96
+ self.number_of_infants = attributes[:'number_of_infants']
97
+ end
98
+
99
+ if attributes.key?(:'number_of_pets')
100
+ self.number_of_pets = attributes[:'number_of_pets']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
108
+ invalid_properties = Array.new
109
+ if !@number_of_guests.nil? && @number_of_guests < 1
110
+ invalid_properties.push('invalid value for "number_of_guests", must be greater than or equal to 1.')
111
+ end
112
+
113
+ if !@number_of_adults.nil? && @number_of_adults < 0
114
+ invalid_properties.push('invalid value for "number_of_adults", must be greater than or equal to 0.')
115
+ end
116
+
117
+ if !@number_of_children.nil? && @number_of_children < 0
118
+ invalid_properties.push('invalid value for "number_of_children", must be greater than or equal to 0.')
119
+ end
120
+
121
+ if !@number_of_infants.nil? && @number_of_infants < 0
122
+ invalid_properties.push('invalid value for "number_of_infants", must be greater than or equal to 0.')
123
+ end
124
+
125
+ if !@number_of_pets.nil? && @number_of_pets < 0
126
+ invalid_properties.push('invalid value for "number_of_pets", must be greater than or equal to 0.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if !@number_of_guests.nil? && @number_of_guests < 1
137
+ return false if !@number_of_adults.nil? && @number_of_adults < 0
138
+ return false if !@number_of_children.nil? && @number_of_children < 0
139
+ return false if !@number_of_infants.nil? && @number_of_infants < 0
140
+ return false if !@number_of_pets.nil? && @number_of_pets < 0
141
+ true
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] number_of_guests Value to be assigned
146
+ def number_of_guests=(number_of_guests)
147
+ if number_of_guests.nil?
148
+ fail ArgumentError, 'number_of_guests cannot be nil'
149
+ end
150
+
151
+ if number_of_guests < 1
152
+ fail ArgumentError, 'invalid value for "number_of_guests", must be greater than or equal to 1.'
153
+ end
154
+
155
+ @number_of_guests = number_of_guests
156
+ end
157
+
158
+ # Custom attribute writer method with validation
159
+ # @param [Object] number_of_adults Value to be assigned
160
+ def number_of_adults=(number_of_adults)
161
+ if number_of_adults.nil?
162
+ fail ArgumentError, 'number_of_adults cannot be nil'
163
+ end
164
+
165
+ if number_of_adults < 0
166
+ fail ArgumentError, 'invalid value for "number_of_adults", must be greater than or equal to 0.'
167
+ end
168
+
169
+ @number_of_adults = number_of_adults
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] number_of_children Value to be assigned
174
+ def number_of_children=(number_of_children)
175
+ if number_of_children.nil?
176
+ fail ArgumentError, 'number_of_children cannot be nil'
177
+ end
178
+
179
+ if number_of_children < 0
180
+ fail ArgumentError, 'invalid value for "number_of_children", must be greater than or equal to 0.'
181
+ end
182
+
183
+ @number_of_children = number_of_children
184
+ end
185
+
186
+ # Custom attribute writer method with validation
187
+ # @param [Object] number_of_infants Value to be assigned
188
+ def number_of_infants=(number_of_infants)
189
+ if number_of_infants.nil?
190
+ fail ArgumentError, 'number_of_infants cannot be nil'
191
+ end
192
+
193
+ if number_of_infants < 0
194
+ fail ArgumentError, 'invalid value for "number_of_infants", must be greater than or equal to 0.'
195
+ end
196
+
197
+ @number_of_infants = number_of_infants
198
+ end
199
+
200
+ # Custom attribute writer method with validation
201
+ # @param [Object] number_of_pets Value to be assigned
202
+ def number_of_pets=(number_of_pets)
203
+ if number_of_pets.nil?
204
+ fail ArgumentError, 'number_of_pets cannot be nil'
205
+ end
206
+
207
+ if number_of_pets < 0
208
+ fail ArgumentError, 'invalid value for "number_of_pets", must be greater than or equal to 0.'
209
+ end
210
+
211
+ @number_of_pets = number_of_pets
212
+ end
213
+
214
+ # Checks equality by comparing each attribute.
215
+ # @param [Object] Object to be compared
216
+ def ==(o)
217
+ return true if self.equal?(o)
218
+ self.class == o.class &&
219
+ number_of_guests == o.number_of_guests &&
220
+ number_of_adults == o.number_of_adults &&
221
+ number_of_children == o.number_of_children &&
222
+ number_of_infants == o.number_of_infants &&
223
+ number_of_pets == o.number_of_pets
224
+ end
225
+
226
+ # @see the `==` method
227
+ # @param [Object] Object to be compared
228
+ def eql?(o)
229
+ self == o
230
+ end
231
+
232
+ # Calculates hash code according to all attributes.
233
+ # @return [Integer] Hash code
234
+ def hash
235
+ [number_of_guests, number_of_adults, number_of_children, number_of_infants, number_of_pets].hash
236
+ end
237
+
238
+ # Builds the object from hash
239
+ # @param [Hash] attributes Model attributes in the form of hash
240
+ # @return [Object] Returns the model itself
241
+ def self.build_from_hash(attributes)
242
+ return nil unless attributes.is_a?(Hash)
243
+ attributes = attributes.transform_keys(&:to_sym)
244
+ transformed_hash = {}
245
+ openapi_types.each_pair do |key, type|
246
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
247
+ transformed_hash["#{key}"] = nil
248
+ elsif type =~ /\AArray<(.*)>/i
249
+ # check to ensure the input is an array given that the attribute
250
+ # is documented as an array but the input is not
251
+ if attributes[attribute_map[key]].is_a?(Array)
252
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
253
+ end
254
+ elsif !attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
256
+ end
257
+ end
258
+ new(transformed_hash)
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ if value.nil?
268
+ is_nullable = self.class.openapi_nullable.include?(attr)
269
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
+ end
271
+
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ end
278
+
279
+ end