ultracart_api 4.1.91 → 4.1.94

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -2
  3. data/docs/AutoOrderApi.md +52 -0
  4. data/docs/AutoOrderCancelReason.md +22 -0
  5. data/docs/AutoOrderCancelReasonsResponse.md +26 -0
  6. data/docs/FraudApi.md +278 -0
  7. data/docs/FraudDeclineEmailRequest.md +18 -0
  8. data/docs/FraudLookupValues.md +28 -0
  9. data/docs/FraudLookupValuesResponse.md +26 -0
  10. data/docs/FraudRuleInsertRequest.md +76 -0
  11. data/docs/FraudRuleItemFilter.md +20 -0
  12. data/docs/FraudRulePublic.md +90 -0
  13. data/docs/FraudRuleResponse.md +26 -0
  14. data/docs/FraudRuleRotatingTransactionGatewayFilter.md +20 -0
  15. data/docs/FraudRuleSearchRequest.md +78 -0
  16. data/docs/FraudRuleStorefrontFilter.md +20 -0
  17. data/docs/FraudRulesResponse.md +26 -0
  18. data/docs/ItemVariantItem.md +2 -0
  19. data/lib/ultracart_api/api/auto_order_api.rb +58 -0
  20. data/lib/ultracart_api/api/fraud_api.rb +373 -0
  21. data/lib/ultracart_api/models/auto_order_cancel_reason.rb +240 -0
  22. data/lib/ultracart_api/models/auto_order_cancel_reasons_response.rb +259 -0
  23. data/lib/ultracart_api/models/fraud_decline_email_request.rb +220 -0
  24. data/lib/ultracart_api/models/fraud_lookup_values.rb +270 -0
  25. data/lib/ultracart_api/models/fraud_lookup_values_response.rb +256 -0
  26. data/lib/ultracart_api/models/fraud_rule_insert_request.rb +583 -0
  27. data/lib/ultracart_api/models/fraud_rule_item_filter.rb +245 -0
  28. data/lib/ultracart_api/models/fraud_rule_public.rb +652 -0
  29. data/lib/ultracart_api/models/fraud_rule_response.rb +256 -0
  30. data/lib/ultracart_api/models/fraud_rule_rotating_transaction_gateway_filter.rb +230 -0
  31. data/lib/ultracart_api/models/fraud_rule_search_request.rb +572 -0
  32. data/lib/ultracart_api/models/fraud_rule_storefront_filter.rb +245 -0
  33. data/lib/ultracart_api/models/fraud_rules_response.rb +259 -0
  34. data/lib/ultracart_api/models/item_variant_item.rb +11 -1
  35. data/lib/ultracart_api/version.rb +1 -1
  36. data/lib/ultracart_api.rb +14 -0
  37. metadata +30 -2
@@ -0,0 +1,373 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module UltracartClient
16
+ class FraudApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
24
+ api_config = Configuration.new
25
+ api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
26
+ api_config.api_version = '2017-03-01'
27
+ api_config.verify_ssl = verify_ssl
28
+
29
+ api_client = ApiClient.new(api_config)
30
+ api_client.config.debugging = debugging
31
+
32
+ UltracartClient::FraudApi.new(api_client)
33
+ end
34
+
35
+ # Decline emails during checkout fraud review
36
+ # Adds one or more email addresses to the fraud decline list for this merchant account.
37
+ # @param fraud_decline_emails_request [FraudDeclineEmailRequest] Fraud decline emails request
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [nil]
40
+ def decline_email(fraud_decline_emails_request, opts = {})
41
+ decline_email_with_http_info(fraud_decline_emails_request, opts)
42
+ nil
43
+ end
44
+
45
+ # Decline emails during checkout fraud review
46
+ # Adds one or more email addresses to the fraud decline list for this merchant account.
47
+ # @param fraud_decline_emails_request [FraudDeclineEmailRequest] Fraud decline emails request
48
+ # @param [Hash] opts the optional parameters
49
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
50
+ def decline_email_with_http_info(fraud_decline_emails_request, opts = {})
51
+ if @api_client.config.debugging
52
+ @api_client.config.logger.debug 'Calling API: FraudApi.decline_email ...'
53
+ end
54
+ # verify the required parameter 'fraud_decline_emails_request' is set
55
+ if @api_client.config.client_side_validation && fraud_decline_emails_request.nil?
56
+ fail ArgumentError, "Missing the required parameter 'fraud_decline_emails_request' when calling FraudApi.decline_email"
57
+ end
58
+ # resource path
59
+ local_var_path = '/fraud/decline_email'
60
+
61
+ # query parameters
62
+ query_params = opts[:query_params] || {}
63
+
64
+ # header parameters
65
+ header_params = opts[:header_params] || {}
66
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
67
+ # HTTP header 'Accept' (if needed)
68
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
69
+ # HTTP header 'Content-Type'
70
+ content_type = @api_client.select_header_content_type(['application/json'])
71
+ if !content_type.nil?
72
+ header_params['Content-Type'] = content_type
73
+ end
74
+
75
+ # form parameters
76
+ form_params = opts[:form_params] || {}
77
+
78
+ # http body (model)
79
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_decline_emails_request)
80
+
81
+ # return_type
82
+ return_type = opts[:debug_return_type]
83
+
84
+ # auth_names
85
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
86
+
87
+ new_options = opts.merge(
88
+ :operation => :"FraudApi.decline_email",
89
+ :header_params => header_params,
90
+ :query_params => query_params,
91
+ :form_params => form_params,
92
+ :body => post_body,
93
+ :auth_names => auth_names,
94
+ :return_type => return_type
95
+ )
96
+
97
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "API called: FraudApi#decline_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
100
+ end
101
+ return data, status_code, headers
102
+ end
103
+
104
+ # Delete a fraud rule
105
+ # Deletes a fraud rule for this merchant account.
106
+ # @param fraud_rule_oid [Integer]
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [nil]
109
+ def delete_fraud_rule(fraud_rule_oid, opts = {})
110
+ delete_fraud_rule_with_http_info(fraud_rule_oid, opts)
111
+ nil
112
+ end
113
+
114
+ # Delete a fraud rule
115
+ # Deletes a fraud rule for this merchant account.
116
+ # @param fraud_rule_oid [Integer]
117
+ # @param [Hash] opts the optional parameters
118
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
119
+ def delete_fraud_rule_with_http_info(fraud_rule_oid, opts = {})
120
+ if @api_client.config.debugging
121
+ @api_client.config.logger.debug 'Calling API: FraudApi.delete_fraud_rule ...'
122
+ end
123
+ # verify the required parameter 'fraud_rule_oid' is set
124
+ if @api_client.config.client_side_validation && fraud_rule_oid.nil?
125
+ fail ArgumentError, "Missing the required parameter 'fraud_rule_oid' when calling FraudApi.delete_fraud_rule"
126
+ end
127
+ # resource path
128
+ local_var_path = '/fraud/rules/{fraud_rule_oid}'.sub('{' + 'fraud_rule_oid' + '}', CGI.escape(fraud_rule_oid.to_s))
129
+
130
+ # query parameters
131
+ query_params = opts[:query_params] || {}
132
+
133
+ # header parameters
134
+ header_params = opts[:header_params] || {}
135
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
136
+ # HTTP header 'Accept' (if needed)
137
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
138
+
139
+ # form parameters
140
+ form_params = opts[:form_params] || {}
141
+
142
+ # http body (model)
143
+ post_body = opts[:debug_body]
144
+
145
+ # return_type
146
+ return_type = opts[:debug_return_type]
147
+
148
+ # auth_names
149
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
150
+
151
+ new_options = opts.merge(
152
+ :operation => :"FraudApi.delete_fraud_rule",
153
+ :header_params => header_params,
154
+ :query_params => query_params,
155
+ :form_params => form_params,
156
+ :body => post_body,
157
+ :auth_names => auth_names,
158
+ :return_type => return_type
159
+ )
160
+
161
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
162
+ if @api_client.config.debugging
163
+ @api_client.config.logger.debug "API called: FraudApi#delete_fraud_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
164
+ end
165
+ return data, status_code, headers
166
+ end
167
+
168
+ # Retrieve fraud rule lookup values
169
+ # Returns the dropdown values required to build valid fraud rule insert and search requests. Includes rule types, failure actions, user actions, IP range types, AVS match types, the merchant's rotating transaction gateways, screen branding themes, countries, and affiliates.
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [FraudLookupValuesResponse]
172
+ def get_fraud_lookup_values(opts = {})
173
+ data, _status_code, _headers = get_fraud_lookup_values_with_http_info(opts)
174
+ data
175
+ end
176
+
177
+ # Retrieve fraud rule lookup values
178
+ # Returns the dropdown values required to build valid fraud rule insert and search requests. Includes rule types, failure actions, user actions, IP range types, AVS match types, the merchant&#39;s rotating transaction gateways, screen branding themes, countries, and affiliates.
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [Array<(FraudLookupValuesResponse, Integer, Hash)>] FraudLookupValuesResponse data, response status code and response headers
181
+ def get_fraud_lookup_values_with_http_info(opts = {})
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug 'Calling API: FraudApi.get_fraud_lookup_values ...'
184
+ end
185
+ # resource path
186
+ local_var_path = '/fraud/lookup_values'
187
+
188
+ # query parameters
189
+ query_params = opts[:query_params] || {}
190
+
191
+ # header parameters
192
+ header_params = opts[:header_params] || {}
193
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
194
+ # HTTP header 'Accept' (if needed)
195
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:debug_body]
202
+
203
+ # return_type
204
+ return_type = opts[:debug_return_type] || 'FraudLookupValuesResponse'
205
+
206
+ # auth_names
207
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
208
+
209
+ new_options = opts.merge(
210
+ :operation => :"FraudApi.get_fraud_lookup_values",
211
+ :header_params => header_params,
212
+ :query_params => query_params,
213
+ :form_params => form_params,
214
+ :body => post_body,
215
+ :auth_names => auth_names,
216
+ :return_type => return_type
217
+ )
218
+
219
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug "API called: FraudApi#get_fraud_lookup_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
222
+ end
223
+ return data, status_code, headers
224
+ end
225
+
226
+ # Insert a fraud rule
227
+ # Creates a fraud rule for this merchant account. Field names in the request body are semantic (eg amount_threshold, email, ip_address). Call GET /v2/fraud/lookup_values for the list of valid rule_type, failure_action, and related dropdown values. The 'credit card matches' rule type is not supported via REST.
228
+ # @param fraud_rule_insert_request [FraudRuleInsertRequest] Fraud rule insert request
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [FraudRuleResponse]
231
+ def insert_fraud_rule(fraud_rule_insert_request, opts = {})
232
+ data, _status_code, _headers = insert_fraud_rule_with_http_info(fraud_rule_insert_request, opts)
233
+ data
234
+ end
235
+
236
+ # Insert a fraud rule
237
+ # Creates a fraud rule for this merchant account. Field names in the request body are semantic (eg amount_threshold, email, ip_address). Call GET /v2/fraud/lookup_values for the list of valid rule_type, failure_action, and related dropdown values. The &#39;credit card matches&#39; rule type is not supported via REST.
238
+ # @param fraud_rule_insert_request [FraudRuleInsertRequest] Fraud rule insert request
239
+ # @param [Hash] opts the optional parameters
240
+ # @return [Array<(FraudRuleResponse, Integer, Hash)>] FraudRuleResponse data, response status code and response headers
241
+ def insert_fraud_rule_with_http_info(fraud_rule_insert_request, opts = {})
242
+ if @api_client.config.debugging
243
+ @api_client.config.logger.debug 'Calling API: FraudApi.insert_fraud_rule ...'
244
+ end
245
+ # verify the required parameter 'fraud_rule_insert_request' is set
246
+ if @api_client.config.client_side_validation && fraud_rule_insert_request.nil?
247
+ fail ArgumentError, "Missing the required parameter 'fraud_rule_insert_request' when calling FraudApi.insert_fraud_rule"
248
+ end
249
+ # resource path
250
+ local_var_path = '/fraud/rules'
251
+
252
+ # query parameters
253
+ query_params = opts[:query_params] || {}
254
+
255
+ # header parameters
256
+ header_params = opts[:header_params] || {}
257
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
258
+ # HTTP header 'Accept' (if needed)
259
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
260
+ # HTTP header 'Content-Type'
261
+ content_type = @api_client.select_header_content_type(['application/json'])
262
+ if !content_type.nil?
263
+ header_params['Content-Type'] = content_type
264
+ end
265
+
266
+ # form parameters
267
+ form_params = opts[:form_params] || {}
268
+
269
+ # http body (model)
270
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_rule_insert_request)
271
+
272
+ # return_type
273
+ return_type = opts[:debug_return_type] || 'FraudRuleResponse'
274
+
275
+ # auth_names
276
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
277
+
278
+ new_options = opts.merge(
279
+ :operation => :"FraudApi.insert_fraud_rule",
280
+ :header_params => header_params,
281
+ :query_params => query_params,
282
+ :form_params => form_params,
283
+ :body => post_body,
284
+ :auth_names => auth_names,
285
+ :return_type => return_type
286
+ )
287
+
288
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
289
+ if @api_client.config.debugging
290
+ @api_client.config.logger.debug "API called: FraudApi#insert_fraud_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
291
+ end
292
+ return data, status_code, headers
293
+ end
294
+
295
+ # Search fraud rules
296
+ # Searches fraud rules for this merchant account using semantic filter fields. Pagination and sort are passed as query parameters (_limit, _offset, _sort). You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. Results are capped at 10,000 records by ElasticSearch and the warning slot indicates when that cap was hit. Use more selective filters in that case.
297
+ # @param fraud_rule_search_request [FraudRuleSearchRequest] Fraud rule search request
298
+ # @param [Hash] opts the optional parameters
299
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Maximum 200) (default to 100)
300
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
301
+ # @option opts [String] :_sort The sort order of the fraud rules. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
302
+ # @return [FraudRulesResponse]
303
+ def search_fraud_rules(fraud_rule_search_request, opts = {})
304
+ data, _status_code, _headers = search_fraud_rules_with_http_info(fraud_rule_search_request, opts)
305
+ data
306
+ end
307
+
308
+ # Search fraud rules
309
+ # Searches fraud rules for this merchant account using semantic filter fields. Pagination and sort are passed as query parameters (_limit, _offset, _sort). You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. Results are capped at 10,000 records by ElasticSearch and the warning slot indicates when that cap was hit. Use more selective filters in that case.
310
+ # @param fraud_rule_search_request [FraudRuleSearchRequest] Fraud rule search request
311
+ # @param [Hash] opts the optional parameters
312
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Maximum 200) (default to 100)
313
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
314
+ # @option opts [String] :_sort The sort order of the fraud rules. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
315
+ # @return [Array<(FraudRulesResponse, Integer, Hash)>] FraudRulesResponse data, response status code and response headers
316
+ def search_fraud_rules_with_http_info(fraud_rule_search_request, opts = {})
317
+ if @api_client.config.debugging
318
+ @api_client.config.logger.debug 'Calling API: FraudApi.search_fraud_rules ...'
319
+ end
320
+ # verify the required parameter 'fraud_rule_search_request' is set
321
+ if @api_client.config.client_side_validation && fraud_rule_search_request.nil?
322
+ fail ArgumentError, "Missing the required parameter 'fraud_rule_search_request' when calling FraudApi.search_fraud_rules"
323
+ end
324
+ # resource path
325
+ local_var_path = '/fraud/rules/search'
326
+
327
+ # query parameters
328
+ query_params = opts[:query_params] || {}
329
+ query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
330
+ query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
331
+ query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
332
+
333
+ # header parameters
334
+ header_params = opts[:header_params] || {}
335
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
336
+ # HTTP header 'Accept' (if needed)
337
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
338
+ # HTTP header 'Content-Type'
339
+ content_type = @api_client.select_header_content_type(['application/json'])
340
+ if !content_type.nil?
341
+ header_params['Content-Type'] = content_type
342
+ end
343
+
344
+ # form parameters
345
+ form_params = opts[:form_params] || {}
346
+
347
+ # http body (model)
348
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_rule_search_request)
349
+
350
+ # return_type
351
+ return_type = opts[:debug_return_type] || 'FraudRulesResponse'
352
+
353
+ # auth_names
354
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
355
+
356
+ new_options = opts.merge(
357
+ :operation => :"FraudApi.search_fraud_rules",
358
+ :header_params => header_params,
359
+ :query_params => query_params,
360
+ :form_params => form_params,
361
+ :body => post_body,
362
+ :auth_names => auth_names,
363
+ :return_type => return_type
364
+ )
365
+
366
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
367
+ if @api_client.config.debugging
368
+ @api_client.config.logger.debug "API called: FraudApi#search_fraud_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
369
+ end
370
+ return data, status_code, headers
371
+ end
372
+ end
373
+ end
@@ -0,0 +1,240 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class AutoOrderCancelReason
18
+ # MyAccount alternate description
19
+ attr_accessor :myaccount_alternate_description
20
+
21
+ # Auto order cancel reason
22
+ attr_accessor :reason
23
+
24
+ # Visible in MyAccount
25
+ attr_accessor :visible_in_myaccount
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'myaccount_alternate_description' => :'myaccount_alternate_description',
31
+ :'reason' => :'reason',
32
+ :'visible_in_myaccount' => :'visible_in_myaccount'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'myaccount_alternate_description' => :'String',
45
+ :'reason' => :'String',
46
+ :'visible_in_myaccount' => :'Boolean'
47
+ }
48
+ end
49
+
50
+ # List of attributes with nullable: true
51
+ def self.openapi_nullable
52
+ Set.new([
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AutoOrderCancelReason` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AutoOrderCancelReason`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'myaccount_alternate_description')
72
+ self.myaccount_alternate_description = attributes[:'myaccount_alternate_description']
73
+ end
74
+
75
+ if attributes.key?(:'reason')
76
+ self.reason = attributes[:'reason']
77
+ end
78
+
79
+ if attributes.key?(:'visible_in_myaccount')
80
+ self.visible_in_myaccount = attributes[:'visible_in_myaccount']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ myaccount_alternate_description == o.myaccount_alternate_description &&
103
+ reason == o.reason &&
104
+ visible_in_myaccount == o.visible_in_myaccount
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Integer] Hash code
115
+ def hash
116
+ [myaccount_alternate_description, reason, visible_in_myaccount].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def self.build_from_hash(attributes)
123
+ new.build_from_hash(attributes)
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ attributes = attributes.transform_keys(&:to_sym)
132
+ self.class.openapi_types.each_pair do |key, type|
133
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
134
+ self.send("#{key}=", nil)
135
+ elsif type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :Time
156
+ Time.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :Boolean
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ # models (e.g. Pet) or oneOf
187
+ klass = UltracartClient.const_get(type)
188
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ if value.nil?
211
+ is_nullable = self.class.openapi_nullable.include?(attr)
212
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
213
+ end
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ # Outputs non-array value in the form of hash
221
+ # For object, use to_hash. Otherwise, just return the value
222
+ # @param [Object] value Any valid value
223
+ # @return [Hash] Returns the value in the form of hash
224
+ def _to_hash(value)
225
+ if value.is_a?(Array)
226
+ value.compact.map { |v| _to_hash(v) }
227
+ elsif value.is_a?(Hash)
228
+ {}.tap do |hash|
229
+ value.each { |k, v| hash[k] = _to_hash(v) }
230
+ end
231
+ elsif value.respond_to? :to_hash
232
+ value.to_hash
233
+ else
234
+ value
235
+ end
236
+ end
237
+
238
+ end
239
+
240
+ end