ultracart_api 3.10.14 → 3.10.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -97
  3. data/docs/ChannelPartnerApi.md +51 -0
  4. data/docs/{DelayAutoOrdersResponse.md → ChannelPartnerEstimateTaxResponse.md} +2 -2
  5. data/lib/ultracart_api/api/channel_partner_api.rb +55 -0
  6. data/lib/ultracart_api/models/{stripe_connect_response.rb → channel_partner_estimate_tax_response.rb} +8 -8
  7. data/lib/ultracart_api/version.rb +1 -1
  8. data/lib/ultracart_api.rb +1 -39
  9. metadata +4 -80
  10. data/docs/ConfigurationApi.md +0 -756
  11. data/docs/PaymentsConfiguration.md +0 -24
  12. data/docs/PaymentsConfigurationAffirm.md +0 -15
  13. data/docs/PaymentsConfigurationAmazon.md +0 -15
  14. data/docs/PaymentsConfigurationCOD.md +0 -13
  15. data/docs/PaymentsConfigurationCash.md +0 -9
  16. data/docs/PaymentsConfigurationCheck.md +0 -19
  17. data/docs/PaymentsConfigurationCreditCard.md +0 -17
  18. data/docs/PaymentsConfigurationCreditCardType.md +0 -18
  19. data/docs/PaymentsConfigurationEcheck.md +0 -12
  20. data/docs/PaymentsConfigurationInsurance.md +0 -9
  21. data/docs/PaymentsConfigurationLoanHero.md +0 -12
  22. data/docs/PaymentsConfigurationMoneyOrder.md +0 -11
  23. data/docs/PaymentsConfigurationPayPal.md +0 -36
  24. data/docs/PaymentsConfigurationPurchaseOrder.md +0 -11
  25. data/docs/PaymentsConfigurationQuoteRequest.md +0 -10
  26. data/docs/PaymentsConfigurationResponse.md +0 -12
  27. data/docs/PaymentsConfigurationRestrictions.md +0 -21
  28. data/docs/PaymentsConfigurationRestrictionsTheme.md +0 -10
  29. data/docs/PaymentsConfigurationSezzle.md +0 -15
  30. data/docs/PaymentsConfigurationTestMethod.md +0 -18
  31. data/docs/PaymentsConfigurationWePay.md +0 -35
  32. data/docs/PaymentsConfigurationWireTransfer.md +0 -18
  33. data/docs/PaymentsThemeTransactionType.md +0 -10
  34. data/docs/PaymentsWepayEnroll.md +0 -22
  35. data/docs/RotatingTransactionGateway.md +0 -51
  36. data/docs/RotatingTransactionGatewayResponse.md +0 -12
  37. data/docs/RotatingTransactionGatewaysResponse.md +0 -12
  38. data/docs/RtgCurrency.md +0 -10
  39. data/docs/RtgDayOfMonthRestriction.md +0 -9
  40. data/docs/RtgDayOfWeekRestriction.md +0 -10
  41. data/docs/RtgSummaryGateway.md +0 -24
  42. data/docs/RtgSummaryResponse.md +0 -14
  43. data/docs/RtgThemeRestriction.md +0 -10
  44. data/docs/StripeConnectResponse.md +0 -12
  45. data/docs/TransactionGateway.md +0 -71
  46. data/docs/TransactionGatewaysRequest.md +0 -10
  47. data/docs/TransactionGatewaysResponse.md +0 -12
  48. data/lib/ultracart_api/api/configuration_api.rb +0 -843
  49. data/lib/ultracart_api/models/delay_auto_orders_response.rb +0 -221
  50. data/lib/ultracart_api/models/payments_configuration.rb +0 -329
  51. data/lib/ultracart_api/models/payments_configuration_affirm.rb +0 -288
  52. data/lib/ultracart_api/models/payments_configuration_amazon.rb +0 -288
  53. data/lib/ultracart_api/models/payments_configuration_cash.rb +0 -194
  54. data/lib/ultracart_api/models/payments_configuration_check.rb +0 -294
  55. data/lib/ultracart_api/models/payments_configuration_cod.rb +0 -234
  56. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +0 -279
  57. data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +0 -318
  58. data/lib/ultracart_api/models/payments_configuration_echeck.rb +0 -226
  59. data/lib/ultracart_api/models/payments_configuration_insurance.rb +0 -194
  60. data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +0 -224
  61. data/lib/ultracart_api/models/payments_configuration_money_order.rb +0 -214
  62. data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +0 -534
  63. data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +0 -214
  64. data/lib/ultracart_api/models/payments_configuration_quote_request.rb +0 -204
  65. data/lib/ultracart_api/models/payments_configuration_response.rb +0 -221
  66. data/lib/ultracart_api/models/payments_configuration_restrictions.rb +0 -447
  67. data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +0 -202
  68. data/lib/ultracart_api/models/payments_configuration_sezzle.rb +0 -288
  69. data/lib/ultracart_api/models/payments_configuration_test_method.rb +0 -319
  70. data/lib/ultracart_api/models/payments_configuration_we_pay.rb +0 -454
  71. data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +0 -284
  72. data/lib/ultracart_api/models/payments_theme_transaction_type.rb +0 -239
  73. data/lib/ultracart_api/models/payments_wepay_enroll.rb +0 -310
  74. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +0 -675
  75. data/lib/ultracart_api/models/rotating_transaction_gateway_response.rb +0 -221
  76. data/lib/ultracart_api/models/rotating_transaction_gateways_response.rb +0 -223
  77. data/lib/ultracart_api/models/rtg_currency.rb +0 -205
  78. data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +0 -195
  79. data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +0 -205
  80. data/lib/ultracart_api/models/rtg_summary_gateway.rb +0 -329
  81. data/lib/ultracart_api/models/rtg_summary_response.rb +0 -240
  82. data/lib/ultracart_api/models/rtg_theme_restriction.rb +0 -239
  83. data/lib/ultracart_api/models/transaction_gateway.rb +0 -823
  84. data/lib/ultracart_api/models/transaction_gateways_request.rb +0 -242
  85. data/lib/ultracart_api/models/transaction_gateways_response.rb +0 -223
@@ -1,194 +0,0 @@
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 PaymentsConfigurationInsurance
17
- # Master flag indicating this merchant accepts insurance
18
- attr_accessor :accept_insurance
19
-
20
- attr_accessor :restrictions
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'accept_insurance' => :'accept_insurance',
26
- :'restrictions' => :'restrictions'
27
- }
28
- end
29
-
30
- # Attribute type mapping.
31
- def self.swagger_types
32
- {
33
- :'accept_insurance' => :'BOOLEAN',
34
- :'restrictions' => :'PaymentsConfigurationRestrictions'
35
- }
36
- end
37
-
38
- # Initializes the object
39
- # @param [Hash] attributes Model attributes in the form of hash
40
- def initialize(attributes = {})
41
- return unless attributes.is_a?(Hash)
42
-
43
- # convert string to symbol for hash key
44
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
-
46
- if attributes.has_key?(:'accept_insurance')
47
- self.accept_insurance = attributes[:'accept_insurance']
48
- end
49
-
50
- if attributes.has_key?(:'restrictions')
51
- self.restrictions = attributes[:'restrictions']
52
- end
53
- end
54
-
55
- # Show invalid properties with the reasons. Usually used together with valid?
56
- # @return Array for valid properties with the reasons
57
- def list_invalid_properties
58
- invalid_properties = Array.new
59
- invalid_properties
60
- end
61
-
62
- # Check to see if the all the properties in the model are valid
63
- # @return true if the model is valid
64
- def valid?
65
- true
66
- end
67
-
68
- # Checks equality by comparing each attribute.
69
- # @param [Object] Object to be compared
70
- def ==(o)
71
- return true if self.equal?(o)
72
- self.class == o.class &&
73
- accept_insurance == o.accept_insurance &&
74
- restrictions == o.restrictions
75
- end
76
-
77
- # @see the `==` method
78
- # @param [Object] Object to be compared
79
- def eql?(o)
80
- self == o
81
- end
82
-
83
- # Calculates hash code according to all attributes.
84
- # @return [Fixnum] Hash code
85
- def hash
86
- [accept_insurance, restrictions].hash
87
- end
88
-
89
- # Builds the object from hash
90
- # @param [Hash] attributes Model attributes in the form of hash
91
- # @return [Object] Returns the model itself
92
- def build_from_hash(attributes)
93
- return nil unless attributes.is_a?(Hash)
94
- self.class.swagger_types.each_pair do |key, type|
95
- if type =~ /\AArray<(.*)>/i
96
- # check to ensure the input is an array given that the attribute
97
- # is documented as an array but the input is not
98
- if attributes[self.class.attribute_map[key]].is_a?(Array)
99
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
100
- end
101
- elsif !attributes[self.class.attribute_map[key]].nil?
102
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
103
- end # or else data not found in attributes(hash), not an issue as the data can be optional
104
- end
105
-
106
- self
107
- end
108
-
109
- # Deserializes the data based on type
110
- # @param string type Data type
111
- # @param string value Value to be deserialized
112
- # @return [Object] Deserialized data
113
- def _deserialize(type, value)
114
- case type.to_sym
115
- when :DateTime
116
- DateTime.parse(value)
117
- when :Date
118
- Date.parse(value)
119
- when :String
120
- value.to_s
121
- when :Integer
122
- value.to_i
123
- when :Float
124
- value.to_f
125
- when :BOOLEAN
126
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
127
- true
128
- else
129
- false
130
- end
131
- when :Object
132
- # generic object (usually a Hash), return directly
133
- value
134
- when /\AArray<(?<inner_type>.+)>\z/
135
- inner_type = Regexp.last_match[:inner_type]
136
- value.map { |v| _deserialize(inner_type, v) }
137
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
138
- k_type = Regexp.last_match[:k_type]
139
- v_type = Regexp.last_match[:v_type]
140
- {}.tap do |hash|
141
- value.each do |k, v|
142
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
- end
144
- end
145
- else # model
146
- temp_model = UltracartClient.const_get(type).new
147
- temp_model.build_from_hash(value)
148
- end
149
- end
150
-
151
- # Returns the string representation of the object
152
- # @return [String] String presentation of the object
153
- def to_s
154
- to_hash.to_s
155
- end
156
-
157
- # to_body is an alias to to_hash (backward compatibility)
158
- # @return [Hash] Returns the object in the form of hash
159
- def to_body
160
- to_hash
161
- end
162
-
163
- # Returns the object in the form of hash
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_hash
166
- hash = {}
167
- self.class.attribute_map.each_pair do |attr, param|
168
- value = self.send(attr)
169
- next if value.nil?
170
- hash[param] = _to_hash(value)
171
- end
172
- hash
173
- end
174
-
175
- # Outputs non-array value in the form of hash
176
- # For object, use to_hash. Otherwise, just return the value
177
- # @param [Object] value Any valid value
178
- # @return [Hash] Returns the value in the form of hash
179
- def _to_hash(value)
180
- if value.is_a?(Array)
181
- value.compact.map { |v| _to_hash(v) }
182
- elsif value.is_a?(Hash)
183
- {}.tap do |hash|
184
- value.each { |k, v| hash[k] = _to_hash(v) }
185
- end
186
- elsif value.respond_to? :to_hash
187
- value.to_hash
188
- else
189
- value
190
- end
191
- end
192
-
193
- end
194
- end
@@ -1,224 +0,0 @@
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 PaymentsConfigurationLoanHero
17
- # Master flag indicating this merchant accepts Loan Hero
18
- attr_accessor :accept_loan_hero
19
-
20
- # Optional Quickbooks accounting code
21
- attr_accessor :accounting_code
22
-
23
- # Optional Quickbooks deposit to account
24
- attr_accessor :deposit_to_account
25
-
26
- attr_accessor :restrictions
27
-
28
- # Internal field to aid UI
29
- attr_accessor :show_loan_hero
30
-
31
- # Attribute mapping from ruby-style variable name to JSON key.
32
- def self.attribute_map
33
- {
34
- :'accept_loan_hero' => :'accept_loan_hero',
35
- :'accounting_code' => :'accounting_code',
36
- :'deposit_to_account' => :'deposit_to_account',
37
- :'restrictions' => :'restrictions',
38
- :'show_loan_hero' => :'show_loan_hero'
39
- }
40
- end
41
-
42
- # Attribute type mapping.
43
- def self.swagger_types
44
- {
45
- :'accept_loan_hero' => :'BOOLEAN',
46
- :'accounting_code' => :'String',
47
- :'deposit_to_account' => :'String',
48
- :'restrictions' => :'PaymentsConfigurationRestrictions',
49
- :'show_loan_hero' => :'BOOLEAN'
50
- }
51
- end
52
-
53
- # Initializes the object
54
- # @param [Hash] attributes Model attributes in the form of hash
55
- def initialize(attributes = {})
56
- return unless attributes.is_a?(Hash)
57
-
58
- # convert string to symbol for hash key
59
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
-
61
- if attributes.has_key?(:'accept_loan_hero')
62
- self.accept_loan_hero = attributes[:'accept_loan_hero']
63
- end
64
-
65
- if attributes.has_key?(:'accounting_code')
66
- self.accounting_code = attributes[:'accounting_code']
67
- end
68
-
69
- if attributes.has_key?(:'deposit_to_account')
70
- self.deposit_to_account = attributes[:'deposit_to_account']
71
- end
72
-
73
- if attributes.has_key?(:'restrictions')
74
- self.restrictions = attributes[:'restrictions']
75
- end
76
-
77
- if attributes.has_key?(:'show_loan_hero')
78
- self.show_loan_hero = attributes[:'show_loan_hero']
79
- end
80
- end
81
-
82
- # Show invalid properties with the reasons. Usually used together with valid?
83
- # @return Array for valid properties with the reasons
84
- def list_invalid_properties
85
- invalid_properties = Array.new
86
- invalid_properties
87
- end
88
-
89
- # Check to see if the all the properties in the model are valid
90
- # @return true if the model is valid
91
- def valid?
92
- true
93
- end
94
-
95
- # Checks equality by comparing each attribute.
96
- # @param [Object] Object to be compared
97
- def ==(o)
98
- return true if self.equal?(o)
99
- self.class == o.class &&
100
- accept_loan_hero == o.accept_loan_hero &&
101
- accounting_code == o.accounting_code &&
102
- deposit_to_account == o.deposit_to_account &&
103
- restrictions == o.restrictions &&
104
- show_loan_hero == o.show_loan_hero
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 [Fixnum] Hash code
115
- def hash
116
- [accept_loan_hero, accounting_code, deposit_to_account, restrictions, show_loan_hero].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 build_from_hash(attributes)
123
- return nil unless attributes.is_a?(Hash)
124
- self.class.swagger_types.each_pair do |key, type|
125
- if type =~ /\AArray<(.*)>/i
126
- # check to ensure the input is an array given that the attribute
127
- # is documented as an array but the input is not
128
- if attributes[self.class.attribute_map[key]].is_a?(Array)
129
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
- end
131
- elsif !attributes[self.class.attribute_map[key]].nil?
132
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
- end # or else data not found in attributes(hash), not an issue as the data can be optional
134
- end
135
-
136
- self
137
- end
138
-
139
- # Deserializes the data based on type
140
- # @param string type Data type
141
- # @param string value Value to be deserialized
142
- # @return [Object] Deserialized data
143
- def _deserialize(type, value)
144
- case type.to_sym
145
- when :DateTime
146
- DateTime.parse(value)
147
- when :Date
148
- Date.parse(value)
149
- when :String
150
- value.to_s
151
- when :Integer
152
- value.to_i
153
- when :Float
154
- value.to_f
155
- when :BOOLEAN
156
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
- true
158
- else
159
- false
160
- end
161
- when :Object
162
- # generic object (usually a Hash), return directly
163
- value
164
- when /\AArray<(?<inner_type>.+)>\z/
165
- inner_type = Regexp.last_match[:inner_type]
166
- value.map { |v| _deserialize(inner_type, v) }
167
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
- k_type = Regexp.last_match[:k_type]
169
- v_type = Regexp.last_match[:v_type]
170
- {}.tap do |hash|
171
- value.each do |k, v|
172
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
- end
174
- end
175
- else # model
176
- temp_model = UltracartClient.const_get(type).new
177
- temp_model.build_from_hash(value)
178
- end
179
- end
180
-
181
- # Returns the string representation of the object
182
- # @return [String] String presentation of the object
183
- def to_s
184
- to_hash.to_s
185
- end
186
-
187
- # to_body is an alias to to_hash (backward compatibility)
188
- # @return [Hash] Returns the object in the form of hash
189
- def to_body
190
- to_hash
191
- end
192
-
193
- # Returns the object in the form of hash
194
- # @return [Hash] Returns the object in the form of hash
195
- def to_hash
196
- hash = {}
197
- self.class.attribute_map.each_pair do |attr, param|
198
- value = self.send(attr)
199
- next if value.nil?
200
- hash[param] = _to_hash(value)
201
- end
202
- hash
203
- end
204
-
205
- # Outputs non-array value in the form of hash
206
- # For object, use to_hash. Otherwise, just return the value
207
- # @param [Object] value Any valid value
208
- # @return [Hash] Returns the value in the form of hash
209
- def _to_hash(value)
210
- if value.is_a?(Array)
211
- value.compact.map { |v| _to_hash(v) }
212
- elsif value.is_a?(Hash)
213
- {}.tap do |hash|
214
- value.each { |k, v| hash[k] = _to_hash(v) }
215
- end
216
- elsif value.respond_to? :to_hash
217
- value.to_hash
218
- else
219
- value
220
- end
221
- end
222
-
223
- end
224
- end
@@ -1,214 +0,0 @@
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 PaymentsConfigurationMoneyOrder
17
- # Master flag for this merchant accepting money orders
18
- attr_accessor :accept_money_orders
19
-
20
- # Optional Quickbooks accounting code
21
- attr_accessor :accounting_code
22
-
23
- # Optional Quickbooks deposit to account
24
- attr_accessor :deposit_to_account
25
-
26
- attr_accessor :restrictions
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'accept_money_orders' => :'accept_money_orders',
32
- :'accounting_code' => :'accounting_code',
33
- :'deposit_to_account' => :'deposit_to_account',
34
- :'restrictions' => :'restrictions'
35
- }
36
- end
37
-
38
- # Attribute type mapping.
39
- def self.swagger_types
40
- {
41
- :'accept_money_orders' => :'BOOLEAN',
42
- :'accounting_code' => :'String',
43
- :'deposit_to_account' => :'String',
44
- :'restrictions' => :'PaymentsConfigurationRestrictions'
45
- }
46
- end
47
-
48
- # Initializes the object
49
- # @param [Hash] attributes Model attributes in the form of hash
50
- def initialize(attributes = {})
51
- return unless attributes.is_a?(Hash)
52
-
53
- # convert string to symbol for hash key
54
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
55
-
56
- if attributes.has_key?(:'accept_money_orders')
57
- self.accept_money_orders = attributes[:'accept_money_orders']
58
- end
59
-
60
- if attributes.has_key?(:'accounting_code')
61
- self.accounting_code = attributes[:'accounting_code']
62
- end
63
-
64
- if attributes.has_key?(:'deposit_to_account')
65
- self.deposit_to_account = attributes[:'deposit_to_account']
66
- end
67
-
68
- if attributes.has_key?(:'restrictions')
69
- self.restrictions = attributes[:'restrictions']
70
- end
71
- end
72
-
73
- # Show invalid properties with the reasons. Usually used together with valid?
74
- # @return Array for valid properties with the reasons
75
- def list_invalid_properties
76
- invalid_properties = Array.new
77
- invalid_properties
78
- end
79
-
80
- # Check to see if the all the properties in the model are valid
81
- # @return true if the model is valid
82
- def valid?
83
- true
84
- end
85
-
86
- # Checks equality by comparing each attribute.
87
- # @param [Object] Object to be compared
88
- def ==(o)
89
- return true if self.equal?(o)
90
- self.class == o.class &&
91
- accept_money_orders == o.accept_money_orders &&
92
- accounting_code == o.accounting_code &&
93
- deposit_to_account == o.deposit_to_account &&
94
- restrictions == o.restrictions
95
- end
96
-
97
- # @see the `==` method
98
- # @param [Object] Object to be compared
99
- def eql?(o)
100
- self == o
101
- end
102
-
103
- # Calculates hash code according to all attributes.
104
- # @return [Fixnum] Hash code
105
- def hash
106
- [accept_money_orders, accounting_code, deposit_to_account, restrictions].hash
107
- end
108
-
109
- # Builds the object from hash
110
- # @param [Hash] attributes Model attributes in the form of hash
111
- # @return [Object] Returns the model itself
112
- def build_from_hash(attributes)
113
- return nil unless attributes.is_a?(Hash)
114
- self.class.swagger_types.each_pair do |key, type|
115
- if type =~ /\AArray<(.*)>/i
116
- # check to ensure the input is an array given that the attribute
117
- # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
- end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
- end # or else data not found in attributes(hash), not an issue as the data can be optional
124
- end
125
-
126
- self
127
- end
128
-
129
- # Deserializes the data based on type
130
- # @param string type Data type
131
- # @param string value Value to be deserialized
132
- # @return [Object] Deserialized data
133
- def _deserialize(type, value)
134
- case type.to_sym
135
- when :DateTime
136
- DateTime.parse(value)
137
- when :Date
138
- Date.parse(value)
139
- when :String
140
- value.to_s
141
- when :Integer
142
- value.to_i
143
- when :Float
144
- value.to_f
145
- when :BOOLEAN
146
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
- true
148
- else
149
- false
150
- end
151
- when :Object
152
- # generic object (usually a Hash), return directly
153
- value
154
- when /\AArray<(?<inner_type>.+)>\z/
155
- inner_type = Regexp.last_match[:inner_type]
156
- value.map { |v| _deserialize(inner_type, v) }
157
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
- k_type = Regexp.last_match[:k_type]
159
- v_type = Regexp.last_match[:v_type]
160
- {}.tap do |hash|
161
- value.each do |k, v|
162
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
- end
164
- end
165
- else # model
166
- temp_model = UltracartClient.const_get(type).new
167
- temp_model.build_from_hash(value)
168
- end
169
- end
170
-
171
- # Returns the string representation of the object
172
- # @return [String] String presentation of the object
173
- def to_s
174
- to_hash.to_s
175
- end
176
-
177
- # to_body is an alias to to_hash (backward compatibility)
178
- # @return [Hash] Returns the object in the form of hash
179
- def to_body
180
- to_hash
181
- end
182
-
183
- # Returns the object in the form of hash
184
- # @return [Hash] Returns the object in the form of hash
185
- def to_hash
186
- hash = {}
187
- self.class.attribute_map.each_pair do |attr, param|
188
- value = self.send(attr)
189
- next if value.nil?
190
- hash[param] = _to_hash(value)
191
- end
192
- hash
193
- end
194
-
195
- # Outputs non-array value in the form of hash
196
- # For object, use to_hash. Otherwise, just return the value
197
- # @param [Object] value Any valid value
198
- # @return [Hash] Returns the value in the form of hash
199
- def _to_hash(value)
200
- if value.is_a?(Array)
201
- value.compact.map { |v| _to_hash(v) }
202
- elsif value.is_a?(Hash)
203
- {}.tap do |hash|
204
- value.each { |k, v| hash[k] = _to_hash(v) }
205
- end
206
- elsif value.respond_to? :to_hash
207
- value.to_hash
208
- else
209
- value
210
- end
211
- end
212
-
213
- end
214
- end