repull 0.2.24 → 0.2.25

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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/repull/api/connect_api.rb +617 -0
  3. data/lib/repull/api/connections_api.rb +312 -0
  4. data/lib/repull/api/conversations_api.rb +151 -18
  5. data/lib/repull/api/health_api.rb +5 -5
  6. data/lib/repull/api/listings_api.rb +67 -4
  7. data/lib/repull/api/reviews_api.rb +2 -2
  8. data/lib/repull/models/apply_connection_mappings200_response.rb +167 -0
  9. data/lib/repull/models/apply_connection_mappings200_response_results_inner.rb +184 -0
  10. data/lib/repull/models/apply_connection_mappings_request.rb +175 -0
  11. data/lib/repull/models/apply_connection_mappings_request_mappings_inner.rb +193 -0
  12. data/lib/repull/models/auto_map_connection_units200_response.rb +176 -0
  13. data/lib/repull/models/auto_map_connection_units_request.rb +156 -0
  14. data/lib/repull/models/channel_market_state_item.rb +15 -4
  15. data/lib/repull/models/connect_status.rb +25 -5
  16. data/lib/repull/models/connect_status_accounts_inner.rb +71 -4
  17. data/lib/repull/models/conversation_capabilities.rb +260 -0
  18. data/lib/repull/models/conversation_detail.rb +14 -5
  19. data/lib/repull/models/create_connect_session_request.rb +23 -1
  20. data/lib/repull/models/create_conversation_special_offer201_response.rb +127 -4
  21. data/lib/repull/models/create_conversation_special_offer201_response_fees_inner.rb +166 -0
  22. data/lib/repull/models/create_conversation_special_offer201_response_lines_inner.rb +157 -0
  23. data/lib/repull/models/create_conversation_special_offer_request.rb +91 -52
  24. data/lib/repull/models/create_conversation_special_offer_request_fees_inner.rb +199 -0
  25. data/lib/repull/models/get_booking_extranet_login_config200_response.rb +147 -0
  26. data/lib/repull/models/get_booking_extranet_login_status200_response.rb +192 -0
  27. data/lib/repull/models/get_channel_health200_response.rb +190 -0
  28. data/lib/repull/models/get_channel_health200_response_vrbo.rb +197 -0
  29. data/lib/repull/models/get_connect_write_policy200_response.rb +166 -0
  30. data/lib/repull/models/get_listing_calendar_sync200_response.rb +192 -0
  31. data/lib/repull/models/get_listing_calendar_sync200_response_channels_inner.rb +331 -0
  32. data/lib/repull/models/get_listing_calendar_sync200_response_channels_inner_problems_inner.rb +157 -0
  33. data/lib/repull/models/get_listing_calendar_sync200_response_channels_inner_queue.rb +212 -0
  34. data/lib/repull/models/get_listing_calendar_sync200_response_channels_inner_queue_last_push.rb +268 -0
  35. data/lib/repull/models/invite_booking_extranet_user200_response.rb +174 -0
  36. data/lib/repull/models/invite_booking_extranet_user_request.rb +173 -0
  37. data/lib/repull/models/list_connection_units200_response.rb +242 -0
  38. data/lib/repull/models/list_connection_units200_response_listing_options_inner.rb +165 -0
  39. data/lib/repull/models/list_connection_units200_response_units_inner.rb +194 -0
  40. data/lib/repull/models/listing_publish_status_connection.rb +34 -1
  41. data/lib/repull/models/pms_write_policy.rb +191 -0
  42. data/lib/repull/models/pms_write_policy_calendar.rb +219 -0
  43. data/lib/repull/models/pms_write_policy_reservations.rb +219 -0
  44. data/lib/repull/models/preapprove_conversation201_response.rb +47 -6
  45. data/lib/repull/models/preapprove_conversation_request.rb +34 -5
  46. data/lib/repull/models/preview_conversation_special_offer_request.rb +231 -0
  47. data/lib/repull/models/preview_conversation_special_offer_request_fees_inner.rb +199 -0
  48. data/lib/repull/models/preview_conversation_special_offer_request_guests.rb +250 -0
  49. data/lib/repull/models/reply_to_review_request.rb +33 -4
  50. data/lib/repull/models/search_connect_session_listing_options200_response.rb +158 -0
  51. data/lib/repull/models/search_connect_session_listing_options200_response_data_inner.rb +166 -0
  52. data/lib/repull/models/search_connection_listing_options200_response.rb +159 -0
  53. data/lib/repull/models/send_message_request.rb +1 -1
  54. data/lib/repull/models/start_booking_extranet_login200_response.rb +174 -0
  55. data/lib/repull/models/start_booking_extranet_login_request.rb +225 -0
  56. data/lib/repull/models/submit_cloudbeds_credentials200_response.rb +10 -1
  57. data/lib/repull/models/submit_cloudbeds_credentials_request.rb +11 -1
  58. data/lib/repull/models/submit_mews_credentials200_response.rb +10 -1
  59. data/lib/repull/models/submit_mews_credentials_request.rb +11 -1
  60. data/lib/repull/models/update_connect_write_policy_request.rb +157 -0
  61. data/lib/repull/models/update_connect_write_policy_request_calendar.rb +165 -0
  62. data/lib/repull/models/update_connect_write_policy_request_reservations.rb +165 -0
  63. data/lib/repull/models/vrbo_import_status.rb +249 -0
  64. data/lib/repull/models/vrbo_login200_response.rb +235 -0
  65. data/lib/repull/models/vrbo_login_request.rb +271 -0
  66. data/lib/repull/models/withdraw_conversation_preapproval200_response.rb +226 -0
  67. data/lib/repull/models/withdraw_conversation_special_offer200_response.rb +29 -1
  68. data/lib/repull/version.rb +1 -1
  69. data/lib/repull.rb +44 -0
  70. data/openapi/v1.json +4693 -2114
  71. data/scripts/regen.sh +1 -1
  72. metadata +46 -2
@@ -0,0 +1,231 @@
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
+
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
+ # Any of the offer fields; only what is sent is changed.
18
+ class PreviewConversationSpecialOfferRequest < ApiModelBase
19
+ attr_accessor :check_in
20
+
21
+ attr_accessor :check_out
22
+
23
+ attr_accessor :guests
24
+
25
+ # Rent for the stay, excluding fees and taxes.
26
+ attr_accessor :rental_amount
27
+
28
+ attr_accessor :fees
29
+
30
+ attr_accessor :damage_deposit
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'check_in' => :'checkIn',
36
+ :'check_out' => :'checkOut',
37
+ :'guests' => :'guests',
38
+ :'rental_amount' => :'rentalAmount',
39
+ :'fees' => :'fees',
40
+ :'damage_deposit' => :'damageDeposit'
41
+ }
42
+ end
43
+
44
+ # Returns attribute mapping this model knows about
45
+ def self.acceptable_attribute_map
46
+ attribute_map
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ acceptable_attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'check_in' => :'Date',
58
+ :'check_out' => :'Date',
59
+ :'guests' => :'PreviewConversationSpecialOfferRequestGuests',
60
+ :'rental_amount' => :'Float',
61
+ :'fees' => :'Array<PreviewConversationSpecialOfferRequestFeesInner>',
62
+ :'damage_deposit' => :'Float'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ :'damage_deposit'
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PreviewConversationSpecialOfferRequest` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ acceptable_attribute_map = self.class.acceptable_attribute_map
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!acceptable_attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PreviewConversationSpecialOfferRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'check_in')
90
+ self.check_in = attributes[:'check_in']
91
+ end
92
+
93
+ if attributes.key?(:'check_out')
94
+ self.check_out = attributes[:'check_out']
95
+ end
96
+
97
+ if attributes.key?(:'guests')
98
+ self.guests = attributes[:'guests']
99
+ end
100
+
101
+ if attributes.key?(:'rental_amount')
102
+ self.rental_amount = attributes[:'rental_amount']
103
+ end
104
+
105
+ if attributes.key?(:'fees')
106
+ if (value = attributes[:'fees']).is_a?(Array)
107
+ self.fees = value
108
+ end
109
+ end
110
+
111
+ if attributes.key?(:'damage_deposit')
112
+ self.damage_deposit = attributes[:'damage_deposit']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
120
+ invalid_properties = Array.new
121
+ if !@rental_amount.nil? && @rental_amount <= 0
122
+ invalid_properties.push('invalid value for "rental_amount", must be greater than 0.')
123
+ end
124
+
125
+ if !@damage_deposit.nil? && @damage_deposit < 0
126
+ invalid_properties.push('invalid value for "damage_deposit", must be greater than or equal to 0.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if !@rental_amount.nil? && @rental_amount <= 0
137
+ return false if !@damage_deposit.nil? && @damage_deposit < 0
138
+ true
139
+ end
140
+
141
+ # Custom attribute writer method with validation
142
+ # @param [Object] rental_amount Value to be assigned
143
+ def rental_amount=(rental_amount)
144
+ if rental_amount.nil?
145
+ fail ArgumentError, 'rental_amount cannot be nil'
146
+ end
147
+
148
+ if rental_amount <= 0
149
+ fail ArgumentError, 'invalid value for "rental_amount", must be greater than 0.'
150
+ end
151
+
152
+ @rental_amount = rental_amount
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] damage_deposit Value to be assigned
157
+ def damage_deposit=(damage_deposit)
158
+ if !damage_deposit.nil? && damage_deposit < 0
159
+ fail ArgumentError, 'invalid value for "damage_deposit", must be greater than or equal to 0.'
160
+ end
161
+
162
+ @damage_deposit = damage_deposit
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ check_in == o.check_in &&
171
+ check_out == o.check_out &&
172
+ guests == o.guests &&
173
+ rental_amount == o.rental_amount &&
174
+ fees == o.fees &&
175
+ damage_deposit == o.damage_deposit
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [check_in, check_out, guests, rental_amount, fees, damage_deposit].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ transformed_hash = {}
197
+ openapi_types.each_pair do |key, type|
198
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
199
+ transformed_hash["#{key}"] = nil
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[attribute_map[key]].is_a?(Array)
204
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
205
+ end
206
+ elsif !attributes[attribute_map[key]].nil?
207
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
208
+ end
209
+ end
210
+ new(transformed_hash)
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,199 @@
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
+
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 PreviewConversationSpecialOfferRequestFeesInner < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :value
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'type' => :'type',
26
+ :'value' => :'value'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'type' => :'String',
44
+ :'value' => :'Float'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::PreviewConversationSpecialOfferRequestFeesInner` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ acceptable_attribute_map = self.class.acceptable_attribute_map
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!acceptable_attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::PreviewConversationSpecialOfferRequestFeesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'type')
71
+ self.type = attributes[:'type']
72
+ else
73
+ self.type = nil
74
+ end
75
+
76
+ if attributes.key?(:'value')
77
+ self.value = attributes[:'value']
78
+ else
79
+ self.value = nil
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
+ invalid_properties = Array.new
88
+ if @type.nil?
89
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
90
+ end
91
+
92
+ if @value.nil?
93
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
94
+ end
95
+
96
+ if @value < 0
97
+ invalid_properties.push('invalid value for "value", must be greater than or equal to 0.')
98
+ end
99
+
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ warn '[DEPRECATED] the `valid?` method is obsolete'
107
+ return false if @type.nil?
108
+ return false if @value.nil?
109
+ return false if @value < 0
110
+ true
111
+ end
112
+
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] type Value to be assigned
115
+ def type=(type)
116
+ if type.nil?
117
+ fail ArgumentError, 'type cannot be nil'
118
+ end
119
+
120
+ @type = type
121
+ end
122
+
123
+ # Custom attribute writer method with validation
124
+ # @param [Object] value Value to be assigned
125
+ def value=(value)
126
+ if value.nil?
127
+ fail ArgumentError, 'value cannot be nil'
128
+ end
129
+
130
+ if value < 0
131
+ fail ArgumentError, 'invalid value for "value", must be greater than or equal to 0.'
132
+ end
133
+
134
+ @value = value
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ type == o.type &&
143
+ value == o.value
144
+ end
145
+
146
+ # @see the `==` method
147
+ # @param [Object] Object to be compared
148
+ def eql?(o)
149
+ self == o
150
+ end
151
+
152
+ # Calculates hash code according to all attributes.
153
+ # @return [Integer] Hash code
154
+ def hash
155
+ [type, value].hash
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def self.build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ attributes = attributes.transform_keys(&:to_sym)
164
+ transformed_hash = {}
165
+ openapi_types.each_pair do |key, type|
166
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
167
+ transformed_hash["#{key}"] = nil
168
+ elsif type =~ /\AArray<(.*)>/i
169
+ # check to ensure the input is an array given that the attribute
170
+ # is documented as an array but the input is not
171
+ if attributes[attribute_map[key]].is_a?(Array)
172
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
173
+ end
174
+ elsif !attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
176
+ end
177
+ end
178
+ new(transformed_hash)
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ end
198
+
199
+ end