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,359 @@
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
+ class UpdateBookingContentRequest < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ # Booking.com property id.
21
+ attr_accessor :property_id
22
+
23
+ # A Booking.com room id, for `facilities`, `photos` (gallery) and `licences`.
24
+ attr_accessor :room_id
25
+
26
+ # `description`: the property description, up to 65,535 characters.
27
+ attr_accessor :text
28
+
29
+ # `description`: language code, e.g. `en` or `es`.
30
+ attr_accessor :language
31
+
32
+ attr_accessor :facilities
33
+
34
+ attr_accessor :photos
35
+
36
+ attr_accessor :photo_ids
37
+
38
+ attr_accessor :settings
39
+
40
+ attr_accessor :policy_code
41
+
42
+ attr_accessor :policy_id
43
+
44
+ attr_accessor :prepayment_required
45
+
46
+ attr_accessor :variant_id
47
+
48
+ attr_accessor :content_data
49
+
50
+ # `checkin_methods`: [{ checkin_method }].
51
+ attr_accessor :methods
52
+
53
+ attr_accessor :contacts
54
+
55
+ class EnumAttributeValidator
56
+ attr_reader :datatype
57
+ attr_reader :allowable_values
58
+
59
+ def initialize(datatype, allowable_values)
60
+ @allowable_values = allowable_values.map do |value|
61
+ case datatype.to_s
62
+ when /Integer/i
63
+ value.to_i
64
+ when /Float/i
65
+ value.to_f
66
+ else
67
+ value
68
+ end
69
+ end
70
+ end
71
+
72
+ def valid?(value)
73
+ !value || allowable_values.include?(value)
74
+ end
75
+ end
76
+
77
+ # Attribute mapping from ruby-style variable name to JSON key.
78
+ def self.attribute_map
79
+ {
80
+ :'type' => :'type',
81
+ :'property_id' => :'property_id',
82
+ :'room_id' => :'room_id',
83
+ :'text' => :'text',
84
+ :'language' => :'language',
85
+ :'facilities' => :'facilities',
86
+ :'photos' => :'photos',
87
+ :'photo_ids' => :'photo_ids',
88
+ :'settings' => :'settings',
89
+ :'policy_code' => :'policyCode',
90
+ :'policy_id' => :'policyId',
91
+ :'prepayment_required' => :'prepaymentRequired',
92
+ :'variant_id' => :'variantId',
93
+ :'content_data' => :'contentData',
94
+ :'methods' => :'methods',
95
+ :'contacts' => :'contacts'
96
+ }
97
+ end
98
+
99
+ # Returns attribute mapping this model knows about
100
+ def self.acceptable_attribute_map
101
+ attribute_map
102
+ end
103
+
104
+ # Returns all the JSON keys this model knows about
105
+ def self.acceptable_attributes
106
+ acceptable_attribute_map.values
107
+ end
108
+
109
+ # Attribute type mapping.
110
+ def self.openapi_types
111
+ {
112
+ :'type' => :'String',
113
+ :'property_id' => :'String',
114
+ :'room_id' => :'String',
115
+ :'text' => :'String',
116
+ :'language' => :'String',
117
+ :'facilities' => :'Array<Hash<String, Object>>',
118
+ :'photos' => :'Array<UpdateBookingContentRequestPhotosInner>',
119
+ :'photo_ids' => :'Array<String>',
120
+ :'settings' => :'Hash<String, Object>',
121
+ :'policy_code' => :'Integer',
122
+ :'policy_id' => :'String',
123
+ :'prepayment_required' => :'Boolean',
124
+ :'variant_id' => :'Integer',
125
+ :'content_data' => :'Array<UpdateBookingContentRequestContentDataInner>',
126
+ :'methods' => :'Array<Hash<String, Object>>',
127
+ :'contacts' => :'Array<Hash<String, Object>>'
128
+ }
129
+ end
130
+
131
+ # List of attributes with nullable: true
132
+ def self.openapi_nullable
133
+ Set.new([
134
+ ])
135
+ end
136
+
137
+ # Initializes the object
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ def initialize(attributes = {})
140
+ if (!attributes.is_a?(Hash))
141
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::UpdateBookingContentRequest` initialize method"
142
+ end
143
+
144
+ # check to see if the attribute exists and convert string to symbol for hash key
145
+ acceptable_attribute_map = self.class.acceptable_attribute_map
146
+ attributes = attributes.each_with_object({}) { |(k, v), h|
147
+ if (!acceptable_attribute_map.key?(k.to_sym))
148
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::UpdateBookingContentRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
149
+ end
150
+ h[k.to_sym] = v
151
+ }
152
+
153
+ if attributes.key?(:'type')
154
+ self.type = attributes[:'type']
155
+ else
156
+ self.type = nil
157
+ end
158
+
159
+ if attributes.key?(:'property_id')
160
+ self.property_id = attributes[:'property_id']
161
+ else
162
+ self.property_id = nil
163
+ end
164
+
165
+ if attributes.key?(:'room_id')
166
+ self.room_id = attributes[:'room_id']
167
+ end
168
+
169
+ if attributes.key?(:'text')
170
+ self.text = attributes[:'text']
171
+ end
172
+
173
+ if attributes.key?(:'language')
174
+ self.language = attributes[:'language']
175
+ end
176
+
177
+ if attributes.key?(:'facilities')
178
+ if (value = attributes[:'facilities']).is_a?(Array)
179
+ self.facilities = value
180
+ end
181
+ end
182
+
183
+ if attributes.key?(:'photos')
184
+ if (value = attributes[:'photos']).is_a?(Array)
185
+ self.photos = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'photo_ids')
190
+ if (value = attributes[:'photo_ids']).is_a?(Array)
191
+ self.photo_ids = value
192
+ end
193
+ end
194
+
195
+ if attributes.key?(:'settings')
196
+ if (value = attributes[:'settings']).is_a?(Hash)
197
+ self.settings = value
198
+ end
199
+ end
200
+
201
+ if attributes.key?(:'policy_code')
202
+ self.policy_code = attributes[:'policy_code']
203
+ end
204
+
205
+ if attributes.key?(:'policy_id')
206
+ self.policy_id = attributes[:'policy_id']
207
+ end
208
+
209
+ if attributes.key?(:'prepayment_required')
210
+ self.prepayment_required = attributes[:'prepayment_required']
211
+ end
212
+
213
+ if attributes.key?(:'variant_id')
214
+ self.variant_id = attributes[:'variant_id']
215
+ end
216
+
217
+ if attributes.key?(:'content_data')
218
+ if (value = attributes[:'content_data']).is_a?(Array)
219
+ self.content_data = value
220
+ end
221
+ end
222
+
223
+ if attributes.key?(:'methods')
224
+ if (value = attributes[:'methods']).is_a?(Array)
225
+ self.methods = value
226
+ end
227
+ end
228
+
229
+ if attributes.key?(:'contacts')
230
+ if (value = attributes[:'contacts']).is_a?(Array)
231
+ self.contacts = value
232
+ end
233
+ end
234
+ end
235
+
236
+ # Show invalid properties with the reasons. Usually used together with valid?
237
+ # @return Array for valid properties with the reasons
238
+ def list_invalid_properties
239
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
240
+ invalid_properties = Array.new
241
+ if @type.nil?
242
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
243
+ end
244
+
245
+ if @property_id.nil?
246
+ invalid_properties.push('invalid value for "property_id", property_id cannot be nil.')
247
+ end
248
+
249
+ invalid_properties
250
+ end
251
+
252
+ # Check to see if the all the properties in the model are valid
253
+ # @return true if the model is valid
254
+ def valid?
255
+ warn '[DEPRECATED] the `valid?` method is obsolete'
256
+ return false if @type.nil?
257
+ type_validator = EnumAttributeValidator.new('String', ["photos", "facilities", "description", "settings", "policies", "licences", "checkin_methods", "contacts"])
258
+ return false unless type_validator.valid?(@type)
259
+ return false if @property_id.nil?
260
+ true
261
+ end
262
+
263
+ # Custom attribute writer method checking allowed values (enum).
264
+ # @param [Object] type Object to be assigned
265
+ def type=(type)
266
+ validator = EnumAttributeValidator.new('String', ["photos", "facilities", "description", "settings", "policies", "licences", "checkin_methods", "contacts"])
267
+ unless validator.valid?(type)
268
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
269
+ end
270
+ @type = type
271
+ end
272
+
273
+ # Custom attribute writer method with validation
274
+ # @param [Object] property_id Value to be assigned
275
+ def property_id=(property_id)
276
+ if property_id.nil?
277
+ fail ArgumentError, 'property_id cannot be nil'
278
+ end
279
+
280
+ @property_id = property_id
281
+ end
282
+
283
+ # Checks equality by comparing each attribute.
284
+ # @param [Object] Object to be compared
285
+ def ==(o)
286
+ return true if self.equal?(o)
287
+ self.class == o.class &&
288
+ type == o.type &&
289
+ property_id == o.property_id &&
290
+ room_id == o.room_id &&
291
+ text == o.text &&
292
+ language == o.language &&
293
+ facilities == o.facilities &&
294
+ photos == o.photos &&
295
+ photo_ids == o.photo_ids &&
296
+ settings == o.settings &&
297
+ policy_code == o.policy_code &&
298
+ policy_id == o.policy_id &&
299
+ prepayment_required == o.prepayment_required &&
300
+ variant_id == o.variant_id &&
301
+ content_data == o.content_data &&
302
+ methods == o.methods &&
303
+ contacts == o.contacts
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Integer] Hash code
314
+ def hash
315
+ [type, property_id, room_id, text, language, facilities, photos, photo_ids, settings, policy_code, policy_id, prepayment_required, variant_id, content_data, methods, contacts].hash
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def self.build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ attributes = attributes.transform_keys(&:to_sym)
324
+ transformed_hash = {}
325
+ openapi_types.each_pair do |key, type|
326
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
327
+ transformed_hash["#{key}"] = nil
328
+ elsif type =~ /\AArray<(.*)>/i
329
+ # check to ensure the input is an array given that the attribute
330
+ # is documented as an array but the input is not
331
+ if attributes[attribute_map[key]].is_a?(Array)
332
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
333
+ end
334
+ elsif !attributes[attribute_map[key]].nil?
335
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
336
+ end
337
+ end
338
+ new(transformed_hash)
339
+ end
340
+
341
+ # Returns the object in the form of hash
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_hash
344
+ hash = {}
345
+ self.class.attribute_map.each_pair do |attr, param|
346
+ value = self.send(attr)
347
+ if value.nil?
348
+ is_nullable = self.class.openapi_nullable.include?(attr)
349
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
350
+ end
351
+
352
+ hash[param] = _to_hash(value)
353
+ end
354
+ hash
355
+ end
356
+
357
+ end
358
+
359
+ end
@@ -0,0 +1,156 @@
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
+ class UpdateBookingContentRequestContentDataInner < ApiModelBase
18
+ attr_accessor :name
19
+
20
+ attr_accessor :value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'name' => :'name',
26
+ :'value' => :'value'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'name' => :'String',
44
+ :'value' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::UpdateBookingContentRequestContentDataInner` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::UpdateBookingContentRequestContentDataInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'name')
71
+ self.name = attributes[:'name']
72
+ end
73
+
74
+ if attributes.key?(:'value')
75
+ self.value = attributes[:'value']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ warn '[DEPRECATED] the `valid?` method is obsolete'
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ name == o.name &&
100
+ value == o.value
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [name, value].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ attributes = attributes.transform_keys(&:to_sym)
121
+ transformed_hash = {}
122
+ openapi_types.each_pair do |key, type|
123
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
124
+ transformed_hash["#{key}"] = nil
125
+ elsif type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[attribute_map[key]].is_a?(Array)
129
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
130
+ end
131
+ elsif !attributes[attribute_map[key]].nil?
132
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
133
+ end
134
+ end
135
+ new(transformed_hash)
136
+ end
137
+
138
+ # Returns the object in the form of hash
139
+ # @return [Hash] Returns the object in the form of hash
140
+ def to_hash
141
+ hash = {}
142
+ self.class.attribute_map.each_pair do |attr, param|
143
+ value = self.send(attr)
144
+ if value.nil?
145
+ is_nullable = self.class.openapi_nullable.include?(attr)
146
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
147
+ end
148
+
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ end
155
+
156
+ end