repull 0.2.15 → 0.2.16

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 (126) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/airbnb_api.rb +147 -52
  3. data/lib/repull/api/billing_api.rb +4 -4
  4. data/lib/repull/api/booking_com_api.rb +36 -27
  5. data/lib/repull/api/conversations_api.rb +398 -4
  6. data/lib/repull/api/guests_api.rb +2 -2
  7. data/lib/repull/api/listings_api.rb +4 -4
  8. data/lib/repull/api/reservations_api.rb +157 -6
  9. data/lib/repull/api/webhooks_api.rb +10 -3
  10. data/lib/repull/models/accept_reservation_request200_response.rb +321 -0
  11. data/lib/repull/models/account_created_event.rb +95 -31
  12. data/lib/repull/models/account_disconnected_event.rb +95 -31
  13. data/lib/repull/models/ai_operation_completed_event.rb +95 -31
  14. data/lib/repull/models/ai_operation_failed_event.rb +95 -31
  15. data/lib/repull/models/airbnb_reservation_action200_response.rb +157 -0
  16. data/lib/repull/models/airbnb_reservation_action_request.rb +248 -0
  17. data/lib/repull/models/booking_availability_update.rb +4 -20
  18. data/lib/repull/models/booking_availability_update_date_range.rb +193 -0
  19. data/lib/repull/models/booking_availability_update_request.rb +14 -3
  20. data/lib/repull/models/booking_pricing_rate_update.rb +32 -4
  21. data/lib/repull/models/booking_pricing_rate_update_date_range.rb +3 -0
  22. data/lib/repull/models/booking_pricing_rate_update_restrictions.rb +10 -10
  23. data/lib/repull/models/booking_pricing_response.rb +16 -4
  24. data/lib/repull/models/booking_pricing_update_response.rb +82 -18
  25. data/lib/repull/models/booking_property.rb +107 -36
  26. data/lib/repull/models/booking_property_listings_inner.rb +244 -0
  27. data/lib/repull/models/booking_rate_write_occupancy.rb +187 -0
  28. data/lib/repull/models/booking_rate_write_price_half.rb +188 -0
  29. data/lib/repull/models/booking_rate_write_restriction_half.rb +212 -0
  30. data/lib/repull/models/booking_rate_write_verification.rb +200 -0
  31. data/lib/repull/models/booking_rate_write_verification_row.rb +196 -0
  32. data/lib/repull/models/booking_restriction_request_row.rb +199 -0
  33. data/lib/repull/models/booking_restriction_verification.rb +208 -0
  34. data/lib/repull/models/booking_restriction_verification_row.rb +203 -0
  35. data/lib/repull/models/booking_restriction_verification_row_booking_value.rb +105 -0
  36. data/lib/repull/models/booking_restriction_verification_row_expected.rb +105 -0
  37. data/lib/repull/models/booking_rooms_rates_response.rb +41 -7
  38. data/lib/repull/models/booking_rooms_rates_response_rooms_inner.rb +12 -1
  39. data/lib/repull/models/booking_rooms_rates_response_rooms_inner_rates_inner.rb +1 -0
  40. data/lib/repull/models/booking_upstream_failure.rb +204 -0
  41. data/lib/repull/models/calendar_updated_event.rb +95 -31
  42. data/lib/repull/models/conversation_message_attachment.rb +28 -1
  43. data/lib/repull/models/create_airbnb_offer_request.rb +93 -8
  44. data/lib/repull/models/create_airbnb_offer_request_guest_details.rb +279 -0
  45. data/lib/repull/models/create_conversation_special_offer201_response.rb +293 -0
  46. data/lib/repull/models/create_conversation_special_offer201_response_guests.rb +189 -0
  47. data/lib/repull/models/create_conversation_special_offer_request.rb +263 -0
  48. data/lib/repull/models/create_conversation_special_offer_request_guests.rb +263 -0
  49. data/lib/repull/models/decline_reservation_request_request.rb +234 -0
  50. data/lib/repull/models/get_airbnb_offer200_response.rb +289 -0
  51. data/lib/repull/models/get_usage_summary200_response.rb +10 -1
  52. data/lib/repull/models/get_usage_summary200_response_limits.rb +11 -1
  53. data/lib/repull/models/get_usage_summary200_response_remaining.rb +11 -1
  54. data/lib/repull/models/get_usage_summary200_response_used.rb +10 -1
  55. data/lib/repull/models/get_usage_tier200_response.rb +10 -1
  56. data/lib/repull/models/get_usage_tier200_response_limits.rb +11 -1
  57. data/lib/repull/models/get_usage_tier200_response_remaining.rb +11 -1
  58. data/lib/repull/models/get_usage_tier200_response_used.rb +10 -1
  59. data/lib/repull/models/inquiry_created_event.rb +281 -0
  60. data/lib/repull/models/inquiry_created_payload.rb +185 -0
  61. data/lib/repull/models/inquiry_updated_event.rb +281 -0
  62. data/lib/repull/models/inquiry_updated_payload.rb +213 -0
  63. data/lib/repull/models/inquiry_webhook_object.rb +323 -0
  64. data/lib/repull/models/inquiry_webhook_object_expected_payout.rb +158 -0
  65. data/lib/repull/models/inquiry_webhook_object_guests.rb +188 -0
  66. data/lib/repull/models/list_airbnb_thread_messages200_response.rb +170 -0
  67. data/lib/repull/models/list_airbnb_thread_messages200_response_data_inner.rb +274 -0
  68. data/lib/repull/models/list_airbnb_thread_messages200_response_pagination.rb +158 -0
  69. data/lib/repull/models/list_inquiries200_response.rb +192 -0
  70. data/lib/repull/models/list_inquiries200_response_data_inner.rb +418 -0
  71. data/lib/repull/models/list_inquiries200_response_data_inner_expected_payout.rb +159 -0
  72. data/lib/repull/models/list_inquiries200_response_data_inner_guests.rb +188 -0
  73. data/lib/repull/models/listing_created_event.rb +95 -31
  74. data/lib/repull/models/listing_deleted_event.rb +95 -31
  75. data/lib/repull/models/listing_deleted_payload.rb +55 -21
  76. data/lib/repull/models/listing_reactivated_event.rb +281 -0
  77. data/lib/repull/models/listing_suspended_event.rb +281 -0
  78. data/lib/repull/models/listing_suspension_payload.rb +202 -0
  79. data/lib/repull/models/listing_updated_event.rb +95 -31
  80. data/lib/repull/models/listing_updated_payload.rb +50 -22
  81. data/lib/repull/models/listing_webhook_object.rb +291 -0
  82. data/lib/repull/models/listing_webhook_object_address.rb +168 -0
  83. data/lib/repull/models/listing_webhook_object_channels_inner.rb +184 -0
  84. data/lib/repull/models/message.rb +1 -0
  85. data/lib/repull/models/payment_completed_event.rb +95 -31
  86. data/lib/repull/models/payment_completed_payload.rb +46 -44
  87. data/lib/repull/models/payment_refunded_event.rb +95 -31
  88. data/lib/repull/models/payment_refunded_payload.rb +46 -44
  89. data/lib/repull/models/payment_webhook_object.rb +351 -0
  90. data/lib/repull/models/preapprove_conversation201_response.rb +253 -0
  91. data/lib/repull/models/preapprove_conversation_request.rb +150 -0
  92. data/lib/repull/models/replay_webhook_delivery_request.rb +150 -0
  93. data/lib/repull/models/repull_ping_event.rb +95 -31
  94. data/lib/repull/models/reservation.rb +22 -2
  95. data/lib/repull/models/reservation_alteration_created_event.rb +95 -31
  96. data/lib/repull/models/reservation_alteration_responded_event.rb +95 -31
  97. data/lib/repull/models/reservation_cancelled_event.rb +95 -31
  98. data/lib/repull/models/reservation_created_event.rb +95 -32
  99. data/lib/repull/models/reservation_message_received_event.rb +95 -31
  100. data/lib/repull/models/reservation_message_received_payload.rb +17 -4
  101. data/lib/repull/models/reservation_request_created_event.rb +281 -0
  102. data/lib/repull/models/reservation_request_created_payload.rb +224 -0
  103. data/lib/repull/models/reservation_request_updated_event.rb +281 -0
  104. data/lib/repull/models/reservation_request_updated_payload.rb +251 -0
  105. data/lib/repull/models/reservation_updated_event.rb +95 -31
  106. data/lib/repull/models/review_created_event.rb +95 -31
  107. data/lib/repull/models/review_responded_event.rb +95 -31
  108. data/lib/repull/models/send_airbnb_message201_response.rb +104 -0
  109. data/lib/repull/models/send_airbnb_message_request.rb +4 -20
  110. data/lib/repull/models/send_message_attachment.rb +225 -0
  111. data/lib/repull/models/send_message_part.rb +201 -0
  112. data/lib/repull/models/send_message_request.rb +44 -19
  113. data/lib/repull/models/send_message_response.rb +29 -5
  114. data/lib/repull/models/sent_attachment.rb +196 -0
  115. data/lib/repull/models/usage_quota_warning_event.rb +281 -0
  116. data/lib/repull/models/usage_quota_warning_payload.rb +224 -0
  117. data/lib/repull/models/usage_quota_warning_payload_top_operation.rb +167 -0
  118. data/lib/repull/models/webhook_event.rb +17 -3
  119. data/lib/repull/models/webhook_event_account.rb +171 -0
  120. data/lib/repull/models/webhook_event_type.rb +8 -1
  121. data/lib/repull/models/withdraw_conversation_special_offer200_response.rb +240 -0
  122. data/lib/repull/version.rb +1 -1
  123. data/lib/repull.rb +60 -0
  124. data/openapi/v1.json +19295 -13620
  125. data/scripts/regen.sh +1 -1
  126. metadata +62 -2
@@ -14,18 +14,23 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Repull
17
+ # `message`, `attachments`, or both. Per-channel limits for `attachments`: | Channel | Accepted types | Per file | Per request | Text | |---|---|---|---|---| | Airbnb | JPEG, PNG, GIF, WebP (sent as JPEG), MP4, QuickTime | 10 MB | 5 | optional — each file is sent as its own message, then the text | | Booking.com | JPEG, PNG | 10 MB | 5 | **required** — all files ride on the one text message | | SMS, email, direct-booking site chat | — | — | — | `422 attachments_not_supported`; nothing is sent |
17
18
  class SendMessageRequest < ApiModelBase
18
- # The text to send the guest.
19
+ # The text to send the guest. Required unless `attachments` is present.
19
20
  attr_accessor :message
20
21
 
21
22
  # Force a channel. Omit to send on whichever channel the conversation already uses, which is the right default.
22
23
  attr_accessor :channel
23
24
 
25
+ # Files to send. See the per-channel table above.
26
+ attr_accessor :attachments
27
+
24
28
  # Attribute mapping from ruby-style variable name to JSON key.
25
29
  def self.attribute_map
26
30
  {
27
31
  :'message' => :'message',
28
- :'channel' => :'channel'
32
+ :'channel' => :'channel',
33
+ :'attachments' => :'attachments'
29
34
  }
30
35
  end
31
36
 
@@ -43,7 +48,8 @@ module Repull
43
48
  def self.openapi_types
44
49
  {
45
50
  :'message' => :'String',
46
- :'channel' => :'String'
51
+ :'channel' => :'String',
52
+ :'attachments' => :'Array<SendMessageAttachment>'
47
53
  }
48
54
  end
49
55
 
@@ -71,13 +77,17 @@ module Repull
71
77
 
72
78
  if attributes.key?(:'message')
73
79
  self.message = attributes[:'message']
74
- else
75
- self.message = nil
76
80
  end
77
81
 
78
82
  if attributes.key?(:'channel')
79
83
  self.channel = attributes[:'channel']
80
84
  end
85
+
86
+ if attributes.key?(:'attachments')
87
+ if (value = attributes[:'attachments']).is_a?(Array)
88
+ self.attachments = value
89
+ end
90
+ end
81
91
  end
82
92
 
83
93
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,16 +95,16 @@ module Repull
85
95
  def list_invalid_properties
86
96
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
97
  invalid_properties = Array.new
88
- if @message.nil?
89
- invalid_properties.push('invalid value for "message", message cannot be nil.')
98
+ if !@message.nil? && @message.to_s.length > 4000
99
+ invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 4000.')
90
100
  end
91
101
 
92
- if @message.to_s.length > 4000
93
- invalid_properties.push('invalid value for "message", the character length must be smaller than or equal to 4000.')
102
+ if !@attachments.nil? && @attachments.length > 5
103
+ invalid_properties.push('invalid value for "attachments", number of items must be less than or equal to 5.')
94
104
  end
95
105
 
96
- if @message.to_s.length < 1
97
- invalid_properties.push('invalid value for "message", the character length must be greater than or equal to 1.')
106
+ if !@attachments.nil? && @attachments.length < 1
107
+ invalid_properties.push('invalid value for "attachments", number of items must be greater than or equal to 1.')
98
108
  end
99
109
 
100
110
  invalid_properties
@@ -104,9 +114,9 @@ module Repull
104
114
  # @return true if the model is valid
105
115
  def valid?
106
116
  warn '[DEPRECATED] the `valid?` method is obsolete'
107
- return false if @message.nil?
108
- return false if @message.to_s.length > 4000
109
- return false if @message.to_s.length < 1
117
+ return false if !@message.nil? && @message.to_s.length > 4000
118
+ return false if !@attachments.nil? && @attachments.length > 5
119
+ return false if !@attachments.nil? && @attachments.length < 1
110
120
  true
111
121
  end
112
122
 
@@ -121,11 +131,25 @@ module Repull
121
131
  fail ArgumentError, 'invalid value for "message", the character length must be smaller than or equal to 4000.'
122
132
  end
123
133
 
124
- if message.to_s.length < 1
125
- fail ArgumentError, 'invalid value for "message", the character length must be greater than or equal to 1.'
134
+ @message = message
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] attachments Value to be assigned
139
+ def attachments=(attachments)
140
+ if attachments.nil?
141
+ fail ArgumentError, 'attachments cannot be nil'
126
142
  end
127
143
 
128
- @message = message
144
+ if attachments.length > 5
145
+ fail ArgumentError, 'invalid value for "attachments", number of items must be less than or equal to 5.'
146
+ end
147
+
148
+ if attachments.length < 1
149
+ fail ArgumentError, 'invalid value for "attachments", number of items must be greater than or equal to 1.'
150
+ end
151
+
152
+ @attachments = attachments
129
153
  end
130
154
 
131
155
  # Checks equality by comparing each attribute.
@@ -134,7 +158,8 @@ module Repull
134
158
  return true if self.equal?(o)
135
159
  self.class == o.class &&
136
160
  message == o.message &&
137
- channel == o.channel
161
+ channel == o.channel &&
162
+ attachments == o.attachments
138
163
  end
139
164
 
140
165
  # @see the `==` method
@@ -146,7 +171,7 @@ module Repull
146
171
  # Calculates hash code according to all attributes.
147
172
  # @return [Integer] Hash code
148
173
  def hash
149
- [message, channel].hash
174
+ [message, channel, attachments].hash
150
175
  end
151
176
 
152
177
  # Builds the object from hash
@@ -42,6 +42,12 @@ module Repull
42
42
  # The channel's verbatim note, when it gave one — including the refusal that triggered a rewrite.
43
43
  attr_accessor :status_reason
44
44
 
45
+ # The files delivered, in request order. Empty array for a text-only send.
46
+ attr_accessor :attachments
47
+
48
+ # Present only when `attachments` were sent: one entry per channel message, in delivery order. `id` is the text message (or the last file message when there is no text).
49
+ attr_accessor :parts
50
+
45
51
  # Attribute mapping from ruby-style variable name to JSON key.
46
52
  def self.attribute_map
47
53
  {
@@ -54,7 +60,9 @@ module Repull
54
60
  :'content_rewritten' => :'contentRewritten',
55
61
  :'submitted_content' => :'submittedContent',
56
62
  :'delivered_content' => :'deliveredContent',
57
- :'status_reason' => :'statusReason'
63
+ :'status_reason' => :'statusReason',
64
+ :'attachments' => :'attachments',
65
+ :'parts' => :'parts'
58
66
  }
59
67
  end
60
68
 
@@ -80,7 +88,9 @@ module Repull
80
88
  :'content_rewritten' => :'Boolean',
81
89
  :'submitted_content' => :'String',
82
90
  :'delivered_content' => :'String',
83
- :'status_reason' => :'String'
91
+ :'status_reason' => :'String',
92
+ :'attachments' => :'Array<SentAttachment>',
93
+ :'parts' => :'Array<SendMessagePart>'
84
94
  }
85
95
  end
86
96
 
@@ -92,7 +102,7 @@ module Repull
92
102
  :'channel',
93
103
  :'submitted_content',
94
104
  :'delivered_content',
95
- :'status_reason'
105
+ :'status_reason',
96
106
  ])
97
107
  end
98
108
 
@@ -151,6 +161,18 @@ module Repull
151
161
  if attributes.key?(:'status_reason')
152
162
  self.status_reason = attributes[:'status_reason']
153
163
  end
164
+
165
+ if attributes.key?(:'attachments')
166
+ if (value = attributes[:'attachments']).is_a?(Array)
167
+ self.attachments = value
168
+ end
169
+ end
170
+
171
+ if attributes.key?(:'parts')
172
+ if (value = attributes[:'parts']).is_a?(Array)
173
+ self.parts = value
174
+ end
175
+ end
154
176
  end
155
177
 
156
178
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -182,7 +204,9 @@ module Repull
182
204
  content_rewritten == o.content_rewritten &&
183
205
  submitted_content == o.submitted_content &&
184
206
  delivered_content == o.delivered_content &&
185
- status_reason == o.status_reason
207
+ status_reason == o.status_reason &&
208
+ attachments == o.attachments &&
209
+ parts == o.parts
186
210
  end
187
211
 
188
212
  # @see the `==` method
@@ -194,7 +218,7 @@ module Repull
194
218
  # Calculates hash code according to all attributes.
195
219
  # @return [Integer] Hash code
196
220
  def hash
197
- [id, conversation_id, external_message_id, channel, status, direction, content_rewritten, submitted_content, delivered_content, status_reason].hash
221
+ [id, conversation_id, external_message_id, channel, status, direction, content_rewritten, submitted_content, delivered_content, status_reason, attachments, parts].hash
198
222
  end
199
223
 
200
224
  # Builds the object from hash
@@ -0,0 +1,196 @@
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
+ # A file as delivered.
18
+ class SentAttachment < ApiModelBase
19
+ # Durable stored copy — the same `url` the message's `attachments` will show when read back.
20
+ attr_accessor :url
21
+
22
+ attr_accessor :type
23
+
24
+ # Type read from the file's bytes.
25
+ attr_accessor :content_type
26
+
27
+ attr_accessor :filename
28
+
29
+ attr_accessor :size_bytes
30
+
31
+ # The URL you sent.
32
+ attr_accessor :source_url
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'url' => :'url',
38
+ :'type' => :'type',
39
+ :'content_type' => :'contentType',
40
+ :'filename' => :'filename',
41
+ :'size_bytes' => :'sizeBytes',
42
+ :'source_url' => :'sourceUrl'
43
+ }
44
+ end
45
+
46
+ # Returns attribute mapping this model knows about
47
+ def self.acceptable_attribute_map
48
+ attribute_map
49
+ end
50
+
51
+ # Returns all the JSON keys this model knows about
52
+ def self.acceptable_attributes
53
+ acceptable_attribute_map.values
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.openapi_types
58
+ {
59
+ :'url' => :'String',
60
+ :'type' => :'String',
61
+ :'content_type' => :'String',
62
+ :'filename' => :'String',
63
+ :'size_bytes' => :'Integer',
64
+ :'source_url' => :'String'
65
+ }
66
+ end
67
+
68
+ # List of attributes with nullable: true
69
+ def self.openapi_nullable
70
+ Set.new([
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::SentAttachment` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ acceptable_attribute_map = self.class.acceptable_attribute_map
83
+ attributes = attributes.each_with_object({}) { |(k, v), h|
84
+ if (!acceptable_attribute_map.key?(k.to_sym))
85
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::SentAttachment`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
86
+ end
87
+ h[k.to_sym] = v
88
+ }
89
+
90
+ if attributes.key?(:'url')
91
+ self.url = attributes[:'url']
92
+ end
93
+
94
+ if attributes.key?(:'type')
95
+ self.type = attributes[:'type']
96
+ end
97
+
98
+ if attributes.key?(:'content_type')
99
+ self.content_type = attributes[:'content_type']
100
+ end
101
+
102
+ if attributes.key?(:'filename')
103
+ self.filename = attributes[:'filename']
104
+ end
105
+
106
+ if attributes.key?(:'size_bytes')
107
+ self.size_bytes = attributes[:'size_bytes']
108
+ end
109
+
110
+ if attributes.key?(:'source_url')
111
+ self.source_url = attributes[:'source_url']
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
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ true
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
+ url == o.url &&
136
+ type == o.type &&
137
+ content_type == o.content_type &&
138
+ filename == o.filename &&
139
+ size_bytes == o.size_bytes &&
140
+ source_url == o.source_url
141
+ end
142
+
143
+ # @see the `==` method
144
+ # @param [Object] Object to be compared
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculates hash code according to all attributes.
150
+ # @return [Integer] Hash code
151
+ def hash
152
+ [url, type, content_type, filename, size_bytes, source_url].hash
153
+ end
154
+
155
+ # Builds the object from hash
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ # @return [Object] Returns the model itself
158
+ def self.build_from_hash(attributes)
159
+ return nil unless attributes.is_a?(Hash)
160
+ attributes = attributes.transform_keys(&:to_sym)
161
+ transformed_hash = {}
162
+ openapi_types.each_pair do |key, type|
163
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
164
+ transformed_hash["#{key}"] = nil
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[attribute_map[key]].is_a?(Array)
169
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
170
+ end
171
+ elsif !attributes[attribute_map[key]].nil?
172
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
173
+ end
174
+ end
175
+ new(transformed_hash)
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ end
195
+
196
+ end