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,329 @@
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
+ # An Airbnb Resolution Center case (AirCover / damage, extra-guest, refund or change request). Read-only — Airbnb exposes no create/evidence/status API. The money a resolution moved rides in the transactions ledger as `Resolution Payout` / `Resolution Adjustment` rows sharing the same reference; join on `resolutionId`.
18
+ class Resolution < ApiModelBase
19
+ # Airbnb's resolution id — the `{id}` path value and the join key to a transaction's `reference`.
20
+ attr_accessor :resolution_id
21
+
22
+ # Airbnb confirmation code of the reservation the case is on.
23
+ attr_accessor :confirmation_code
24
+
25
+ # Repull's internal reservation id, when the reservation is in this workspace.
26
+ attr_accessor :reservation_id
27
+
28
+ attr_accessor :listing_name
29
+
30
+ # OPEN or CLOSED, as Airbnb reports it.
31
+ attr_accessor :status
32
+
33
+ # Why the resolution was opened.
34
+ attr_accessor :reason
35
+
36
+ # Airbnb's case-status label.
37
+ attr_accessor :case_status
38
+
39
+ # Human-readable status detail.
40
+ attr_accessor :status_text
41
+
42
+ # Airbnb's hint on whose turn it is to act next — track progress with it.
43
+ attr_accessor :suggested_action_text
44
+
45
+ # True when Airbnb Customer Support (not the host/guest) opened the case.
46
+ attr_accessor :customer_support_initiated
47
+
48
+ attr_accessor :product_type
49
+
50
+ # Who opened the case (id + name).
51
+ attr_accessor :initiator
52
+
53
+ # Who responds (id + name).
54
+ attr_accessor :responder
55
+
56
+ attr_accessor :created_at
57
+
58
+ attr_accessor :updated_at
59
+
60
+ # When Repull last refreshed this case from Airbnb.
61
+ attr_accessor :synced_at
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'resolution_id' => :'resolutionId',
67
+ :'confirmation_code' => :'confirmationCode',
68
+ :'reservation_id' => :'reservationId',
69
+ :'listing_name' => :'listingName',
70
+ :'status' => :'status',
71
+ :'reason' => :'reason',
72
+ :'case_status' => :'caseStatus',
73
+ :'status_text' => :'statusText',
74
+ :'suggested_action_text' => :'suggestedActionText',
75
+ :'customer_support_initiated' => :'customerSupportInitiated',
76
+ :'product_type' => :'productType',
77
+ :'initiator' => :'initiator',
78
+ :'responder' => :'responder',
79
+ :'created_at' => :'createdAt',
80
+ :'updated_at' => :'updatedAt',
81
+ :'synced_at' => :'syncedAt'
82
+ }
83
+ end
84
+
85
+ # Returns attribute mapping this model knows about
86
+ def self.acceptable_attribute_map
87
+ attribute_map
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ acceptable_attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'resolution_id' => :'String',
99
+ :'confirmation_code' => :'String',
100
+ :'reservation_id' => :'Integer',
101
+ :'listing_name' => :'String',
102
+ :'status' => :'String',
103
+ :'reason' => :'String',
104
+ :'case_status' => :'String',
105
+ :'status_text' => :'String',
106
+ :'suggested_action_text' => :'String',
107
+ :'customer_support_initiated' => :'Boolean',
108
+ :'product_type' => :'String',
109
+ :'initiator' => :'Object',
110
+ :'responder' => :'Object',
111
+ :'created_at' => :'Time',
112
+ :'updated_at' => :'Time',
113
+ :'synced_at' => :'Time'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ :'confirmation_code',
121
+ :'reservation_id',
122
+ :'listing_name',
123
+ :'status',
124
+ :'reason',
125
+ :'case_status',
126
+ :'status_text',
127
+ :'suggested_action_text',
128
+ :'customer_support_initiated',
129
+ :'product_type',
130
+ :'initiator',
131
+ :'responder',
132
+ :'created_at',
133
+ :'updated_at',
134
+ :'synced_at'
135
+ ])
136
+ end
137
+
138
+ # Initializes the object
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ def initialize(attributes = {})
141
+ if (!attributes.is_a?(Hash))
142
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::Resolution` initialize method"
143
+ end
144
+
145
+ # check to see if the attribute exists and convert string to symbol for hash key
146
+ acceptable_attribute_map = self.class.acceptable_attribute_map
147
+ attributes = attributes.each_with_object({}) { |(k, v), h|
148
+ if (!acceptable_attribute_map.key?(k.to_sym))
149
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::Resolution`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
150
+ end
151
+ h[k.to_sym] = v
152
+ }
153
+
154
+ if attributes.key?(:'resolution_id')
155
+ self.resolution_id = attributes[:'resolution_id']
156
+ else
157
+ self.resolution_id = nil
158
+ end
159
+
160
+ if attributes.key?(:'confirmation_code')
161
+ self.confirmation_code = attributes[:'confirmation_code']
162
+ end
163
+
164
+ if attributes.key?(:'reservation_id')
165
+ self.reservation_id = attributes[:'reservation_id']
166
+ end
167
+
168
+ if attributes.key?(:'listing_name')
169
+ self.listing_name = attributes[:'listing_name']
170
+ end
171
+
172
+ if attributes.key?(:'status')
173
+ self.status = attributes[:'status']
174
+ else
175
+ self.status = nil
176
+ end
177
+
178
+ if attributes.key?(:'reason')
179
+ self.reason = attributes[:'reason']
180
+ end
181
+
182
+ if attributes.key?(:'case_status')
183
+ self.case_status = attributes[:'case_status']
184
+ end
185
+
186
+ if attributes.key?(:'status_text')
187
+ self.status_text = attributes[:'status_text']
188
+ end
189
+
190
+ if attributes.key?(:'suggested_action_text')
191
+ self.suggested_action_text = attributes[:'suggested_action_text']
192
+ end
193
+
194
+ if attributes.key?(:'customer_support_initiated')
195
+ self.customer_support_initiated = attributes[:'customer_support_initiated']
196
+ end
197
+
198
+ if attributes.key?(:'product_type')
199
+ self.product_type = attributes[:'product_type']
200
+ end
201
+
202
+ if attributes.key?(:'initiator')
203
+ self.initiator = attributes[:'initiator']
204
+ end
205
+
206
+ if attributes.key?(:'responder')
207
+ self.responder = attributes[:'responder']
208
+ end
209
+
210
+ if attributes.key?(:'created_at')
211
+ self.created_at = attributes[:'created_at']
212
+ end
213
+
214
+ if attributes.key?(:'updated_at')
215
+ self.updated_at = attributes[:'updated_at']
216
+ end
217
+
218
+ if attributes.key?(:'synced_at')
219
+ self.synced_at = attributes[:'synced_at']
220
+ end
221
+ end
222
+
223
+ # Show invalid properties with the reasons. Usually used together with valid?
224
+ # @return Array for valid properties with the reasons
225
+ def list_invalid_properties
226
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
227
+ invalid_properties = Array.new
228
+ if @resolution_id.nil?
229
+ invalid_properties.push('invalid value for "resolution_id", resolution_id cannot be nil.')
230
+ end
231
+
232
+ invalid_properties
233
+ end
234
+
235
+ # Check to see if the all the properties in the model are valid
236
+ # @return true if the model is valid
237
+ def valid?
238
+ warn '[DEPRECATED] the `valid?` method is obsolete'
239
+ return false if @resolution_id.nil?
240
+ true
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] resolution_id Value to be assigned
245
+ def resolution_id=(resolution_id)
246
+ if resolution_id.nil?
247
+ fail ArgumentError, 'resolution_id cannot be nil'
248
+ end
249
+
250
+ @resolution_id = resolution_id
251
+ end
252
+
253
+ # Checks equality by comparing each attribute.
254
+ # @param [Object] Object to be compared
255
+ def ==(o)
256
+ return true if self.equal?(o)
257
+ self.class == o.class &&
258
+ resolution_id == o.resolution_id &&
259
+ confirmation_code == o.confirmation_code &&
260
+ reservation_id == o.reservation_id &&
261
+ listing_name == o.listing_name &&
262
+ status == o.status &&
263
+ reason == o.reason &&
264
+ case_status == o.case_status &&
265
+ status_text == o.status_text &&
266
+ suggested_action_text == o.suggested_action_text &&
267
+ customer_support_initiated == o.customer_support_initiated &&
268
+ product_type == o.product_type &&
269
+ initiator == o.initiator &&
270
+ responder == o.responder &&
271
+ created_at == o.created_at &&
272
+ updated_at == o.updated_at &&
273
+ synced_at == o.synced_at
274
+ end
275
+
276
+ # @see the `==` method
277
+ # @param [Object] Object to be compared
278
+ def eql?(o)
279
+ self == o
280
+ end
281
+
282
+ # Calculates hash code according to all attributes.
283
+ # @return [Integer] Hash code
284
+ def hash
285
+ [resolution_id, confirmation_code, reservation_id, listing_name, status, reason, case_status, status_text, suggested_action_text, customer_support_initiated, product_type, initiator, responder, created_at, updated_at, synced_at].hash
286
+ end
287
+
288
+ # Builds the object from hash
289
+ # @param [Hash] attributes Model attributes in the form of hash
290
+ # @return [Object] Returns the model itself
291
+ def self.build_from_hash(attributes)
292
+ return nil unless attributes.is_a?(Hash)
293
+ attributes = attributes.transform_keys(&:to_sym)
294
+ transformed_hash = {}
295
+ openapi_types.each_pair do |key, type|
296
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
297
+ transformed_hash["#{key}"] = nil
298
+ elsif type =~ /\AArray<(.*)>/i
299
+ # check to ensure the input is an array given that the attribute
300
+ # is documented as an array but the input is not
301
+ if attributes[attribute_map[key]].is_a?(Array)
302
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
303
+ end
304
+ elsif !attributes[attribute_map[key]].nil?
305
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
306
+ end
307
+ end
308
+ new(transformed_hash)
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ if value.nil?
318
+ is_nullable = self.class.openapi_nullable.include?(attr)
319
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
320
+ end
321
+
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ end
328
+
329
+ end
@@ -0,0 +1,349 @@
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
+ # One row of the unified transactions & payments ledger: a payout (`isPayout: true`) or a reservation charge / refund, on any channel. `platform` is normalized — `booking` is Booking.com however the account was connected (never `booking_extranet`). For a payout, `amount` is the net the host received, `grossAmount` the guest-paid gross, and `fees` the deductions (commission, payments service fee, processing fee).
18
+ class Transaction < ApiModelBase
19
+ # Stable id of the transaction (the underlying payment id). Upsert on it.
20
+ attr_accessor :transaction_id
21
+
22
+ # Normalized channel: `airbnb`, `booking` (Booking.com, however connected — never `booking_extranet`), or `vrbo`.
23
+ attr_accessor :platform
24
+
25
+ # Transaction type: `Payout`, `Reservation`, `Refund`, …
26
+ attr_accessor :type
27
+
28
+ # `true` when this is money that reached the host (a payout).
29
+ attr_accessor :is_payout
30
+
31
+ # Normalized settlement status (`COMPLETED` / `UPCOMING`; the raw value passes through when it maps to neither).
32
+ attr_accessor :status
33
+
34
+ # Transaction / payout date (the channel's display form or ISO).
35
+ attr_accessor :date
36
+
37
+ attr_accessor :currency
38
+
39
+ # Net amount; for a payout, what the host received.
40
+ attr_accessor :amount
41
+
42
+ # Guest-paid gross (payouts).
43
+ attr_accessor :gross_amount
44
+
45
+ attr_accessor :fees
46
+
47
+ attr_accessor :payout
48
+
49
+ attr_accessor :confirmation_code
50
+
51
+ attr_accessor :reservation_id
52
+
53
+ attr_accessor :listing_id
54
+
55
+ attr_accessor :synced_at
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'transaction_id' => :'transactionId',
61
+ :'platform' => :'platform',
62
+ :'type' => :'type',
63
+ :'is_payout' => :'isPayout',
64
+ :'status' => :'status',
65
+ :'date' => :'date',
66
+ :'currency' => :'currency',
67
+ :'amount' => :'amount',
68
+ :'gross_amount' => :'grossAmount',
69
+ :'fees' => :'fees',
70
+ :'payout' => :'payout',
71
+ :'confirmation_code' => :'confirmationCode',
72
+ :'reservation_id' => :'reservationId',
73
+ :'listing_id' => :'listingId',
74
+ :'synced_at' => :'syncedAt'
75
+ }
76
+ end
77
+
78
+ # Returns attribute mapping this model knows about
79
+ def self.acceptable_attribute_map
80
+ attribute_map
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ acceptable_attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'transaction_id' => :'String',
92
+ :'platform' => :'String',
93
+ :'type' => :'String',
94
+ :'is_payout' => :'Boolean',
95
+ :'status' => :'String',
96
+ :'date' => :'String',
97
+ :'currency' => :'String',
98
+ :'amount' => :'Float',
99
+ :'gross_amount' => :'Float',
100
+ :'fees' => :'TransactionFees',
101
+ :'payout' => :'TransactionPayout',
102
+ :'confirmation_code' => :'String',
103
+ :'reservation_id' => :'Integer',
104
+ :'listing_id' => :'Integer',
105
+ :'synced_at' => :'Time'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ :'transaction_id',
113
+ :'platform',
114
+ :'type',
115
+ :'status',
116
+ :'date',
117
+ :'currency',
118
+ :'amount',
119
+ :'gross_amount',
120
+ :'confirmation_code',
121
+ :'reservation_id',
122
+ :'listing_id',
123
+ :'synced_at'
124
+ ])
125
+ end
126
+
127
+ # Initializes the object
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ def initialize(attributes = {})
130
+ if (!attributes.is_a?(Hash))
131
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::Transaction` initialize method"
132
+ end
133
+
134
+ # check to see if the attribute exists and convert string to symbol for hash key
135
+ acceptable_attribute_map = self.class.acceptable_attribute_map
136
+ attributes = attributes.each_with_object({}) { |(k, v), h|
137
+ if (!acceptable_attribute_map.key?(k.to_sym))
138
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::Transaction`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
139
+ end
140
+ h[k.to_sym] = v
141
+ }
142
+
143
+ if attributes.key?(:'transaction_id')
144
+ self.transaction_id = attributes[:'transaction_id']
145
+ else
146
+ self.transaction_id = nil
147
+ end
148
+
149
+ if attributes.key?(:'platform')
150
+ self.platform = attributes[:'platform']
151
+ else
152
+ self.platform = nil
153
+ end
154
+
155
+ if attributes.key?(:'type')
156
+ self.type = attributes[:'type']
157
+ end
158
+
159
+ if attributes.key?(:'is_payout')
160
+ self.is_payout = attributes[:'is_payout']
161
+ else
162
+ self.is_payout = nil
163
+ end
164
+
165
+ if attributes.key?(:'status')
166
+ self.status = attributes[:'status']
167
+ end
168
+
169
+ if attributes.key?(:'date')
170
+ self.date = attributes[:'date']
171
+ end
172
+
173
+ if attributes.key?(:'currency')
174
+ self.currency = attributes[:'currency']
175
+ end
176
+
177
+ if attributes.key?(:'amount')
178
+ self.amount = attributes[:'amount']
179
+ end
180
+
181
+ if attributes.key?(:'gross_amount')
182
+ self.gross_amount = attributes[:'gross_amount']
183
+ end
184
+
185
+ if attributes.key?(:'fees')
186
+ self.fees = attributes[:'fees']
187
+ else
188
+ self.fees = nil
189
+ end
190
+
191
+ if attributes.key?(:'payout')
192
+ self.payout = attributes[:'payout']
193
+ else
194
+ self.payout = nil
195
+ end
196
+
197
+ if attributes.key?(:'confirmation_code')
198
+ self.confirmation_code = attributes[:'confirmation_code']
199
+ end
200
+
201
+ if attributes.key?(:'reservation_id')
202
+ self.reservation_id = attributes[:'reservation_id']
203
+ end
204
+
205
+ if attributes.key?(:'listing_id')
206
+ self.listing_id = attributes[:'listing_id']
207
+ end
208
+
209
+ if attributes.key?(:'synced_at')
210
+ self.synced_at = attributes[:'synced_at']
211
+ end
212
+ end
213
+
214
+ # Show invalid properties with the reasons. Usually used together with valid?
215
+ # @return Array for valid properties with the reasons
216
+ def list_invalid_properties
217
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
218
+ invalid_properties = Array.new
219
+ if @is_payout.nil?
220
+ invalid_properties.push('invalid value for "is_payout", is_payout cannot be nil.')
221
+ end
222
+
223
+ if @fees.nil?
224
+ invalid_properties.push('invalid value for "fees", fees cannot be nil.')
225
+ end
226
+
227
+ if @payout.nil?
228
+ invalid_properties.push('invalid value for "payout", payout cannot be nil.')
229
+ end
230
+
231
+ invalid_properties
232
+ end
233
+
234
+ # Check to see if the all the properties in the model are valid
235
+ # @return true if the model is valid
236
+ def valid?
237
+ warn '[DEPRECATED] the `valid?` method is obsolete'
238
+ return false if @is_payout.nil?
239
+ return false if @fees.nil?
240
+ return false if @payout.nil?
241
+ true
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] is_payout Value to be assigned
246
+ def is_payout=(is_payout)
247
+ if is_payout.nil?
248
+ fail ArgumentError, 'is_payout cannot be nil'
249
+ end
250
+
251
+ @is_payout = is_payout
252
+ end
253
+
254
+ # Custom attribute writer method with validation
255
+ # @param [Object] fees Value to be assigned
256
+ def fees=(fees)
257
+ if fees.nil?
258
+ fail ArgumentError, 'fees cannot be nil'
259
+ end
260
+
261
+ @fees = fees
262
+ end
263
+
264
+ # Custom attribute writer method with validation
265
+ # @param [Object] payout Value to be assigned
266
+ def payout=(payout)
267
+ if payout.nil?
268
+ fail ArgumentError, 'payout cannot be nil'
269
+ end
270
+
271
+ @payout = payout
272
+ end
273
+
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] Object to be compared
276
+ def ==(o)
277
+ return true if self.equal?(o)
278
+ self.class == o.class &&
279
+ transaction_id == o.transaction_id &&
280
+ platform == o.platform &&
281
+ type == o.type &&
282
+ is_payout == o.is_payout &&
283
+ status == o.status &&
284
+ date == o.date &&
285
+ currency == o.currency &&
286
+ amount == o.amount &&
287
+ gross_amount == o.gross_amount &&
288
+ fees == o.fees &&
289
+ payout == o.payout &&
290
+ confirmation_code == o.confirmation_code &&
291
+ reservation_id == o.reservation_id &&
292
+ listing_id == o.listing_id &&
293
+ synced_at == o.synced_at
294
+ end
295
+
296
+ # @see the `==` method
297
+ # @param [Object] Object to be compared
298
+ def eql?(o)
299
+ self == o
300
+ end
301
+
302
+ # Calculates hash code according to all attributes.
303
+ # @return [Integer] Hash code
304
+ def hash
305
+ [transaction_id, platform, type, is_payout, status, date, currency, amount, gross_amount, fees, payout, confirmation_code, reservation_id, listing_id, synced_at].hash
306
+ end
307
+
308
+ # Builds the object from hash
309
+ # @param [Hash] attributes Model attributes in the form of hash
310
+ # @return [Object] Returns the model itself
311
+ def self.build_from_hash(attributes)
312
+ return nil unless attributes.is_a?(Hash)
313
+ attributes = attributes.transform_keys(&:to_sym)
314
+ transformed_hash = {}
315
+ openapi_types.each_pair do |key, type|
316
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
317
+ transformed_hash["#{key}"] = nil
318
+ elsif type =~ /\AArray<(.*)>/i
319
+ # check to ensure the input is an array given that the attribute
320
+ # is documented as an array but the input is not
321
+ if attributes[attribute_map[key]].is_a?(Array)
322
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
323
+ end
324
+ elsif !attributes[attribute_map[key]].nil?
325
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
326
+ end
327
+ end
328
+ new(transformed_hash)
329
+ end
330
+
331
+ # Returns the object in the form of hash
332
+ # @return [Hash] Returns the object in the form of hash
333
+ def to_hash
334
+ hash = {}
335
+ self.class.attribute_map.each_pair do |attr, param|
336
+ value = self.send(attr)
337
+ if value.nil?
338
+ is_nullable = self.class.openapi_nullable.include?(attr)
339
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
340
+ end
341
+
342
+ hash[param] = _to_hash(value)
343
+ end
344
+ hash
345
+ end
346
+
347
+ end
348
+
349
+ end