repull 0.2.35 → 0.2.36

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/connect_api.rb +2 -2
  3. data/lib/repull/api/listings_api.rb +8 -8
  4. data/lib/repull/api/migrate_api.rb +68 -0
  5. data/lib/repull/models/booking_unacknowledged_event.rb +281 -0
  6. data/lib/repull/models/booking_unacknowledged_payload.rb +229 -0
  7. data/lib/repull/models/channel_degraded_event.rb +279 -0
  8. data/lib/repull/models/channel_degraded_payload.rb +174 -0
  9. data/lib/repull/models/channel_degraded_payload_object.rb +262 -0
  10. data/lib/repull/models/channel_sync_failed_event.rb +280 -0
  11. data/lib/repull/models/channel_sync_failure_payload.rb +214 -0
  12. data/lib/repull/models/channel_sync_failure_payload_failures_inner.rb +213 -0
  13. data/lib/repull/models/channel_sync_failure_payload_object.rb +289 -0
  14. data/lib/repull/models/charge_per.rb +42 -0
  15. data/lib/repull/models/create_connect_session_request.rb +2 -2
  16. data/lib/repull/models/create_connection_request.rb +1 -1
  17. data/lib/repull/models/import_from_channex200_response.rb +147 -0
  18. data/lib/repull/models/import_from_channex200_response_data.rb +324 -0
  19. data/lib/repull/models/import_from_channex200_response_data_channels_inner.rb +263 -0
  20. data/lib/repull/models/import_from_channex200_response_data_properties_inner.rb +222 -0
  21. data/lib/repull/models/import_from_channex200_response_data_summary.rb +201 -0
  22. data/lib/repull/models/import_from_channex200_response_data_summary_bookings.rb +165 -0
  23. data/lib/repull/models/import_from_channex200_response_data_summary_properties.rb +165 -0
  24. data/lib/repull/models/import_from_channex_request.rb +223 -0
  25. data/lib/repull/models/listing.rb +82 -1
  26. data/lib/repull/models/listing_content_photo.rb +206 -0
  27. data/lib/repull/models/listing_fee.rb +229 -0
  28. data/lib/repull/models/listing_policies.rb +257 -0
  29. data/lib/repull/models/listing_policies_check_in.rb +179 -0
  30. data/lib/repull/models/listing_policies_check_out.rb +148 -0
  31. data/lib/repull/models/listing_policies_quiet_hours.rb +156 -0
  32. data/lib/repull/models/listing_pricing_settings.rb +233 -0
  33. data/lib/repull/models/listing_room.rb +190 -0
  34. data/lib/repull/models/listing_room_beds_inner.rb +156 -0
  35. data/lib/repull/models/listing_rules.rb +212 -0
  36. data/lib/repull/models/listing_tax.rb +241 -0
  37. data/lib/repull/models/reservation_thread_assigned_event.rb +279 -0
  38. data/lib/repull/models/reservation_thread_assigned_payload.rb +174 -0
  39. data/lib/repull/models/reservation_thread_assigned_payload_object.rb +249 -0
  40. data/lib/repull/models/webhook_event.rb +8 -0
  41. data/lib/repull/models/webhook_event_type.rb +5 -1
  42. data/lib/repull/version.rb +1 -1
  43. data/lib/repull.rb +32 -0
  44. data/openapi/v1.json +1591 -8
  45. metadata +34 -4
  46. data/spec/api/plumguide_api_spec.rb +0 -85
@@ -0,0 +1,280 @@
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` | unlimited (10 included, then billed per listing) | | `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
+
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
+ class ChannelSyncFailedEvent < ApiModelBase
18
+ # The event name. This field is `event`, not `type`.
19
+ attr_accessor :event
20
+
21
+ # Stable across every delivery and replay of this logical event — dedupe on it.
22
+ attr_accessor :event_id
23
+
24
+ attr_accessor :api_version
25
+
26
+ attr_accessor :timestamp
27
+
28
+ attr_accessor :account
29
+
30
+ attr_accessor :data
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'event' => :'event',
36
+ :'event_id' => :'eventId',
37
+ :'api_version' => :'apiVersion',
38
+ :'timestamp' => :'timestamp',
39
+ :'account' => :'account',
40
+ :'data' => :'data'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'event' => :'String',
58
+ :'event_id' => :'String',
59
+ :'api_version' => :'String',
60
+ :'timestamp' => :'Time',
61
+ :'account' => :'WebhookEventAccount',
62
+ :'data' => :'ChannelSyncFailurePayload'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ :'account',
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ChannelSyncFailedEvent` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::ChannelSyncFailedEvent`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'event')
90
+ self.event = attributes[:'event']
91
+ else
92
+ self.event = nil
93
+ end
94
+
95
+ if attributes.key?(:'event_id')
96
+ self.event_id = attributes[:'event_id']
97
+ else
98
+ self.event_id = nil
99
+ end
100
+
101
+ if attributes.key?(:'api_version')
102
+ self.api_version = attributes[:'api_version']
103
+ else
104
+ self.api_version = nil
105
+ end
106
+
107
+ if attributes.key?(:'timestamp')
108
+ self.timestamp = attributes[:'timestamp']
109
+ else
110
+ self.timestamp = nil
111
+ end
112
+
113
+ if attributes.key?(:'account')
114
+ self.account = attributes[:'account']
115
+ end
116
+
117
+ if attributes.key?(:'data')
118
+ self.data = attributes[:'data']
119
+ else
120
+ self.data = nil
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
128
+ invalid_properties = Array.new
129
+ if @event.nil?
130
+ invalid_properties.push('invalid value for "event", event cannot be nil.')
131
+ end
132
+
133
+ if @event_id.nil?
134
+ invalid_properties.push('invalid value for "event_id", event_id cannot be nil.')
135
+ end
136
+
137
+ if @api_version.nil?
138
+ invalid_properties.push('invalid value for "api_version", api_version cannot be nil.')
139
+ end
140
+
141
+ if @timestamp.nil?
142
+ invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
143
+ end
144
+
145
+ if @data.nil?
146
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
147
+ end
148
+
149
+ invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ warn '[DEPRECATED] the `valid?` method is obsolete'
156
+ return false if @event.nil?
157
+ return false if @event_id.nil?
158
+ return false if @api_version.nil?
159
+ return false if @timestamp.nil?
160
+ return false if @data.nil?
161
+ true
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] event Value to be assigned
166
+ def event=(event)
167
+ if event.nil?
168
+ fail ArgumentError, 'event cannot be nil'
169
+ end
170
+
171
+ @event = event
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] event_id Value to be assigned
176
+ def event_id=(event_id)
177
+ if event_id.nil?
178
+ fail ArgumentError, 'event_id cannot be nil'
179
+ end
180
+
181
+ @event_id = event_id
182
+ end
183
+
184
+ # Custom attribute writer method with validation
185
+ # @param [Object] api_version Value to be assigned
186
+ def api_version=(api_version)
187
+ if api_version.nil?
188
+ fail ArgumentError, 'api_version cannot be nil'
189
+ end
190
+
191
+ @api_version = api_version
192
+ end
193
+
194
+ # Custom attribute writer method with validation
195
+ # @param [Object] timestamp Value to be assigned
196
+ def timestamp=(timestamp)
197
+ if timestamp.nil?
198
+ fail ArgumentError, 'timestamp cannot be nil'
199
+ end
200
+
201
+ @timestamp = timestamp
202
+ end
203
+
204
+ # Custom attribute writer method with validation
205
+ # @param [Object] data Value to be assigned
206
+ def data=(data)
207
+ if data.nil?
208
+ fail ArgumentError, 'data cannot be nil'
209
+ end
210
+
211
+ @data = data
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
+ event == o.event &&
220
+ event_id == o.event_id &&
221
+ api_version == o.api_version &&
222
+ timestamp == o.timestamp &&
223
+ account == o.account &&
224
+ data == o.data
225
+ end
226
+
227
+ # @see the `==` method
228
+ # @param [Object] Object to be compared
229
+ def eql?(o)
230
+ self == o
231
+ end
232
+
233
+ # Calculates hash code according to all attributes.
234
+ # @return [Integer] Hash code
235
+ def hash
236
+ [event, event_id, api_version, timestamp, account, data].hash
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def self.build_from_hash(attributes)
243
+ return nil unless attributes.is_a?(Hash)
244
+ attributes = attributes.transform_keys(&:to_sym)
245
+ transformed_hash = {}
246
+ openapi_types.each_pair do |key, type|
247
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
248
+ transformed_hash["#{key}"] = nil
249
+ elsif type =~ /\AArray<(.*)>/i
250
+ # check to ensure the input is an array given that the attribute
251
+ # is documented as an array but the input is not
252
+ if attributes[attribute_map[key]].is_a?(Array)
253
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
254
+ end
255
+ elsif !attributes[attribute_map[key]].nil?
256
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
257
+ end
258
+ end
259
+ new(transformed_hash)
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ if value.nil?
269
+ is_nullable = self.class.openapi_nullable.include?(attr)
270
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
271
+ end
272
+
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ end
279
+
280
+ end
@@ -0,0 +1,214 @@
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` | unlimited (10 included, then billed per listing) | | `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
+
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
+ # Payload for `channel.sync.failed`. A push of availability, rates or content to a connected channel did not land.
18
+ class ChannelSyncFailurePayload < ApiModelBase
19
+ attr_accessor :object
20
+
21
+ # One entry per channel mapping that refused the push.
22
+ attr_accessor :failures
23
+
24
+ # Set when the push was blocking dates for a booking just taken. Those nights are sold on one channel and still open on another — treat as urgent.
25
+ attr_accessor :reservation_id
26
+
27
+ attr_accessor :occurred_at
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'object' => :'object',
33
+ :'failures' => :'failures',
34
+ :'reservation_id' => :'reservationId',
35
+ :'occurred_at' => :'occurredAt'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'object' => :'ChannelSyncFailurePayloadObject',
53
+ :'failures' => :'Array<ChannelSyncFailurePayloadFailuresInner>',
54
+ :'reservation_id' => :'Integer',
55
+ :'occurred_at' => :'Time'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ :'reservation_id',
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ChannelSyncFailurePayload` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::ChannelSyncFailurePayload`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'object')
83
+ self.object = attributes[:'object']
84
+ else
85
+ self.object = nil
86
+ end
87
+
88
+ if attributes.key?(:'failures')
89
+ if (value = attributes[:'failures']).is_a?(Array)
90
+ self.failures = value
91
+ end
92
+ else
93
+ self.failures = nil
94
+ end
95
+
96
+ if attributes.key?(:'reservation_id')
97
+ self.reservation_id = attributes[:'reservation_id']
98
+ end
99
+
100
+ if attributes.key?(:'occurred_at')
101
+ self.occurred_at = attributes[:'occurred_at']
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @object.nil?
111
+ invalid_properties.push('invalid value for "object", object cannot be nil.')
112
+ end
113
+
114
+ if @failures.nil?
115
+ invalid_properties.push('invalid value for "failures", failures cannot be nil.')
116
+ end
117
+
118
+ invalid_properties
119
+ end
120
+
121
+ # Check to see if the all the properties in the model are valid
122
+ # @return true if the model is valid
123
+ def valid?
124
+ warn '[DEPRECATED] the `valid?` method is obsolete'
125
+ return false if @object.nil?
126
+ return false if @failures.nil?
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] object Value to be assigned
132
+ def object=(object)
133
+ if object.nil?
134
+ fail ArgumentError, 'object cannot be nil'
135
+ end
136
+
137
+ @object = object
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] failures Value to be assigned
142
+ def failures=(failures)
143
+ if failures.nil?
144
+ fail ArgumentError, 'failures cannot be nil'
145
+ end
146
+
147
+ @failures = failures
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ object == o.object &&
156
+ failures == o.failures &&
157
+ reservation_id == o.reservation_id &&
158
+ occurred_at == o.occurred_at
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [object, failures, reservation_id, occurred_at].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ attributes = attributes.transform_keys(&:to_sym)
179
+ transformed_hash = {}
180
+ openapi_types.each_pair do |key, type|
181
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
182
+ transformed_hash["#{key}"] = nil
183
+ elsif type =~ /\AArray<(.*)>/i
184
+ # check to ensure the input is an array given that the attribute
185
+ # is documented as an array but the input is not
186
+ if attributes[attribute_map[key]].is_a?(Array)
187
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
188
+ end
189
+ elsif !attributes[attribute_map[key]].nil?
190
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
191
+ end
192
+ end
193
+ new(transformed_hash)
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ end
213
+
214
+ end