repull 0.2.17 → 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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +4 -4
  3. data/lib/repull/api/booking_com_api.rb +113 -17
  4. data/lib/repull/api/health_api.rb +0 -57
  5. data/lib/repull/api/migrate_api.rb +552 -0
  6. data/lib/repull/api/reservations_api.rb +2 -2
  7. data/lib/repull/models/airbnb_permits_response.rb +1 -1
  8. data/lib/repull/models/airbnb_permits_write_request.rb +1 -1
  9. data/lib/repull/models/airbnb_permits_write_request_permits_inner.rb +43 -4
  10. data/lib/repull/models/{airbnb_permits_write_request_permits_inner_answers_inner.rb → airbnb_permits_write_request_permits_inner_answers_value.rb} +22 -34
  11. data/lib/repull/models/check_migration_cutover200_response.rb +147 -0
  12. data/lib/repull/models/check_migration_cutover_request.rb +175 -0
  13. data/lib/repull/models/check_migration_cutover_request_reservations_inner.rb +216 -0
  14. data/lib/repull/models/connect_provider.rb +18 -5
  15. data/lib/repull/models/connect_session.rb +25 -5
  16. data/lib/repull/models/create_connect_session_request.rb +81 -5
  17. data/lib/repull/models/create_connect_session_request_copy.rb +251 -0
  18. data/lib/repull/models/create_connect_session_request_workspace.rb +196 -0
  19. data/lib/repull/models/delete_migration200_response.rb +147 -0
  20. data/lib/repull/models/delete_migration200_response_data.rb +165 -0
  21. data/lib/repull/models/get_migration200_response.rb +147 -0
  22. data/lib/repull/models/get_migration_channel_map200_response.rb +147 -0
  23. data/lib/repull/models/get_migration_report200_response.rb +147 -0
  24. data/lib/repull/models/list_migrations200_response.rb +158 -0
  25. data/lib/repull/models/listing_content_update_request.rb +36 -1
  26. data/lib/repull/models/listing_content_update_request_checkout_tasks_inner.rb +210 -0
  27. data/lib/repull/models/listing_content_update_request_pricing.rb +283 -0
  28. data/lib/repull/models/listing_content_update_request_rooms_inner.rb +225 -0
  29. data/lib/repull/models/listing_content_update_request_rooms_inner_beds_inner.rb +209 -0
  30. data/lib/repull/models/listing_content_update_response.rb +1 -1
  31. data/lib/repull/models/listing_create_request.rb +24 -1
  32. data/lib/repull/models/listing_create_response.rb +14 -4
  33. data/lib/repull/models/map_booking_room_request.rb +201 -0
  34. data/lib/repull/models/map_booking_room_response.rb +315 -0
  35. data/lib/repull/models/migration.rb +303 -0
  36. data/lib/repull/models/migration_channel_map.rb +169 -0
  37. data/lib/repull/models/migration_channel_map_listings_inner.rb +208 -0
  38. data/lib/repull/models/migration_channel_map_listings_inner_airbnb.rb +156 -0
  39. data/lib/repull/models/migration_channel_map_listings_inner_booking.rb +156 -0
  40. data/lib/repull/models/migration_channel_map_sources_inner.rb +167 -0
  41. data/lib/repull/models/migration_completed_event.rb +309 -0
  42. data/lib/repull/models/migration_connections_inner.rb +195 -0
  43. data/lib/repull/models/migration_counts.rb +183 -0
  44. data/lib/repull/models/migration_cutover_check.rb +200 -0
  45. data/lib/repull/models/migration_cutover_check_mismatched_inner.rb +156 -0
  46. data/lib/repull/models/migration_failed_event.rb +309 -0
  47. data/lib/repull/models/migration_import_payload.rb +225 -0
  48. data/lib/repull/models/migration_import_payload_results_inner.rb +165 -0
  49. data/lib/repull/models/migration_import_run.rb +202 -0
  50. data/lib/repull/models/migration_import_run_results_inner.rb +165 -0
  51. data/lib/repull/models/migration_report.rb +179 -0
  52. data/lib/repull/models/migration_report_issues_inner.rb +229 -0
  53. data/lib/repull/models/migration_reservation_ref.rb +184 -0
  54. data/lib/repull/models/reservation.rb +12 -2
  55. data/lib/repull/models/run_migration_import202_response.rb +147 -0
  56. data/lib/repull/models/run_migration_import202_response_data.rb +158 -0
  57. data/lib/repull/models/run_migration_import202_response_data_queued_inner.rb +174 -0
  58. data/lib/repull/models/run_migration_import_request.rb +182 -0
  59. data/lib/repull/models/update_booking_content_request.rb +359 -0
  60. data/lib/repull/models/update_booking_content_request_content_data_inner.rb +156 -0
  61. data/lib/repull/models/update_booking_content_request_photos_inner.rb +164 -0
  62. data/lib/repull/models/webhook_event.rb +4 -0
  63. data/lib/repull/models/webhook_event_type.rb +3 -1
  64. data/lib/repull/version.rb +1 -1
  65. data/lib/repull.rb +45 -1
  66. data/openapi/v1.json +3855 -2272
  67. metadata +47 -3
@@ -0,0 +1,158 @@
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 ListMigrations200Response < ApiModelBase
18
+ attr_accessor :data
19
+
20
+ attr_accessor :pagination
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'data' => :'data',
26
+ :'pagination' => :'pagination'
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
+ :'data' => :'Array<Migration>',
44
+ :'pagination' => :'GetUsageLogs200ResponsePagination'
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::ListMigrations200Response` 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::ListMigrations200Response`. 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?(:'data')
71
+ if (value = attributes[:'data']).is_a?(Array)
72
+ self.data = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'pagination')
77
+ self.pagination = attributes[:'pagination']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ data == o.data &&
102
+ pagination == o.pagination
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [data, pagination].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Returns the object in the form of hash
141
+ # @return [Hash] Returns the object in the form of hash
142
+ def to_hash
143
+ hash = {}
144
+ self.class.attribute_map.each_pair do |attr, param|
145
+ value = self.send(attr)
146
+ if value.nil?
147
+ is_nullable = self.class.openapi_nullable.include?(attr)
148
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
149
+ end
150
+
151
+ hash[param] = _to_hash(value)
152
+ end
153
+ hash
154
+ end
155
+
156
+ end
157
+
158
+ end
@@ -39,6 +39,14 @@ module Repull
39
39
 
40
40
  attr_accessor :occupancy
41
41
 
42
+ # The listing's rooms and the beds in each — what Airbnb shows as the sleeping arrangements and needs before a listing can go live. FULL replacement: the rooms you send become the whole set. Omit to leave rooms untouched; send `[]` to clear them. Every entry is checked before anything is written, so a bad entry refuses the whole request with `422 invalid_params` naming it (e.g. `rooms[1].beds[0].quantity`) — a listing is never left with half its rooms. Values use Airbnb's vocabulary, which Booking.com room mapping also reads. This is a local write; publish to send it to a channel.
43
+ attr_accessor :rooms
44
+
45
+ # What the guest is asked to do before leaving. FULL replacement: omit to leave untouched; send `[]` to clear. An unknown `taskType` refuses the whole request with `422 invalid_params`. Published to Airbnb, which is the only channel with checkout tasks. Airbnb accepts them only from partner apps it has certified for the feature; until then the publish result reports Airbnb's own refusal for this section and every other section still lands.
46
+ attr_accessor :checkout_tasks
47
+
48
+ attr_accessor :pricing
49
+
42
50
  attr_accessor :policies
43
51
 
44
52
  # Photo set — full replacement by default (pass `photosMode: \"append\"` to add after existing photos, or `[]` to clear; omit to leave untouched). Each entry is a hosted image URL (string) or a structured ref. URL-ingest only: the URL is persisted and attached to the listing in order — the OTA push downloads it at publish time. Binary/multipart upload is a follow-up. A non-empty array with no valid http(s) URL is reported in `deferred` (existing photos left untouched).
@@ -59,6 +67,9 @@ module Repull
59
67
  :'address' => :'address',
60
68
  :'details' => :'details',
61
69
  :'occupancy' => :'occupancy',
70
+ :'rooms' => :'rooms',
71
+ :'checkout_tasks' => :'checkoutTasks',
72
+ :'pricing' => :'pricing',
62
73
  :'policies' => :'policies',
63
74
  :'photos' => :'photos',
64
75
  :'photos_mode' => :'photosMode'
@@ -87,6 +98,9 @@ module Repull
87
98
  :'address' => :'ListingContentUpdateRequestAddress',
88
99
  :'details' => :'ListingContentUpdateRequestDetails',
89
100
  :'occupancy' => :'ListingContentUpdateRequestOccupancy',
101
+ :'rooms' => :'Array<ListingContentUpdateRequestRoomsInner>',
102
+ :'checkout_tasks' => :'Array<ListingContentUpdateRequestCheckoutTasksInner>',
103
+ :'pricing' => :'ListingContentUpdateRequestPricing',
90
104
  :'policies' => :'ListingContentUpdateRequestPolicies',
91
105
  :'photos' => :'Array<ListingContentUpdateRequestPhotosInner>',
92
106
  :'photos_mode' => :'String'
@@ -100,6 +114,8 @@ module Repull
100
114
  :'name',
101
115
  :'description',
102
116
  :'summary',
117
+ :'rooms',
118
+ :'checkout_tasks',
103
119
  ])
104
120
  end
105
121
 
@@ -155,6 +171,22 @@ module Repull
155
171
  self.occupancy = attributes[:'occupancy']
156
172
  end
157
173
 
174
+ if attributes.key?(:'rooms')
175
+ if (value = attributes[:'rooms']).is_a?(Array)
176
+ self.rooms = value
177
+ end
178
+ end
179
+
180
+ if attributes.key?(:'checkout_tasks')
181
+ if (value = attributes[:'checkout_tasks']).is_a?(Array)
182
+ self.checkout_tasks = value
183
+ end
184
+ end
185
+
186
+ if attributes.key?(:'pricing')
187
+ self.pricing = attributes[:'pricing']
188
+ end
189
+
158
190
  if attributes.key?(:'policies')
159
191
  self.policies = attributes[:'policies']
160
192
  end
@@ -201,6 +233,9 @@ module Repull
201
233
  address == o.address &&
202
234
  details == o.details &&
203
235
  occupancy == o.occupancy &&
236
+ rooms == o.rooms &&
237
+ checkout_tasks == o.checkout_tasks &&
238
+ pricing == o.pricing &&
204
239
  policies == o.policies &&
205
240
  photos == o.photos &&
206
241
  photos_mode == o.photos_mode
@@ -215,7 +250,7 @@ module Repull
215
250
  # Calculates hash code according to all attributes.
216
251
  # @return [Integer] Hash code
217
252
  def hash
218
- [locale, title, name, description, summary, amenities, address, details, occupancy, policies, photos, photos_mode].hash
253
+ [locale, title, name, description, summary, amenities, address, details, occupancy, rooms, checkout_tasks, pricing, policies, photos, photos_mode].hash
219
254
  end
220
255
 
221
256
  # Builds the object from hash
@@ -0,0 +1,210 @@
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 ListingContentUpdateRequestCheckoutTasksInner < ApiModelBase
18
+ # Any casing is accepted; stored lowercase.
19
+ attr_accessor :task_type
20
+
21
+ # Detail shown to the guest with the task, e.g. \"Leave the keys on the kitchen counter\".
22
+ attr_accessor :instructions
23
+
24
+ attr_accessor :required
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'task_type' => :'taskType',
52
+ :'instructions' => :'instructions',
53
+ :'required' => :'required'
54
+ }
55
+ end
56
+
57
+ # Returns attribute mapping this model knows about
58
+ def self.acceptable_attribute_map
59
+ attribute_map
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ acceptable_attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'task_type' => :'String',
71
+ :'instructions' => :'String',
72
+ :'required' => :'Boolean'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'instructions',
80
+ :'required'
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::ListingContentUpdateRequestCheckoutTasksInner` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::ListingContentUpdateRequestCheckoutTasksInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'task_type')
101
+ self.task_type = attributes[:'task_type']
102
+ else
103
+ self.task_type = nil
104
+ end
105
+
106
+ if attributes.key?(:'instructions')
107
+ self.instructions = attributes[:'instructions']
108
+ end
109
+
110
+ if attributes.key?(:'required')
111
+ self.required = attributes[:'required']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @task_type.nil?
121
+ invalid_properties.push('invalid value for "task_type", task_type cannot be nil.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ warn '[DEPRECATED] the `valid?` method is obsolete'
131
+ return false if @task_type.nil?
132
+ task_type_validator = EnumAttributeValidator.new('String', ["return_keys", "turn_things_off", "throw_trash", "lock_up", "gather_towels", "additional_requests"])
133
+ return false unless task_type_validator.valid?(@task_type)
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method checking allowed values (enum).
138
+ # @param [Object] task_type Object to be assigned
139
+ def task_type=(task_type)
140
+ validator = EnumAttributeValidator.new('String', ["return_keys", "turn_things_off", "throw_trash", "lock_up", "gather_towels", "additional_requests"])
141
+ unless validator.valid?(task_type)
142
+ fail ArgumentError, "invalid value for \"task_type\", must be one of #{validator.allowable_values}."
143
+ end
144
+ @task_type = task_type
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ task_type == o.task_type &&
153
+ instructions == o.instructions &&
154
+ required == o.required
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [task_type, instructions, required].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ attributes = attributes.transform_keys(&:to_sym)
175
+ transformed_hash = {}
176
+ openapi_types.each_pair do |key, type|
177
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
178
+ transformed_hash["#{key}"] = nil
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[attribute_map[key]].is_a?(Array)
183
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
184
+ end
185
+ elsif !attributes[attribute_map[key]].nil?
186
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
187
+ end
188
+ end
189
+ new(transformed_hash)
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ if value.nil?
199
+ is_nullable = self.class.openapi_nullable.include?(attr)
200
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
201
+ end
202
+
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ end
209
+
210
+ end