repull 0.2.31 → 0.2.33

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/repull/api/booking_com_api.rb +80 -0
  4. data/lib/repull/api/connections_api.rb +77 -0
  5. data/lib/repull/api/resolutions_api.rb +236 -0
  6. data/lib/repull/api/transactions_api.rb +182 -0
  7. data/lib/repull/models/account_import.rb +237 -0
  8. data/lib/repull/models/account_import_completed_event.rb +282 -0
  9. data/lib/repull/models/account_import_counts.rb +193 -0
  10. data/lib/repull/models/account_import_failed_event.rb +282 -0
  11. data/lib/repull/models/account_import_finished_payload.rb +224 -0
  12. data/lib/repull/models/account_import_stage.rb +177 -0
  13. data/lib/repull/models/account_import_started_event.rb +282 -0
  14. data/lib/repull/models/account_import_started_payload.rb +177 -0
  15. data/lib/repull/models/connection.rb +16 -5
  16. data/lib/repull/models/list_airbnb_resolutions200_response.rb +192 -0
  17. data/lib/repull/models/list_booking_transactions200_response.rb +158 -0
  18. data/lib/repull/models/list_connection_imports200_response.rb +158 -0
  19. data/lib/repull/models/refresh_airbnb_resolutions200_response.rb +219 -0
  20. data/lib/repull/models/refresh_airbnb_resolutions200_response_accounts_inner.rb +200 -0
  21. data/lib/repull/models/refresh_airbnb_resolutions200_response_accounts_inner_error.rb +156 -0
  22. data/lib/repull/models/refresh_airbnb_resolutions_request.rb +192 -0
  23. data/lib/repull/models/reservation.rb +45 -1
  24. data/lib/repull/models/reservation_webhook_object.rb +49 -5
  25. data/lib/repull/models/resolution.rb +329 -0
  26. data/lib/repull/models/transaction.rb +349 -0
  27. data/lib/repull/models/transaction_fees.rb +176 -0
  28. data/lib/repull/models/transaction_payout.rb +209 -0
  29. data/lib/repull/models/webhook_event.rb +6 -0
  30. data/lib/repull/models/webhook_event_type.rb +4 -1
  31. data/lib/repull/version.rb +1 -1
  32. data/lib/repull.rb +21 -0
  33. data/openapi/v1.json +1295 -153
  34. data/scripts/regen.sh +1 -1
  35. metadata +23 -2
@@ -0,0 +1,192 @@
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 RefreshAirbnbResolutionsRequest < ApiModelBase
18
+ # Limit the refresh to one Airbnb host id. Omit for all connected accounts.
19
+ attr_accessor :account_id
20
+
21
+ # Limit the refresh to one lifecycle. Omit for all.
22
+ attr_accessor :status
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'account_id' => :'account_id',
50
+ :'status' => :'status'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'account_id' => :'String',
68
+ :'status' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::RefreshAirbnbResolutionsRequest` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::RefreshAirbnbResolutionsRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'account_id')
95
+ self.account_id = attributes[:'account_id']
96
+ end
97
+
98
+ if attributes.key?(:'status')
99
+ self.status = attributes[:'status']
100
+ end
101
+ end
102
+
103
+ # Show invalid properties with the reasons. Usually used together with valid?
104
+ # @return Array for valid properties with the reasons
105
+ def list_invalid_properties
106
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
107
+ invalid_properties = Array.new
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ warn '[DEPRECATED] the `valid?` method is obsolete'
115
+ status_validator = EnumAttributeValidator.new('String', ["OPEN", "CLOSED"])
116
+ return false unless status_validator.valid?(@status)
117
+ true
118
+ end
119
+
120
+ # Custom attribute writer method checking allowed values (enum).
121
+ # @param [Object] status Object to be assigned
122
+ def status=(status)
123
+ validator = EnumAttributeValidator.new('String', ["OPEN", "CLOSED"])
124
+ unless validator.valid?(status)
125
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
126
+ end
127
+ @status = status
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ account_id == o.account_id &&
136
+ status == o.status
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [account_id, status].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ return nil unless attributes.is_a?(Hash)
156
+ attributes = attributes.transform_keys(&:to_sym)
157
+ transformed_hash = {}
158
+ openapi_types.each_pair do |key, type|
159
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = nil
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[attribute_map[key]].is_a?(Array)
165
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
166
+ end
167
+ elsif !attributes[attribute_map[key]].nil?
168
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
169
+ end
170
+ end
171
+ new(transformed_hash)
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ end
191
+
192
+ end
@@ -38,6 +38,18 @@ module Repull
38
38
  # Local check-out time for this stay, `HH:MM` on a 24-hour clock in the property's own timezone. Pair with `checkOut` to schedule the turnover clean. `null` when unknown. This is the same field `PATCH /v1/reservations/{id}` writes.
39
39
  attr_accessor :check_out_time
40
40
 
41
+ # What the guest wrote with the booking, as the channel sent it. Booking.com puts the estimated arrival time and special requests here. Free text, never parsed. `null` when the guest left none.
42
+ attr_accessor :guest_notes
43
+
44
+ # The conversation with this guest — pass it to `GET /v1/conversations/{id}` and `/v1/conversations/{id}/messages`. It is the same conversation from inquiry through pre-approval to the confirmed booking, and the same id the message webhooks carry, so a booking links straight to the messages that led to it. `null` when the channel has no conversation for this booking.
45
+ attr_accessor :conversation_id
46
+
47
+ # The channel's own id for that conversation (Airbnb thread id, Booking.com conversation id, …). `null` when there is none.
48
+ attr_accessor :external_thread_id
49
+
50
+ # The inquiry this booking came from (`GET /v1/inquiries`), when the guest asked before booking. When an inquiry turns into a booking, `inquiry.updated` fires with `status: \"booked\"` and this reservation's id. `null` for bookings with no inquiry.
51
+ attr_accessor :inquiry_id
52
+
41
53
  # Lifecycle status. The API normalises a multi-decade internal taxonomy down to these four buckets, so the value you receive is always one of the enum constants. `completed` is derived from `checkOut < today`. A `pending` booking request the channel already let lapse — Airbnb expires an unanswered request 24 hours after the guest asks, and no request can be answered once its check-in has passed — is reported as `cancelled` with `statusDetail: \"request_expired\"`, even when the channel never told us. Every `cancelled` reservation says how it ended in `statusDetail` when the channel tells us.
42
54
  attr_accessor :status
43
55
 
@@ -102,6 +114,10 @@ module Repull
102
114
  :'check_out' => :'checkOut',
103
115
  :'check_in_time' => :'checkInTime',
104
116
  :'check_out_time' => :'checkOutTime',
117
+ :'guest_notes' => :'guestNotes',
118
+ :'conversation_id' => :'conversationId',
119
+ :'external_thread_id' => :'externalThreadId',
120
+ :'inquiry_id' => :'inquiryId',
105
121
  :'status' => :'status',
106
122
  :'status_detail' => :'statusDetail',
107
123
  :'pending_reason' => :'pendingReason',
@@ -144,6 +160,10 @@ module Repull
144
160
  :'check_out' => :'Date',
145
161
  :'check_in_time' => :'String',
146
162
  :'check_out_time' => :'String',
163
+ :'guest_notes' => :'String',
164
+ :'conversation_id' => :'String',
165
+ :'external_thread_id' => :'String',
166
+ :'inquiry_id' => :'String',
147
167
  :'status' => :'String',
148
168
  :'status_detail' => :'String',
149
169
  :'pending_reason' => :'String',
@@ -171,6 +191,10 @@ module Repull
171
191
  :'account',
172
192
  :'check_in_time',
173
193
  :'check_out_time',
194
+ :'guest_notes',
195
+ :'conversation_id',
196
+ :'external_thread_id',
197
+ :'inquiry_id',
174
198
  :'source',
175
199
  :'platform',
176
200
  :'unit',
@@ -235,6 +259,22 @@ module Repull
235
259
  self.check_out_time = attributes[:'check_out_time']
236
260
  end
237
261
 
262
+ if attributes.key?(:'guest_notes')
263
+ self.guest_notes = attributes[:'guest_notes']
264
+ end
265
+
266
+ if attributes.key?(:'conversation_id')
267
+ self.conversation_id = attributes[:'conversation_id']
268
+ end
269
+
270
+ if attributes.key?(:'external_thread_id')
271
+ self.external_thread_id = attributes[:'external_thread_id']
272
+ end
273
+
274
+ if attributes.key?(:'inquiry_id')
275
+ self.inquiry_id = attributes[:'inquiry_id']
276
+ end
277
+
238
278
  if attributes.key?(:'status')
239
279
  self.status = attributes[:'status']
240
280
  else
@@ -466,6 +506,10 @@ module Repull
466
506
  check_out == o.check_out &&
467
507
  check_in_time == o.check_in_time &&
468
508
  check_out_time == o.check_out_time &&
509
+ guest_notes == o.guest_notes &&
510
+ conversation_id == o.conversation_id &&
511
+ external_thread_id == o.external_thread_id &&
512
+ inquiry_id == o.inquiry_id &&
469
513
  status == o.status &&
470
514
  status_detail == o.status_detail &&
471
515
  pending_reason == o.pending_reason &&
@@ -495,7 +539,7 @@ module Repull
495
539
  # Calculates hash code according to all attributes.
496
540
  # @return [Integer] Hash code
497
541
  def hash
498
- [account, id, listing_id, guest_id, check_in, check_out, check_in_time, check_out_time, status, status_detail, pending_reason, respond_by, source, platform, confirmation_code, unit, primary_guest, occupancy, financials, total_price, currency, guest_details, created_at, updated_at, booked_at, guest_name].hash
542
+ [account, id, listing_id, guest_id, check_in, check_out, check_in_time, check_out_time, guest_notes, conversation_id, external_thread_id, inquiry_id, status, status_detail, pending_reason, respond_by, source, platform, confirmation_code, unit, primary_guest, occupancy, financials, total_price, currency, guest_details, created_at, updated_at, booked_at, guest_name].hash
499
543
  end
500
544
 
501
545
  # Builds the object from hash
@@ -49,6 +49,18 @@ module Repull
49
49
  # Local check-out time, `HH:MM` on a 24-hour clock in the property's own timezone. Pair it with `checkoutDate` to schedule the turnover. `null` when unknown.
50
50
  attr_accessor :check_out_time
51
51
 
52
+ # What the guest wrote with the booking — on Booking.com, the estimated arrival time and special requests. Free text. `null` when there were none.
53
+ attr_accessor :guest_notes
54
+
55
+ # The conversation with this guest — pass it to `GET /v1/conversations/{id}` and `/v1/conversations/{id}/messages`. It is the same conversation from inquiry through pre-approval to the confirmed booking, and the same id the message webhooks carry, so a booking links straight to the messages that led to it. `null` when the channel has no conversation for this booking.
56
+ attr_accessor :conversation_id
57
+
58
+ # The channel's own id for that conversation (Airbnb thread id, Booking.com conversation id, …). `null` when there is none.
59
+ attr_accessor :external_thread_id
60
+
61
+ # The inquiry this booking came from (`GET /v1/inquiries`), when the guest asked before booking. When an inquiry turns into a booking, `inquiry.updated` fires with `status: \"booked\"` and this reservation's id. `null` for bookings with no inquiry.
62
+ attr_accessor :inquiry_id
63
+
52
64
  # Attribute mapping from ruby-style variable name to JSON key.
53
65
  def self.attribute_map
54
66
  {
@@ -62,7 +74,11 @@ module Repull
62
74
  :'status' => :'status',
63
75
  :'cancellation_policy' => :'cancellationPolicy',
64
76
  :'check_in_time' => :'checkInTime',
65
- :'check_out_time' => :'checkOutTime'
77
+ :'check_out_time' => :'checkOutTime',
78
+ :'guest_notes' => :'guestNotes',
79
+ :'conversation_id' => :'conversationId',
80
+ :'external_thread_id' => :'externalThreadId',
81
+ :'inquiry_id' => :'inquiryId'
66
82
  }
67
83
  end
68
84
 
@@ -89,7 +105,11 @@ module Repull
89
105
  :'status' => :'String',
90
106
  :'cancellation_policy' => :'String',
91
107
  :'check_in_time' => :'String',
92
- :'check_out_time' => :'String'
108
+ :'check_out_time' => :'String',
109
+ :'guest_notes' => :'String',
110
+ :'conversation_id' => :'String',
111
+ :'external_thread_id' => :'String',
112
+ :'inquiry_id' => :'String'
93
113
  }
94
114
  end
95
115
 
@@ -98,7 +118,11 @@ module Repull
98
118
  Set.new([
99
119
  :'cancellation_policy',
100
120
  :'check_in_time',
101
- :'check_out_time'
121
+ :'check_out_time',
122
+ :'guest_notes',
123
+ :'conversation_id',
124
+ :'external_thread_id',
125
+ :'inquiry_id'
102
126
  ])
103
127
  end
104
128
 
@@ -177,6 +201,22 @@ module Repull
177
201
  if attributes.key?(:'check_out_time')
178
202
  self.check_out_time = attributes[:'check_out_time']
179
203
  end
204
+
205
+ if attributes.key?(:'guest_notes')
206
+ self.guest_notes = attributes[:'guest_notes']
207
+ end
208
+
209
+ if attributes.key?(:'conversation_id')
210
+ self.conversation_id = attributes[:'conversation_id']
211
+ end
212
+
213
+ if attributes.key?(:'external_thread_id')
214
+ self.external_thread_id = attributes[:'external_thread_id']
215
+ end
216
+
217
+ if attributes.key?(:'inquiry_id')
218
+ self.inquiry_id = attributes[:'inquiry_id']
219
+ end
180
220
  end
181
221
 
182
222
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -329,7 +369,11 @@ module Repull
329
369
  status == o.status &&
330
370
  cancellation_policy == o.cancellation_policy &&
331
371
  check_in_time == o.check_in_time &&
332
- check_out_time == o.check_out_time
372
+ check_out_time == o.check_out_time &&
373
+ guest_notes == o.guest_notes &&
374
+ conversation_id == o.conversation_id &&
375
+ external_thread_id == o.external_thread_id &&
376
+ inquiry_id == o.inquiry_id
333
377
  end
334
378
 
335
379
  # @see the `==` method
@@ -341,7 +385,7 @@ module Repull
341
385
  # Calculates hash code according to all attributes.
342
386
  # @return [Integer] Hash code
343
387
  def hash
344
- [id, uid, channel, listing_id, customer_id, checkin_date, checkout_date, status, cancellation_policy, check_in_time, check_out_time].hash
388
+ [id, uid, channel, listing_id, customer_id, checkin_date, checkout_date, status, cancellation_policy, check_in_time, check_out_time, guest_notes, conversation_id, external_thread_id, inquiry_id].hash
345
389
  end
346
390
 
347
391
  # Builds the object from hash