ultracart_api 3.3.2 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -4
  3. data/docs/ConfigurationApi.md +756 -0
  4. data/docs/DelayAutoOrdersResponse.md +12 -0
  5. data/docs/PaymentsConfiguration.md +23 -0
  6. data/docs/PaymentsConfigurationAffirm.md +15 -0
  7. data/docs/PaymentsConfigurationAmazon.md +15 -0
  8. data/docs/PaymentsConfigurationCOD.md +13 -0
  9. data/docs/PaymentsConfigurationCash.md +9 -0
  10. data/docs/PaymentsConfigurationCheck.md +25 -0
  11. data/docs/PaymentsConfigurationCreditCard.md +16 -0
  12. data/docs/PaymentsConfigurationLoanHero.md +12 -0
  13. data/docs/PaymentsConfigurationPayPal.md +36 -0
  14. data/docs/PaymentsConfigurationPurchaseOrder.md +11 -0
  15. data/docs/PaymentsConfigurationQuoteRequest.md +10 -0
  16. data/docs/PaymentsConfigurationResponse.md +12 -0
  17. data/docs/PaymentsConfigurationRestrictions.md +19 -0
  18. data/docs/PaymentsConfigurationSezzle.md +15 -0
  19. data/docs/PaymentsConfigurationWePay.md +35 -0
  20. data/docs/PaymentsConfigurationWireTransfer.md +18 -0
  21. data/docs/PaymentsThemeTransactionType.md +10 -0
  22. data/docs/PaymentsWepayEnroll.md +22 -0
  23. data/docs/RotatingTransactionGateway.md +50 -0
  24. data/docs/RtgCurrency.md +10 -0
  25. data/docs/RtgDayOfMonthRestriction.md +9 -0
  26. data/docs/RtgDayOfWeekRestriction.md +10 -0
  27. data/docs/RtgThemeRestriction.md +10 -0
  28. data/docs/StripeConnectResponse.md +12 -0
  29. data/docs/TransactionGateway.md +71 -0
  30. data/docs/TransactionGatewaysRequest.md +10 -0
  31. data/docs/TransactionGatewaysResponse.md +12 -0
  32. data/lib/ultracart_api.rb +29 -0
  33. data/lib/ultracart_api/api/configuration_api.rb +843 -0
  34. data/lib/ultracart_api/models/delay_auto_orders_response.rb +221 -0
  35. data/lib/ultracart_api/models/payments_configuration.rb +319 -0
  36. data/lib/ultracart_api/models/payments_configuration_affirm.rb +247 -0
  37. data/lib/ultracart_api/models/payments_configuration_amazon.rb +247 -0
  38. data/lib/ultracart_api/models/payments_configuration_cash.rb +193 -0
  39. data/lib/ultracart_api/models/payments_configuration_check.rb +337 -0
  40. data/lib/ultracart_api/models/payments_configuration_cod.rb +229 -0
  41. data/lib/ultracart_api/models/payments_configuration_credit_card.rb +256 -0
  42. data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +220 -0
  43. data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +436 -0
  44. data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +211 -0
  45. data/lib/ultracart_api/models/payments_configuration_quote_request.rb +202 -0
  46. data/lib/ultracart_api/models/payments_configuration_response.rb +221 -0
  47. data/lib/ultracart_api/models/payments_configuration_restrictions.rb +283 -0
  48. data/lib/ultracart_api/models/payments_configuration_sezzle.rb +247 -0
  49. data/lib/ultracart_api/models/payments_configuration_we_pay.rb +427 -0
  50. data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +274 -0
  51. data/lib/ultracart_api/models/payments_theme_transaction_type.rb +239 -0
  52. data/lib/ultracart_api/models/payments_wepay_enroll.rb +310 -0
  53. data/lib/ultracart_api/models/rotating_transaction_gateway.rb +665 -0
  54. data/lib/ultracart_api/models/rtg_currency.rb +205 -0
  55. data/lib/ultracart_api/models/rtg_day_of_month_restriction.rb +195 -0
  56. data/lib/ultracart_api/models/rtg_day_of_week_restriction.rb +205 -0
  57. data/lib/ultracart_api/models/rtg_theme_restriction.rb +239 -0
  58. data/lib/ultracart_api/models/stripe_connect_response.rb +221 -0
  59. data/lib/ultracart_api/models/transaction_gateway.rb +823 -0
  60. data/lib/ultracart_api/models/transaction_gateways_request.rb +242 -0
  61. data/lib/ultracart_api/models/transaction_gateways_response.rb +223 -0
  62. data/lib/ultracart_api/version.rb +1 -1
  63. metadata +60 -2
@@ -0,0 +1,283 @@
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 PaymentsConfigurationRestrictions
17
+ attr_accessor :maximum_subtotal
18
+
19
+ attr_accessor :minimum_subtotal
20
+
21
+ attr_accessor :payment_method
22
+
23
+ attr_accessor :restriction_alaska_hawaii
24
+
25
+ attr_accessor :restriction_apo_fpo
26
+
27
+ attr_accessor :restriction_canada
28
+
29
+ attr_accessor :restriction_continental_us
30
+
31
+ attr_accessor :restriction_domestic_only
32
+
33
+ attr_accessor :restriction_international_only
34
+
35
+ attr_accessor :restriction_po_box
36
+
37
+ attr_accessor :restriction_puerto_rico
38
+
39
+ attr_accessor :restriction_us_territories
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'maximum_subtotal' => :'maximumSubtotal',
45
+ :'minimum_subtotal' => :'minimumSubtotal',
46
+ :'payment_method' => :'paymentMethod',
47
+ :'restriction_alaska_hawaii' => :'restrictionAlaskaHawaii',
48
+ :'restriction_apo_fpo' => :'restrictionApoFpo',
49
+ :'restriction_canada' => :'restrictionCanada',
50
+ :'restriction_continental_us' => :'restrictionContinentalUS',
51
+ :'restriction_domestic_only' => :'restrictionDomesticOnly',
52
+ :'restriction_international_only' => :'restrictionInternationalOnly',
53
+ :'restriction_po_box' => :'restrictionPoBox',
54
+ :'restriction_puerto_rico' => :'restrictionPuertoRico',
55
+ :'restriction_us_territories' => :'restrictionUSTerritories'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'maximum_subtotal' => :'String',
63
+ :'minimum_subtotal' => :'String',
64
+ :'payment_method' => :'String',
65
+ :'restriction_alaska_hawaii' => :'String',
66
+ :'restriction_apo_fpo' => :'String',
67
+ :'restriction_canada' => :'String',
68
+ :'restriction_continental_us' => :'String',
69
+ :'restriction_domestic_only' => :'String',
70
+ :'restriction_international_only' => :'String',
71
+ :'restriction_po_box' => :'String',
72
+ :'restriction_puerto_rico' => :'String',
73
+ :'restriction_us_territories' => :'String'
74
+ }
75
+ end
76
+
77
+ # Initializes the object
78
+ # @param [Hash] attributes Model attributes in the form of hash
79
+ def initialize(attributes = {})
80
+ return unless attributes.is_a?(Hash)
81
+
82
+ # convert string to symbol for hash key
83
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
84
+
85
+ if attributes.has_key?(:'maximumSubtotal')
86
+ self.maximum_subtotal = attributes[:'maximumSubtotal']
87
+ end
88
+
89
+ if attributes.has_key?(:'minimumSubtotal')
90
+ self.minimum_subtotal = attributes[:'minimumSubtotal']
91
+ end
92
+
93
+ if attributes.has_key?(:'paymentMethod')
94
+ self.payment_method = attributes[:'paymentMethod']
95
+ end
96
+
97
+ if attributes.has_key?(:'restrictionAlaskaHawaii')
98
+ self.restriction_alaska_hawaii = attributes[:'restrictionAlaskaHawaii']
99
+ end
100
+
101
+ if attributes.has_key?(:'restrictionApoFpo')
102
+ self.restriction_apo_fpo = attributes[:'restrictionApoFpo']
103
+ end
104
+
105
+ if attributes.has_key?(:'restrictionCanada')
106
+ self.restriction_canada = attributes[:'restrictionCanada']
107
+ end
108
+
109
+ if attributes.has_key?(:'restrictionContinentalUS')
110
+ self.restriction_continental_us = attributes[:'restrictionContinentalUS']
111
+ end
112
+
113
+ if attributes.has_key?(:'restrictionDomesticOnly')
114
+ self.restriction_domestic_only = attributes[:'restrictionDomesticOnly']
115
+ end
116
+
117
+ if attributes.has_key?(:'restrictionInternationalOnly')
118
+ self.restriction_international_only = attributes[:'restrictionInternationalOnly']
119
+ end
120
+
121
+ if attributes.has_key?(:'restrictionPoBox')
122
+ self.restriction_po_box = attributes[:'restrictionPoBox']
123
+ end
124
+
125
+ if attributes.has_key?(:'restrictionPuertoRico')
126
+ self.restriction_puerto_rico = attributes[:'restrictionPuertoRico']
127
+ end
128
+
129
+ if attributes.has_key?(:'restrictionUSTerritories')
130
+ self.restriction_us_territories = attributes[:'restrictionUSTerritories']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ true
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ maximum_subtotal == o.maximum_subtotal &&
153
+ minimum_subtotal == o.minimum_subtotal &&
154
+ payment_method == o.payment_method &&
155
+ restriction_alaska_hawaii == o.restriction_alaska_hawaii &&
156
+ restriction_apo_fpo == o.restriction_apo_fpo &&
157
+ restriction_canada == o.restriction_canada &&
158
+ restriction_continental_us == o.restriction_continental_us &&
159
+ restriction_domestic_only == o.restriction_domestic_only &&
160
+ restriction_international_only == o.restriction_international_only &&
161
+ restriction_po_box == o.restriction_po_box &&
162
+ restriction_puerto_rico == o.restriction_puerto_rico &&
163
+ restriction_us_territories == o.restriction_us_territories
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Fixnum] Hash code
174
+ def hash
175
+ [maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ self.class.swagger_types.each_pair do |key, type|
184
+ if type =~ /\AArray<(.*)>/i
185
+ # check to ensure the input is an array given that the attribute
186
+ # is documented as an array but the input is not
187
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
188
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
189
+ end
190
+ elsif !attributes[self.class.attribute_map[key]].nil?
191
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
192
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
193
+ end
194
+
195
+ self
196
+ end
197
+
198
+ # Deserializes the data based on type
199
+ # @param string type Data type
200
+ # @param string value Value to be deserialized
201
+ # @return [Object] Deserialized data
202
+ def _deserialize(type, value)
203
+ case type.to_sym
204
+ when :DateTime
205
+ DateTime.parse(value)
206
+ when :Date
207
+ Date.parse(value)
208
+ when :String
209
+ value.to_s
210
+ when :Integer
211
+ value.to_i
212
+ when :Float
213
+ value.to_f
214
+ when :BOOLEAN
215
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
216
+ true
217
+ else
218
+ false
219
+ end
220
+ when :Object
221
+ # generic object (usually a Hash), return directly
222
+ value
223
+ when /\AArray<(?<inner_type>.+)>\z/
224
+ inner_type = Regexp.last_match[:inner_type]
225
+ value.map { |v| _deserialize(inner_type, v) }
226
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
227
+ k_type = Regexp.last_match[:k_type]
228
+ v_type = Regexp.last_match[:v_type]
229
+ {}.tap do |hash|
230
+ value.each do |k, v|
231
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
232
+ end
233
+ end
234
+ else # model
235
+ temp_model = UltracartClient.const_get(type).new
236
+ temp_model.build_from_hash(value)
237
+ end
238
+ end
239
+
240
+ # Returns the string representation of the object
241
+ # @return [String] String presentation of the object
242
+ def to_s
243
+ to_hash.to_s
244
+ end
245
+
246
+ # to_body is an alias to to_hash (backward compatibility)
247
+ # @return [Hash] Returns the object in the form of hash
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ next if value.nil?
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+ end
@@ -0,0 +1,247 @@
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 PaymentsConfigurationSezzle
17
+ attr_accessor :accept_sezzle
18
+
19
+ attr_accessor :restrictions
20
+
21
+ attr_accessor :sezzle_accounting_code
22
+
23
+ attr_accessor :sezzle_business_id
24
+
25
+ attr_accessor :sezzle_deposit_to_account
26
+
27
+ attr_accessor :sezzle_environment
28
+
29
+ attr_accessor :sezzle_private_api_key
30
+
31
+ attr_accessor :sezzle_public_api_key
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'accept_sezzle' => :'acceptSezzle',
37
+ :'restrictions' => :'restrictions',
38
+ :'sezzle_accounting_code' => :'sezzleAccountingCode',
39
+ :'sezzle_business_id' => :'sezzleBusinessId',
40
+ :'sezzle_deposit_to_account' => :'sezzleDepositToAccount',
41
+ :'sezzle_environment' => :'sezzleEnvironment',
42
+ :'sezzle_private_api_key' => :'sezzlePrivateApiKey',
43
+ :'sezzle_public_api_key' => :'sezzlePublicApiKey'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'accept_sezzle' => :'BOOLEAN',
51
+ :'restrictions' => :'PaymentsConfigurationRestrictions',
52
+ :'sezzle_accounting_code' => :'String',
53
+ :'sezzle_business_id' => :'String',
54
+ :'sezzle_deposit_to_account' => :'String',
55
+ :'sezzle_environment' => :'String',
56
+ :'sezzle_private_api_key' => :'String',
57
+ :'sezzle_public_api_key' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.has_key?(:'acceptSezzle')
70
+ self.accept_sezzle = attributes[:'acceptSezzle']
71
+ end
72
+
73
+ if attributes.has_key?(:'restrictions')
74
+ self.restrictions = attributes[:'restrictions']
75
+ end
76
+
77
+ if attributes.has_key?(:'sezzleAccountingCode')
78
+ self.sezzle_accounting_code = attributes[:'sezzleAccountingCode']
79
+ end
80
+
81
+ if attributes.has_key?(:'sezzleBusinessId')
82
+ self.sezzle_business_id = attributes[:'sezzleBusinessId']
83
+ end
84
+
85
+ if attributes.has_key?(:'sezzleDepositToAccount')
86
+ self.sezzle_deposit_to_account = attributes[:'sezzleDepositToAccount']
87
+ end
88
+
89
+ if attributes.has_key?(:'sezzleEnvironment')
90
+ self.sezzle_environment = attributes[:'sezzleEnvironment']
91
+ end
92
+
93
+ if attributes.has_key?(:'sezzlePrivateApiKey')
94
+ self.sezzle_private_api_key = attributes[:'sezzlePrivateApiKey']
95
+ end
96
+
97
+ if attributes.has_key?(:'sezzlePublicApiKey')
98
+ self.sezzle_public_api_key = attributes[:'sezzlePublicApiKey']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ accept_sezzle == o.accept_sezzle &&
121
+ restrictions == o.restrictions &&
122
+ sezzle_accounting_code == o.sezzle_accounting_code &&
123
+ sezzle_business_id == o.sezzle_business_id &&
124
+ sezzle_deposit_to_account == o.sezzle_deposit_to_account &&
125
+ sezzle_environment == o.sezzle_environment &&
126
+ sezzle_private_api_key == o.sezzle_private_api_key &&
127
+ sezzle_public_api_key == o.sezzle_public_api_key
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Fixnum] Hash code
138
+ def hash
139
+ [accept_sezzle, restrictions, sezzle_accounting_code, sezzle_business_id, sezzle_deposit_to_account, sezzle_environment, sezzle_private_api_key, sezzle_public_api_key].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ self.class.swagger_types.each_pair do |key, type|
148
+ if type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
152
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
153
+ end
154
+ elsif !attributes[self.class.attribute_map[key]].nil?
155
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
156
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
157
+ end
158
+
159
+ self
160
+ end
161
+
162
+ # Deserializes the data based on type
163
+ # @param string type Data type
164
+ # @param string value Value to be deserialized
165
+ # @return [Object] Deserialized data
166
+ def _deserialize(type, value)
167
+ case type.to_sym
168
+ when :DateTime
169
+ DateTime.parse(value)
170
+ when :Date
171
+ Date.parse(value)
172
+ when :String
173
+ value.to_s
174
+ when :Integer
175
+ value.to_i
176
+ when :Float
177
+ value.to_f
178
+ when :BOOLEAN
179
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
+ true
181
+ else
182
+ false
183
+ end
184
+ when :Object
185
+ # generic object (usually a Hash), return directly
186
+ value
187
+ when /\AArray<(?<inner_type>.+)>\z/
188
+ inner_type = Regexp.last_match[:inner_type]
189
+ value.map { |v| _deserialize(inner_type, v) }
190
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
191
+ k_type = Regexp.last_match[:k_type]
192
+ v_type = Regexp.last_match[:v_type]
193
+ {}.tap do |hash|
194
+ value.each do |k, v|
195
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
196
+ end
197
+ end
198
+ else # model
199
+ temp_model = UltracartClient.const_get(type).new
200
+ temp_model.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ next if value.nil?
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+ end