repull 0.2.18 → 0.2.19

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.
@@ -0,0 +1,201 @@
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
+ # Body for `POST /v1/channels/booking/listings/map`.
18
+ class MapBookingRoomRequest < ApiModelBase
19
+ # Booking.com's own room id. Discover it via `GET /v1/channels/booking/properties/{id}/rooms` (`rooms[].roomId`). A number is also accepted.
20
+ attr_accessor :room_booking_id
21
+
22
+ # Canonical Repull listing id to link the room to. Must belong to your workspace and be active. `null` unmaps the room and removes its channel link. The field is required — omitting it is a 422, not an unmap.
23
+ attr_accessor :listing_id
24
+
25
+ # Optional. When present, must be the Booking.com property the room belongs to — guards against mapping a room of the wrong property when looping over several.
26
+ attr_accessor :hotel_id
27
+
28
+ # Whether the resulting channel link has sync enabled.
29
+ attr_accessor :sync_enabled
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'room_booking_id' => :'roomBookingId',
35
+ :'listing_id' => :'listingId',
36
+ :'hotel_id' => :'hotelId',
37
+ :'sync_enabled' => :'syncEnabled'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'room_booking_id' => :'String',
55
+ :'listing_id' => :'Integer',
56
+ :'hotel_id' => :'String',
57
+ :'sync_enabled' => :'Boolean'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ :'listing_id',
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::MapBookingRoomRequest` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ acceptable_attribute_map = self.class.acceptable_attribute_map
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!acceptable_attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::MapBookingRoomRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'room_booking_id')
85
+ self.room_booking_id = attributes[:'room_booking_id']
86
+ else
87
+ self.room_booking_id = nil
88
+ end
89
+
90
+ if attributes.key?(:'listing_id')
91
+ self.listing_id = attributes[:'listing_id']
92
+ else
93
+ self.listing_id = nil
94
+ end
95
+
96
+ if attributes.key?(:'hotel_id')
97
+ self.hotel_id = attributes[:'hotel_id']
98
+ end
99
+
100
+ if attributes.key?(:'sync_enabled')
101
+ self.sync_enabled = attributes[:'sync_enabled']
102
+ else
103
+ self.sync_enabled = true
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @room_booking_id.nil?
113
+ invalid_properties.push('invalid value for "room_booking_id", room_booking_id cannot be nil.')
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ warn '[DEPRECATED] the `valid?` method is obsolete'
123
+ return false if @room_booking_id.nil?
124
+ true
125
+ end
126
+
127
+ # Custom attribute writer method with validation
128
+ # @param [Object] room_booking_id Value to be assigned
129
+ def room_booking_id=(room_booking_id)
130
+ if room_booking_id.nil?
131
+ fail ArgumentError, 'room_booking_id cannot be nil'
132
+ end
133
+
134
+ @room_booking_id = room_booking_id
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ room_booking_id == o.room_booking_id &&
143
+ listing_id == o.listing_id &&
144
+ hotel_id == o.hotel_id &&
145
+ sync_enabled == o.sync_enabled
146
+ end
147
+
148
+ # @see the `==` method
149
+ # @param [Object] Object to be compared
150
+ def eql?(o)
151
+ self == o
152
+ end
153
+
154
+ # Calculates hash code according to all attributes.
155
+ # @return [Integer] Hash code
156
+ def hash
157
+ [room_booking_id, listing_id, hotel_id, sync_enabled].hash
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def self.build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ transformed_hash = {}
167
+ openapi_types.each_pair do |key, type|
168
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = nil
170
+ elsif type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[attribute_map[key]].is_a?(Array)
174
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
175
+ end
176
+ elsif !attributes[attribute_map[key]].nil?
177
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
178
+ end
179
+ end
180
+ new(transformed_hash)
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ end
200
+
201
+ end
@@ -0,0 +1,315 @@
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
+ # Id fields are strings (API-wide convention — bigint ids are stringified to avoid 53-bit JS-number precision loss).
18
+ class MapBookingRoomResponse < ApiModelBase
19
+ attr_accessor :success
20
+
21
+ # True when the room already pointed at this listing (or was already unmapped) and its channel link agreed. Nothing was written.
22
+ attr_accessor :already_mapped
23
+
24
+ # Booking.com's room id, as recorded for this room.
25
+ attr_accessor :room_booking_id
26
+
27
+ # The listing the room now points at. Null after an unmap.
28
+ attr_accessor :listing_id
29
+
30
+ # The listing the room pointed at before this call; null when it was unmapped. Omitted on a no-op.
31
+ attr_accessor :previous_listing_id
32
+
33
+ # The Booking.com property the room belongs to.
34
+ attr_accessor :hotel_id
35
+
36
+ # Repull-side id of the room record — the `roomId` the Connect room-mapping flow takes.
37
+ attr_accessor :room_id
38
+
39
+ attr_accessor :room_name
40
+
41
+ # Id of the resulting channel-link row. Null after an unmap, and for a room Booking.com has given us no room id for.
42
+ attr_accessor :platform_link_id
43
+
44
+ # Reservations Booking.com returned for the property and ran through the import after the room was mapped — the property's active bookings, which would otherwise never reach the listing. A reservation already present is left as it is, so this counts what was processed, not what was new, and re-sending never duplicates. Runs on every successful map, including a re-map to the same listing, so re-sending retries an import that did not run. `null` means the mapping succeeded but the import could not run; the room is still mapped. Absent after an unmap, when there is nothing to pull.
45
+ attr_accessor :reservations_imported
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'success' => :'success',
51
+ :'already_mapped' => :'alreadyMapped',
52
+ :'room_booking_id' => :'roomBookingId',
53
+ :'listing_id' => :'listingId',
54
+ :'previous_listing_id' => :'previousListingId',
55
+ :'hotel_id' => :'hotelId',
56
+ :'room_id' => :'roomId',
57
+ :'room_name' => :'roomName',
58
+ :'platform_link_id' => :'platformLinkId',
59
+ :'reservations_imported' => :'reservationsImported'
60
+ }
61
+ end
62
+
63
+ # Returns attribute mapping this model knows about
64
+ def self.acceptable_attribute_map
65
+ attribute_map
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ acceptable_attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'success' => :'Boolean',
77
+ :'already_mapped' => :'Boolean',
78
+ :'room_booking_id' => :'String',
79
+ :'listing_id' => :'String',
80
+ :'previous_listing_id' => :'String',
81
+ :'hotel_id' => :'String',
82
+ :'room_id' => :'String',
83
+ :'room_name' => :'String',
84
+ :'platform_link_id' => :'String',
85
+ :'reservations_imported' => :'Integer'
86
+ }
87
+ end
88
+
89
+ # List of attributes with nullable: true
90
+ def self.openapi_nullable
91
+ Set.new([
92
+ :'room_booking_id',
93
+ :'listing_id',
94
+ :'previous_listing_id',
95
+ :'room_name',
96
+ :'platform_link_id',
97
+ :'reservations_imported'
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::MapBookingRoomResponse` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ acceptable_attribute_map = self.class.acceptable_attribute_map
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!acceptable_attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::MapBookingRoomResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'success')
118
+ self.success = attributes[:'success']
119
+ else
120
+ self.success = nil
121
+ end
122
+
123
+ if attributes.key?(:'already_mapped')
124
+ self.already_mapped = attributes[:'already_mapped']
125
+ else
126
+ self.already_mapped = nil
127
+ end
128
+
129
+ if attributes.key?(:'room_booking_id')
130
+ self.room_booking_id = attributes[:'room_booking_id']
131
+ else
132
+ self.room_booking_id = nil
133
+ end
134
+
135
+ if attributes.key?(:'listing_id')
136
+ self.listing_id = attributes[:'listing_id']
137
+ else
138
+ self.listing_id = nil
139
+ end
140
+
141
+ if attributes.key?(:'previous_listing_id')
142
+ self.previous_listing_id = attributes[:'previous_listing_id']
143
+ end
144
+
145
+ if attributes.key?(:'hotel_id')
146
+ self.hotel_id = attributes[:'hotel_id']
147
+ else
148
+ self.hotel_id = nil
149
+ end
150
+
151
+ if attributes.key?(:'room_id')
152
+ self.room_id = attributes[:'room_id']
153
+ else
154
+ self.room_id = nil
155
+ end
156
+
157
+ if attributes.key?(:'room_name')
158
+ self.room_name = attributes[:'room_name']
159
+ end
160
+
161
+ if attributes.key?(:'platform_link_id')
162
+ self.platform_link_id = attributes[:'platform_link_id']
163
+ end
164
+
165
+ if attributes.key?(:'reservations_imported')
166
+ self.reservations_imported = attributes[:'reservations_imported']
167
+ end
168
+ end
169
+
170
+ # Show invalid properties with the reasons. Usually used together with valid?
171
+ # @return Array for valid properties with the reasons
172
+ def list_invalid_properties
173
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
174
+ invalid_properties = Array.new
175
+ if @success.nil?
176
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
177
+ end
178
+
179
+ if @already_mapped.nil?
180
+ invalid_properties.push('invalid value for "already_mapped", already_mapped cannot be nil.')
181
+ end
182
+
183
+ if @hotel_id.nil?
184
+ invalid_properties.push('invalid value for "hotel_id", hotel_id cannot be nil.')
185
+ end
186
+
187
+ if @room_id.nil?
188
+ invalid_properties.push('invalid value for "room_id", room_id cannot be nil.')
189
+ end
190
+
191
+ invalid_properties
192
+ end
193
+
194
+ # Check to see if the all the properties in the model are valid
195
+ # @return true if the model is valid
196
+ def valid?
197
+ warn '[DEPRECATED] the `valid?` method is obsolete'
198
+ return false if @success.nil?
199
+ return false if @already_mapped.nil?
200
+ return false if @hotel_id.nil?
201
+ return false if @room_id.nil?
202
+ true
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] success Value to be assigned
207
+ def success=(success)
208
+ if success.nil?
209
+ fail ArgumentError, 'success cannot be nil'
210
+ end
211
+
212
+ @success = success
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] already_mapped Value to be assigned
217
+ def already_mapped=(already_mapped)
218
+ if already_mapped.nil?
219
+ fail ArgumentError, 'already_mapped cannot be nil'
220
+ end
221
+
222
+ @already_mapped = already_mapped
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] hotel_id Value to be assigned
227
+ def hotel_id=(hotel_id)
228
+ if hotel_id.nil?
229
+ fail ArgumentError, 'hotel_id cannot be nil'
230
+ end
231
+
232
+ @hotel_id = hotel_id
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] room_id Value to be assigned
237
+ def room_id=(room_id)
238
+ if room_id.nil?
239
+ fail ArgumentError, 'room_id cannot be nil'
240
+ end
241
+
242
+ @room_id = room_id
243
+ end
244
+
245
+ # Checks equality by comparing each attribute.
246
+ # @param [Object] Object to be compared
247
+ def ==(o)
248
+ return true if self.equal?(o)
249
+ self.class == o.class &&
250
+ success == o.success &&
251
+ already_mapped == o.already_mapped &&
252
+ room_booking_id == o.room_booking_id &&
253
+ listing_id == o.listing_id &&
254
+ previous_listing_id == o.previous_listing_id &&
255
+ hotel_id == o.hotel_id &&
256
+ room_id == o.room_id &&
257
+ room_name == o.room_name &&
258
+ platform_link_id == o.platform_link_id &&
259
+ reservations_imported == o.reservations_imported
260
+ end
261
+
262
+ # @see the `==` method
263
+ # @param [Object] Object to be compared
264
+ def eql?(o)
265
+ self == o
266
+ end
267
+
268
+ # Calculates hash code according to all attributes.
269
+ # @return [Integer] Hash code
270
+ def hash
271
+ [success, already_mapped, room_booking_id, listing_id, previous_listing_id, hotel_id, room_id, room_name, platform_link_id, reservations_imported].hash
272
+ end
273
+
274
+ # Builds the object from hash
275
+ # @param [Hash] attributes Model attributes in the form of hash
276
+ # @return [Object] Returns the model itself
277
+ def self.build_from_hash(attributes)
278
+ return nil unless attributes.is_a?(Hash)
279
+ attributes = attributes.transform_keys(&:to_sym)
280
+ transformed_hash = {}
281
+ openapi_types.each_pair do |key, type|
282
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
283
+ transformed_hash["#{key}"] = nil
284
+ elsif type =~ /\AArray<(.*)>/i
285
+ # check to ensure the input is an array given that the attribute
286
+ # is documented as an array but the input is not
287
+ if attributes[attribute_map[key]].is_a?(Array)
288
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
289
+ end
290
+ elsif !attributes[attribute_map[key]].nil?
291
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
292
+ end
293
+ end
294
+ new(transformed_hash)
295
+ end
296
+
297
+ # Returns the object in the form of hash
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_hash
300
+ hash = {}
301
+ self.class.attribute_map.each_pair do |attr, param|
302
+ value = self.send(attr)
303
+ if value.nil?
304
+ is_nullable = self.class.openapi_nullable.include?(attr)
305
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
306
+ end
307
+
308
+ hash[param] = _to_hash(value)
309
+ end
310
+ hash
311
+ end
312
+
313
+ end
314
+
315
+ end