ultracart_api 3.6.3 → 3.6.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ace3ac7494f41008bbfb58ab99e39470a18b242db80a2685f506664cf77daad
4
- data.tar.gz: 43d244077f8d17b57c0914c25be5506e56a5b035de63a0f8c5a940cb48b839f0
3
+ metadata.gz: 75947a7eeb0b2069a99895e6ad75b336ffdd3b6bdb772529681f9b8d426ac87b
4
+ data.tar.gz: c25acf93d768b26f631907b80d427dcfd08dfd1cf3c4b67e16dc5b40f3e888f0
5
5
  SHA512:
6
- metadata.gz: 336807f227f0ecd13136a3082f892eb74e5c7e42ab5b253067d41a98fe8e985125c2962494f7c1d6af062b8a520509a6a277c8b07512871e5c865f6a51cc68f2
7
- data.tar.gz: 4d8ef9244c6648f7b8152f1698e93dc3705b6465988ca940cefe9ff7fe1e2ec8ccc3779f19d4b9c24238579896defb74b1449c77a312a5b7dba2b853f0403515
6
+ metadata.gz: eb721e73723780a5d077ba5c927893b91157e80b8a27fdb601b52353f6581b1013da797e9b62917d0a9739bf65daba050bec4fdf87c07418d0f540cc7139233f
7
+ data.tar.gz: 1166427bec5e43271bca12093994d7c333f0934bc98ef22ec917e3c6710f5c386b2e4fcb219b6d2896d4164b7f3e043a293ccf72e0dfcc27573b98adad380a59
data/README.md CHANGED
@@ -7,7 +7,7 @@ UltraCart REST API Version 2
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 3.6.3
10
+ - Package version: 3.6.4
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [http://www.ultracart.com](http://www.ultracart.com)
13
13
 
@@ -24,15 +24,15 @@ gem build ultracart_api.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./ultracart_api-3.6.3.gem
27
+ gem install ./ultracart_api-3.6.4.gem
28
28
  ```
29
- (for development, run `gem install --dev ./ultracart_api-3.6.3.gem` to install the development dependencies)
29
+ (for development, run `gem install --dev ./ultracart_api-3.6.4.gem` to install the development dependencies)
30
30
 
31
31
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32
32
 
33
33
  Finally add this to the Gemfile:
34
34
 
35
- gem 'ultracart_api', '~> 3.6.3'
35
+ gem 'ultracart_api', '~> 3.6.4'
36
36
 
37
37
  ### Install from Git
38
38
 
@@ -874,6 +874,7 @@ Class | Method | HTTP request | Description
874
874
  - [UltracartClient::OrderPaymentCheck](docs/OrderPaymentCheck.md)
875
875
  - [UltracartClient::OrderPaymentCreditCard](docs/OrderPaymentCreditCard.md)
876
876
  - [UltracartClient::OrderPaymentECheck](docs/OrderPaymentECheck.md)
877
+ - [UltracartClient::OrderPaymentInsurance](docs/OrderPaymentInsurance.md)
877
878
  - [UltracartClient::OrderPaymentPurchaseOrder](docs/OrderPaymentPurchaseOrder.md)
878
879
  - [UltracartClient::OrderPaymentTransaction](docs/OrderPaymentTransaction.md)
879
880
  - [UltracartClient::OrderPaymentTransactionDetail](docs/OrderPaymentTransactionDetail.md)
@@ -905,6 +906,7 @@ Class | Method | HTTP request | Description
905
906
  - [UltracartClient::PaymentsConfigurationCreditCard](docs/PaymentsConfigurationCreditCard.md)
906
907
  - [UltracartClient::PaymentsConfigurationCreditCardType](docs/PaymentsConfigurationCreditCardType.md)
907
908
  - [UltracartClient::PaymentsConfigurationEcheck](docs/PaymentsConfigurationEcheck.md)
909
+ - [UltracartClient::PaymentsConfigurationInsurance](docs/PaymentsConfigurationInsurance.md)
908
910
  - [UltracartClient::PaymentsConfigurationLoanHero](docs/PaymentsConfigurationLoanHero.md)
909
911
  - [UltracartClient::PaymentsConfigurationMoneyOrder](docs/PaymentsConfigurationMoneyOrder.md)
910
912
  - [UltracartClient::PaymentsConfigurationPayPal](docs/PaymentsConfigurationPayPal.md)
@@ -1116,6 +1118,7 @@ Not every change is committed to every SDK.
1116
1118
 
1117
1119
  | Version | Date | Comments |
1118
1120
  | --: | :-: | --- |
1121
+ | 3.6.4 | 08/24/2021 | configuration api - new payment method named insurance |
1119
1122
  | 3.6.1 | 08/23/2021 | configuration api - enum problems, also added order.item.tracking_number to support line item tracking numbers |
1120
1123
  | 3.6.0 | 08/19/2021 | coupon api - changed tieredAmountOffItem to support mulitple items |
1121
1124
  | 3.5.3 | 08/18/2021 | configuration api - added credit card rate to UltraCart Payments object |
data/docs/OrderPayment.md CHANGED
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
7
7
  **credit_card** | [**OrderPaymentCreditCard**](OrderPaymentCreditCard.md) | | [optional]
8
8
  **echeck** | [**OrderPaymentECheck**](OrderPaymentECheck.md) | | [optional]
9
9
  **hold_for_fraud_review** | **BOOLEAN** | True if order has been held for fraud review | [optional]
10
+ **insurance** | [**OrderPaymentInsurance**](OrderPaymentInsurance.md) | | [optional]
10
11
  **payment_dts** | **String** | Date/time that the payment was successfully processed, for new orders, this field is only considered if channel_partner.skip_payment_processing is true | [optional]
11
12
  **payment_method** | **String** | Payment method | [optional]
12
13
  **payment_method_accounting_code** | **String** | Payment method QuickBooks code | [optional]
@@ -0,0 +1,9 @@
1
+ # UltracartClient::OrderPaymentInsurance
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **application_id** | **String** | application id | [optional]
7
+ **claim_id** | **String** | claim id | [optional]
8
+
9
+
@@ -10,6 +10,7 @@ Name | Type | Description | Notes
10
10
  **cod** | [**PaymentsConfigurationCOD**](PaymentsConfigurationCOD.md) | | [optional]
11
11
  **credit_card** | [**PaymentsConfigurationCreditCard**](PaymentsConfigurationCreditCard.md) | | [optional]
12
12
  **echeck** | [**PaymentsConfigurationEcheck**](PaymentsConfigurationEcheck.md) | | [optional]
13
+ **insurance** | [**PaymentsConfigurationInsurance**](PaymentsConfigurationInsurance.md) | | [optional]
13
14
  **loan_hero** | [**PaymentsConfigurationLoanHero**](PaymentsConfigurationLoanHero.md) | | [optional]
14
15
  **money_order** | [**PaymentsConfigurationMoneyOrder**](PaymentsConfigurationMoneyOrder.md) | | [optional]
15
16
  **paypal** | [**PaymentsConfigurationPayPal**](PaymentsConfigurationPayPal.md) | | [optional]
@@ -0,0 +1,9 @@
1
+ # UltracartClient::PaymentsConfigurationInsurance
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **accept_insurance** | **BOOLEAN** | Master flag indicating this merchant accepts insurance | [optional]
7
+ **restrictions** | [**PaymentsConfigurationRestrictions**](PaymentsConfigurationRestrictions.md) | | [optional]
8
+
9
+
@@ -6,18 +6,25 @@ Name | Type | Description | Notes
6
6
  **affiliate_email** | **String** | | [optional]
7
7
  **affiliate_id** | **Integer** | | [optional]
8
8
  **communications_campaign_name** | **String** | | [optional]
9
+ **communications_campaign_name_filter** | **BOOLEAN** | | [optional]
9
10
  **communications_email_subject** | **String** | | [optional]
11
+ **communications_email_subject_filter** | **BOOLEAN** | | [optional]
10
12
  **communications_flow_name** | **String** | | [optional]
13
+ **communications_flow_name_filter** | **BOOLEAN** | | [optional]
11
14
  **email** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
12
15
  **email_domain** | **String** | | [optional]
16
+ **email_domain_filter** | **BOOLEAN** | | [optional]
13
17
  **email_identified** | **BOOLEAN** | | [optional]
14
18
  **end_timestamp** | [**ScreenRecordingFilterRangeDate**](ScreenRecordingFilterRangeDate.md) | | [optional]
15
19
  **esp_customer_uuid** | **String** | | [optional]
16
20
  **favorite** | **BOOLEAN** | | [optional]
17
21
  **geolocation** | [**ScreenRecordingFilterGeoDistance**](ScreenRecordingFilterGeoDistance.md) | | [optional]
18
22
  **geolocation_country** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
23
+ **geolocation_country_filter** | **BOOLEAN** | | [optional]
19
24
  **geolocation_state** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
25
+ **geolocation_state_filter** | **BOOLEAN** | | [optional]
20
26
  **language_iso_code** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
27
+ **language_iso_code_filter** | **BOOLEAN** | | [optional]
21
28
  **last_x_days** | **Integer** | | [optional]
22
29
  **max_filter_values** | **Integer** | | [optional]
23
30
  **order_id** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
@@ -25,23 +32,35 @@ Name | Type | Description | Notes
25
32
  **page_views** | [**Array<ScreenRecordingFilterPageView>**](ScreenRecordingFilterPageView.md) | | [optional]
26
33
  **placed_order** | **BOOLEAN** | | [optional]
27
34
  **preferred_language** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
35
+ **preferred_language_filter** | **BOOLEAN** | | [optional]
28
36
  **referrer_domain** | **String** | | [optional]
29
- **return_filter_values** | **Array<String>** | | [optional]
37
+ **referrer_domain_filter** | **BOOLEAN** | | [optional]
30
38
  **screen_recording_uuids** | **Array<String>** | | [optional]
31
39
  **screen_sizes** | **Array<String>** | | [optional]
32
40
  **skip_filter_values** | **BOOLEAN** | | [optional]
41
+ **skip_histogram** | **BOOLEAN** | | [optional]
33
42
  **skip_hits** | **BOOLEAN** | | [optional]
34
43
  **start_timestamp** | [**ScreenRecordingFilterRangeDate**](ScreenRecordingFilterRangeDate.md) | | [optional]
35
44
  **tags** | **Array<String>** | | [optional]
36
45
  **time_on_site** | [**ScreenRecordingFilterRangeInteger**](ScreenRecordingFilterRangeInteger.md) | | [optional]
46
+ **time_on_site_max_filter** | **BOOLEAN** | | [optional]
47
+ **time_on_site_min_filter** | **BOOLEAN** | | [optional]
48
+ **url_filter** | **BOOLEAN** | | [optional]
37
49
  **user_agent_device_name** | **String** | | [optional]
50
+ **user_agent_device_name_filter** | **BOOLEAN** | | [optional]
51
+ **user_agent_device_os_name_filter** | **BOOLEAN** | | [optional]
52
+ **user_agent_device_os_version_filter** | **BOOLEAN** | | [optional]
38
53
  **user_agent_name** | **String** | | [optional]
54
+ **user_agent_name_filter** | **BOOLEAN** | | [optional]
39
55
  **user_agent_original** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
56
+ **user_agent_original_filter** | **BOOLEAN** | | [optional]
40
57
  **user_agent_os_name** | **String** | | [optional]
41
58
  **user_agent_os_version** | **String** | | [optional]
42
59
  **user_ip** | [**ScreenRecordingFilterIpSearch**](ScreenRecordingFilterIpSearch.md) | | [optional]
43
60
  **utm_campaign** | **String** | | [optional]
61
+ **utm_campaign_filter** | **BOOLEAN** | | [optional]
44
62
  **utm_source** | **String** | | [optional]
63
+ **utm_source_filter** | **BOOLEAN** | | [optional]
45
64
  **visitor_number** | **Integer** | | [optional]
46
65
  **watched** | **BOOLEAN** | | [optional]
47
66
 
@@ -4,13 +4,21 @@
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
6
  **domain** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
7
+ **domain_filter** | **BOOLEAN** | | [optional]
8
+ **event_name_filter** | **BOOLEAN** | | [optional]
9
+ **event_param_name_filter** | **BOOLEAN** | | [optional]
10
+ **event_param_value_filter** | **BOOLEAN** | | [optional]
7
11
  **events** | [**Array<ScreenRecordingFilterPageViewEvent>**](ScreenRecordingFilterPageViewEvent.md) | | [optional]
12
+ **param_name_filter** | **BOOLEAN** | | [optional]
13
+ **param_value_filter** | **BOOLEAN** | | [optional]
8
14
  **params** | [**Array<ScreenRecordingFilterPageViewParam>**](ScreenRecordingFilterPageViewParam.md) | | [optional]
9
15
  **referrer** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
10
16
  **referrer_params** | [**Array<ScreenRecordingFilterPageViewReferrerParam>**](ScreenRecordingFilterPageViewReferrerParam.md) | | [optional]
11
17
  **referrer_raw** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
12
- **return_filter_values** | **Array<String>** | | [optional]
13
18
  **time_on_page** | [**ScreenRecordingFilterRangeInteger**](ScreenRecordingFilterRangeInteger.md) | | [optional]
19
+ **time_on_page_max_filter** | **BOOLEAN** | | [optional]
20
+ **time_on_page_min_filter** | **BOOLEAN** | | [optional]
14
21
  **url** | [**ScreenRecordingFilterStringSearch**](ScreenRecordingFilterStringSearch.md) | | [optional]
22
+ **url_filter** | **BOOLEAN** | | [optional]
15
23
 
16
24
 
@@ -23,6 +23,8 @@ module UltracartClient
23
23
  # True if order has been held for fraud review
24
24
  attr_accessor :hold_for_fraud_review
25
25
 
26
+ attr_accessor :insurance
27
+
26
28
  # Date/time that the payment was successfully processed, for new orders, this field is only considered if channel_partner.skip_payment_processing is true
27
29
  attr_accessor :payment_dts
28
30
 
@@ -89,6 +91,7 @@ module UltracartClient
89
91
  :'credit_card' => :'credit_card',
90
92
  :'echeck' => :'echeck',
91
93
  :'hold_for_fraud_review' => :'hold_for_fraud_review',
94
+ :'insurance' => :'insurance',
92
95
  :'payment_dts' => :'payment_dts',
93
96
  :'payment_method' => :'payment_method',
94
97
  :'payment_method_accounting_code' => :'payment_method_accounting_code',
@@ -112,6 +115,7 @@ module UltracartClient
112
115
  :'credit_card' => :'OrderPaymentCreditCard',
113
116
  :'echeck' => :'OrderPaymentECheck',
114
117
  :'hold_for_fraud_review' => :'BOOLEAN',
118
+ :'insurance' => :'OrderPaymentInsurance',
115
119
  :'payment_dts' => :'String',
116
120
  :'payment_method' => :'String',
117
121
  :'payment_method_accounting_code' => :'String',
@@ -152,6 +156,10 @@ module UltracartClient
152
156
  self.hold_for_fraud_review = attributes[:'hold_for_fraud_review']
153
157
  end
154
158
 
159
+ if attributes.has_key?(:'insurance')
160
+ self.insurance = attributes[:'insurance']
161
+ end
162
+
155
163
  if attributes.has_key?(:'payment_dts')
156
164
  self.payment_dts = attributes[:'payment_dts']
157
165
  end
@@ -217,7 +225,7 @@ module UltracartClient
217
225
  # Check to see if the all the properties in the model are valid
218
226
  # @return true if the model is valid
219
227
  def valid?
220
- payment_method_validator = EnumAttributeValidator.new('String', ['Affirm', 'Amazon', 'Amazon SC', 'Cash', 'Check', 'COD', 'Credit Card', 'eBay', 'eCheck', 'LoanHero', 'Money Order', 'PayPal', 'Purchase Order', 'Quote Request', 'Unknown', 'Wire Transfer', 'Walmart'])
228
+ payment_method_validator = EnumAttributeValidator.new('String', ['Affirm', 'Amazon', 'Amazon SC', 'Cash', 'Check', 'COD', 'Credit Card', 'eBay', 'eCheck', 'Insurance', 'LoanHero', 'Money Order', 'PayPal', 'Purchase Order', 'Quote Request', 'Unknown', 'Wire Transfer', 'Walmart'])
221
229
  return false unless payment_method_validator.valid?(@payment_method)
222
230
  payment_status_validator = EnumAttributeValidator.new('String', ['Unprocessed', 'Authorized', 'Capture Failed', 'Processed', 'Declined', 'Voided', 'Refunded', 'Skipped'])
223
231
  return false unless payment_status_validator.valid?(@payment_status)
@@ -227,7 +235,7 @@ module UltracartClient
227
235
  # Custom attribute writer method checking allowed values (enum).
228
236
  # @param [Object] payment_method Object to be assigned
229
237
  def payment_method=(payment_method)
230
- validator = EnumAttributeValidator.new('String', ['Affirm', 'Amazon', 'Amazon SC', 'Cash', 'Check', 'COD', 'Credit Card', 'eBay', 'eCheck', 'LoanHero', 'Money Order', 'PayPal', 'Purchase Order', 'Quote Request', 'Unknown', 'Wire Transfer', 'Walmart'])
238
+ validator = EnumAttributeValidator.new('String', ['Affirm', 'Amazon', 'Amazon SC', 'Cash', 'Check', 'COD', 'Credit Card', 'eBay', 'eCheck', 'Insurance', 'LoanHero', 'Money Order', 'PayPal', 'Purchase Order', 'Quote Request', 'Unknown', 'Wire Transfer', 'Walmart'])
231
239
  unless validator.valid?(payment_method)
232
240
  fail ArgumentError, 'invalid value for "payment_method", must be one of #{validator.allowable_values}.'
233
241
  end
@@ -253,6 +261,7 @@ module UltracartClient
253
261
  credit_card == o.credit_card &&
254
262
  echeck == o.echeck &&
255
263
  hold_for_fraud_review == o.hold_for_fraud_review &&
264
+ insurance == o.insurance &&
256
265
  payment_dts == o.payment_dts &&
257
266
  payment_method == o.payment_method &&
258
267
  payment_method_accounting_code == o.payment_method_accounting_code &&
@@ -277,7 +286,7 @@ module UltracartClient
277
286
  # Calculates hash code according to all attributes.
278
287
  # @return [Fixnum] Hash code
279
288
  def hash
280
- [check, credit_card, echeck, hold_for_fraud_review, payment_dts, payment_method, payment_method_accounting_code, payment_method_deposit_to_account, payment_status, purchase_order, rotating_transaction_gateway_code, surcharge, surcharge_accounting_code, surcharge_transaction_fee, surcharge_transaction_percentage, test_order, transactions].hash
289
+ [check, credit_card, echeck, hold_for_fraud_review, insurance, payment_dts, payment_method, payment_method_accounting_code, payment_method_deposit_to_account, payment_status, purchase_order, rotating_transaction_gateway_code, surcharge, surcharge_accounting_code, surcharge_transaction_fee, surcharge_transaction_percentage, test_order, transactions].hash
281
290
  end
282
291
 
283
292
  # Builds the object from hash
@@ -0,0 +1,195 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class OrderPaymentInsurance
17
+ # application id
18
+ attr_accessor :application_id
19
+
20
+ # claim id
21
+ attr_accessor :claim_id
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'application_id' => :'application_id',
27
+ :'claim_id' => :'claim_id'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'application_id' => :'String',
35
+ :'claim_id' => :'String'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
46
+
47
+ if attributes.has_key?(:'application_id')
48
+ self.application_id = attributes[:'application_id']
49
+ end
50
+
51
+ if attributes.has_key?(:'claim_id')
52
+ self.claim_id = attributes[:'claim_id']
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ application_id == o.application_id &&
75
+ claim_id == o.claim_id
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [application_id, claim_id].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = UltracartClient.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+
194
+ end
195
+ end