repull 0.2.30 → 0.2.32

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +2 -2
  3. data/lib/repull/api/billing_api.rb +68 -9
  4. data/lib/repull/api/booking_com_api.rb +80 -0
  5. data/lib/repull/api/connect_api.rb +139 -0
  6. data/lib/repull/api/conversations_api.rb +5 -2
  7. data/lib/repull/api/health_api.rb +2 -2
  8. data/lib/repull/api/hotels_api.rb +142 -0
  9. data/lib/repull/api/transactions_api.rb +109 -0
  10. data/lib/repull/api/workspaces_api.rb +96 -0
  11. data/lib/repull/configuration.rb +0 -4
  12. data/lib/repull/models/availability_batch_write_request.rb +30 -1
  13. data/lib/repull/models/availability_write_request.rb +30 -1
  14. data/lib/repull/models/availability_write_settings.rb +33 -4
  15. data/lib/repull/models/connect_provider.rb +2 -2
  16. data/lib/repull/models/connect_session.rb +12 -2
  17. data/lib/repull/models/create_billing_checkout200_response.rb +156 -0
  18. data/lib/repull/models/create_billing_checkout_request.rb +2 -2
  19. data/lib/repull/models/create_connect_session_request.rb +13 -1
  20. data/lib/repull/models/create_connect_session_request_workspace.rb +1 -1
  21. data/lib/repull/models/get_billing200_response.rb +183 -0
  22. data/lib/repull/models/get_billing200_response_limits.rb +160 -0
  23. data/lib/repull/models/get_billing200_response_used.rb +156 -0
  24. data/lib/repull/models/get_channel_health200_response_vrbo.rb +11 -1
  25. data/lib/repull/models/get_hotel200_response.rb +252 -0
  26. data/lib/repull/models/get_hotel200_response_room_types_inner.rb +168 -0
  27. data/lib/repull/models/get_usage_summary200_response.rb +10 -1
  28. data/lib/repull/models/get_usage_summary200_response_credits.rb +186 -0
  29. data/lib/repull/models/list_booking_transactions200_response.rb +158 -0
  30. data/lib/repull/models/list_hotels200_response.rb +158 -0
  31. data/lib/repull/models/list_hotels200_response_data_inner.rb +241 -0
  32. data/lib/repull/models/list_workspaces200_response.rb +158 -0
  33. data/lib/repull/models/listing.rb +50 -1
  34. data/lib/repull/models/listing_hotel.rb +202 -0
  35. data/lib/repull/models/record_account.rb +15 -5
  36. data/lib/repull/models/reservation.rb +45 -1
  37. data/lib/repull/models/reservation_message_received_payload.rb +12 -1
  38. data/lib/repull/models/reservation_message_sent_payload.rb +12 -1
  39. data/lib/repull/models/reservation_message_updated_payload.rb +12 -1
  40. data/lib/repull/models/reservation_webhook_object.rb +49 -5
  41. data/lib/repull/models/select_provider_response.rb +1 -1
  42. data/lib/repull/models/transaction.rb +349 -0
  43. data/lib/repull/models/transaction_fees.rb +176 -0
  44. data/lib/repull/models/transaction_payout.rb +198 -0
  45. data/lib/repull/models/workspace.rb +265 -0
  46. data/lib/repull/version.rb +1 -1
  47. data/lib/repull.rb +19 -0
  48. data/openapi/v1.json +1008 -18
  49. metadata +21 -2
@@ -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
@@ -0,0 +1,176 @@
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 TransactionFees < ApiModelBase
18
+ # Channel commission deducted.
19
+ attr_accessor :commission
20
+
21
+ # Payments service fee deducted.
22
+ attr_accessor :service_fee
23
+
24
+ attr_accessor :processing_fee
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'commission' => :'commission',
30
+ :'service_fee' => :'serviceFee',
31
+ :'processing_fee' => :'processingFee'
32
+ }
33
+ end
34
+
35
+ # Returns attribute mapping this model knows about
36
+ def self.acceptable_attribute_map
37
+ attribute_map
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ acceptable_attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'commission' => :'Float',
49
+ :'service_fee' => :'Float',
50
+ :'processing_fee' => :'Float'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ :'commission',
58
+ :'service_fee',
59
+ :'processing_fee'
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::TransactionFees` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ acceptable_attribute_map = self.class.acceptable_attribute_map
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!acceptable_attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::TransactionFees`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'commission')
80
+ self.commission = attributes[:'commission']
81
+ else
82
+ self.commission = nil
83
+ end
84
+
85
+ if attributes.key?(:'service_fee')
86
+ self.service_fee = attributes[:'service_fee']
87
+ else
88
+ self.service_fee = nil
89
+ end
90
+
91
+ if attributes.key?(:'processing_fee')
92
+ self.processing_fee = attributes[:'processing_fee']
93
+ else
94
+ self.processing_fee = nil
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
102
+ invalid_properties = Array.new
103
+ invalid_properties
104
+ end
105
+
106
+ # Check to see if the all the properties in the model are valid
107
+ # @return true if the model is valid
108
+ def valid?
109
+ warn '[DEPRECATED] the `valid?` method is obsolete'
110
+ true
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ commission == o.commission &&
119
+ service_fee == o.service_fee &&
120
+ processing_fee == o.processing_fee
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [commission, service_fee, processing_fee].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ if value.nil?
165
+ is_nullable = self.class.openapi_nullable.include?(attr)
166
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
167
+ end
168
+
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ end
175
+
176
+ end