ultracart_api 4.1.170 → 4.1.172

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -2
  3. data/docs/SfvbApi.md +890 -37
  4. data/docs/SfvbPageResponse.md +2 -0
  5. data/docs/SfvbUpsellItemLogic.md +24 -0
  6. data/docs/SfvbUpsellItemLogicItem.md +22 -0
  7. data/docs/SfvbUpsellOffer.md +118 -8
  8. data/docs/SfvbUpsellPath.md +48 -0
  9. data/docs/SfvbUpsellPathDuplicateRequest.md +18 -0
  10. data/docs/SfvbUpsellPathMoveRequest.md +18 -0
  11. data/docs/SfvbUpsellPathsResponse.md +28 -0
  12. data/docs/SfvbUpsellStats.md +54 -0
  13. data/docs/SfvbUpsellStep.md +22 -0
  14. data/docs/SfvbUpsellStepOffer.md +32 -0
  15. data/docs/SfvbUpsellTowerData.md +20 -0
  16. data/docs/SfvbUpsellVariation.md +22 -0
  17. data/lib/ultracart_api/api/sfvb_api.rb +1256 -78
  18. data/lib/ultracart_api/models/sfvb_page_response.rb +11 -1
  19. data/lib/ultracart_api/models/sfvb_upsell_item_logic.rb +252 -0
  20. data/lib/ultracart_api/models/sfvb_upsell_item_logic_item.rb +240 -0
  21. data/lib/ultracart_api/models/sfvb_upsell_offer.rb +598 -9
  22. data/lib/ultracart_api/models/sfvb_upsell_path.rb +373 -0
  23. data/lib/ultracart_api/models/sfvb_upsell_path_duplicate_request.rb +220 -0
  24. data/lib/ultracart_api/models/sfvb_upsell_path_move_request.rb +220 -0
  25. data/lib/ultracart_api/models/sfvb_upsell_paths_response.rb +272 -0
  26. data/lib/ultracart_api/models/sfvb_upsell_stats.rb +400 -0
  27. data/lib/ultracart_api/models/sfvb_upsell_step.rb +241 -0
  28. data/lib/ultracart_api/models/sfvb_upsell_step_offer.rb +288 -0
  29. data/lib/ultracart_api/models/sfvb_upsell_tower_data.rb +234 -0
  30. data/lib/ultracart_api/models/sfvb_upsell_variation.rb +241 -0
  31. data/lib/ultracart_api/version.rb +1 -1
  32. data/lib/ultracart_api.rb +11 -0
  33. metadata +24 -2
@@ -0,0 +1,400 @@
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 SfvbUpsellStats
18
+ # Times the shopper left while the offer was showing.
19
+ attr_accessor :abandons
20
+
21
+ # Profit per view after refunds.
22
+ attr_accessor :average_visitor_net_profit
23
+
24
+ # Revenue per view after refunds.
25
+ attr_accessor :average_visitor_net_revenue
26
+
27
+ # Profit per view.
28
+ attr_accessor :average_visitor_profit
29
+
30
+ # Revenue per view.
31
+ attr_accessor :average_visitor_revenue
32
+
33
+ # Transactions divided by views, as a percentage.
34
+ attr_accessor :conversion_rate
35
+
36
+ # Times the offer was declined.
37
+ attr_accessor :declines
38
+
39
+ # Profit per transaction after refunds.
40
+ attr_accessor :per_sale_net_profit
41
+
42
+ # Revenue per transaction after refunds.
43
+ attr_accessor :per_sale_net_revenue
44
+
45
+ # Profit per transaction.
46
+ attr_accessor :per_sale_profit
47
+
48
+ # Revenue per transaction.
49
+ attr_accessor :per_sale_revenue
50
+
51
+ # Profit from accepted offers.
52
+ attr_accessor :profit
53
+
54
+ # Profit later refunded.
55
+ attr_accessor :refunded_profit
56
+
57
+ # Quantity later refunded.
58
+ attr_accessor :refunded_quantity
59
+
60
+ # Revenue later refunded.
61
+ attr_accessor :refunded_revenue
62
+
63
+ # Revenue from accepted offers.
64
+ attr_accessor :revenue
65
+
66
+ # On a path variation only. Distinct visitors shown any upsell on this storefront in the window, the denominator for comparing variations.
67
+ attr_accessor :total_visitors_across_all_paths
68
+
69
+ # Distinct sessions that accepted the offer and were charged successfully.
70
+ attr_accessor :transactions
71
+
72
+ # Distinct sessions that were shown the offer.
73
+ attr_accessor :views
74
+
75
+ # Attribute mapping from ruby-style variable name to JSON key.
76
+ def self.attribute_map
77
+ {
78
+ :'abandons' => :'abandons',
79
+ :'average_visitor_net_profit' => :'average_visitor_net_profit',
80
+ :'average_visitor_net_revenue' => :'average_visitor_net_revenue',
81
+ :'average_visitor_profit' => :'average_visitor_profit',
82
+ :'average_visitor_revenue' => :'average_visitor_revenue',
83
+ :'conversion_rate' => :'conversion_rate',
84
+ :'declines' => :'declines',
85
+ :'per_sale_net_profit' => :'per_sale_net_profit',
86
+ :'per_sale_net_revenue' => :'per_sale_net_revenue',
87
+ :'per_sale_profit' => :'per_sale_profit',
88
+ :'per_sale_revenue' => :'per_sale_revenue',
89
+ :'profit' => :'profit',
90
+ :'refunded_profit' => :'refunded_profit',
91
+ :'refunded_quantity' => :'refunded_quantity',
92
+ :'refunded_revenue' => :'refunded_revenue',
93
+ :'revenue' => :'revenue',
94
+ :'total_visitors_across_all_paths' => :'total_visitors_across_all_paths',
95
+ :'transactions' => :'transactions',
96
+ :'views' => :'views'
97
+ }
98
+ end
99
+
100
+ # Returns all the JSON keys this model knows about
101
+ def self.acceptable_attributes
102
+ attribute_map.values
103
+ end
104
+
105
+ # Attribute type mapping.
106
+ def self.openapi_types
107
+ {
108
+ :'abandons' => :'Integer',
109
+ :'average_visitor_net_profit' => :'Float',
110
+ :'average_visitor_net_revenue' => :'Float',
111
+ :'average_visitor_profit' => :'Float',
112
+ :'average_visitor_revenue' => :'Float',
113
+ :'conversion_rate' => :'Float',
114
+ :'declines' => :'Integer',
115
+ :'per_sale_net_profit' => :'Float',
116
+ :'per_sale_net_revenue' => :'Float',
117
+ :'per_sale_profit' => :'Float',
118
+ :'per_sale_revenue' => :'Float',
119
+ :'profit' => :'Float',
120
+ :'refunded_profit' => :'Float',
121
+ :'refunded_quantity' => :'Integer',
122
+ :'refunded_revenue' => :'Float',
123
+ :'revenue' => :'Float',
124
+ :'total_visitors_across_all_paths' => :'Integer',
125
+ :'transactions' => :'Integer',
126
+ :'views' => :'Integer'
127
+ }
128
+ end
129
+
130
+ # List of attributes with nullable: true
131
+ def self.openapi_nullable
132
+ Set.new([
133
+ ])
134
+ end
135
+
136
+ # Initializes the object
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ def initialize(attributes = {})
139
+ if (!attributes.is_a?(Hash))
140
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbUpsellStats` initialize method"
141
+ end
142
+
143
+ # check to see if the attribute exists and convert string to symbol for hash key
144
+ attributes = attributes.each_with_object({}) { |(k, v), h|
145
+ if (!self.class.attribute_map.key?(k.to_sym))
146
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbUpsellStats`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
147
+ end
148
+ h[k.to_sym] = v
149
+ }
150
+
151
+ if attributes.key?(:'abandons')
152
+ self.abandons = attributes[:'abandons']
153
+ end
154
+
155
+ if attributes.key?(:'average_visitor_net_profit')
156
+ self.average_visitor_net_profit = attributes[:'average_visitor_net_profit']
157
+ end
158
+
159
+ if attributes.key?(:'average_visitor_net_revenue')
160
+ self.average_visitor_net_revenue = attributes[:'average_visitor_net_revenue']
161
+ end
162
+
163
+ if attributes.key?(:'average_visitor_profit')
164
+ self.average_visitor_profit = attributes[:'average_visitor_profit']
165
+ end
166
+
167
+ if attributes.key?(:'average_visitor_revenue')
168
+ self.average_visitor_revenue = attributes[:'average_visitor_revenue']
169
+ end
170
+
171
+ if attributes.key?(:'conversion_rate')
172
+ self.conversion_rate = attributes[:'conversion_rate']
173
+ end
174
+
175
+ if attributes.key?(:'declines')
176
+ self.declines = attributes[:'declines']
177
+ end
178
+
179
+ if attributes.key?(:'per_sale_net_profit')
180
+ self.per_sale_net_profit = attributes[:'per_sale_net_profit']
181
+ end
182
+
183
+ if attributes.key?(:'per_sale_net_revenue')
184
+ self.per_sale_net_revenue = attributes[:'per_sale_net_revenue']
185
+ end
186
+
187
+ if attributes.key?(:'per_sale_profit')
188
+ self.per_sale_profit = attributes[:'per_sale_profit']
189
+ end
190
+
191
+ if attributes.key?(:'per_sale_revenue')
192
+ self.per_sale_revenue = attributes[:'per_sale_revenue']
193
+ end
194
+
195
+ if attributes.key?(:'profit')
196
+ self.profit = attributes[:'profit']
197
+ end
198
+
199
+ if attributes.key?(:'refunded_profit')
200
+ self.refunded_profit = attributes[:'refunded_profit']
201
+ end
202
+
203
+ if attributes.key?(:'refunded_quantity')
204
+ self.refunded_quantity = attributes[:'refunded_quantity']
205
+ end
206
+
207
+ if attributes.key?(:'refunded_revenue')
208
+ self.refunded_revenue = attributes[:'refunded_revenue']
209
+ end
210
+
211
+ if attributes.key?(:'revenue')
212
+ self.revenue = attributes[:'revenue']
213
+ end
214
+
215
+ if attributes.key?(:'total_visitors_across_all_paths')
216
+ self.total_visitors_across_all_paths = attributes[:'total_visitors_across_all_paths']
217
+ end
218
+
219
+ if attributes.key?(:'transactions')
220
+ self.transactions = attributes[:'transactions']
221
+ end
222
+
223
+ if attributes.key?(:'views')
224
+ self.views = attributes[:'views']
225
+ end
226
+ end
227
+
228
+ # Show invalid properties with the reasons. Usually used together with valid?
229
+ # @return Array for valid properties with the reasons
230
+ def list_invalid_properties
231
+ invalid_properties = Array.new
232
+ invalid_properties
233
+ end
234
+
235
+ # Check to see if the all the properties in the model are valid
236
+ # @return true if the model is valid
237
+ def valid?
238
+ true
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ abandons == o.abandons &&
247
+ average_visitor_net_profit == o.average_visitor_net_profit &&
248
+ average_visitor_net_revenue == o.average_visitor_net_revenue &&
249
+ average_visitor_profit == o.average_visitor_profit &&
250
+ average_visitor_revenue == o.average_visitor_revenue &&
251
+ conversion_rate == o.conversion_rate &&
252
+ declines == o.declines &&
253
+ per_sale_net_profit == o.per_sale_net_profit &&
254
+ per_sale_net_revenue == o.per_sale_net_revenue &&
255
+ per_sale_profit == o.per_sale_profit &&
256
+ per_sale_revenue == o.per_sale_revenue &&
257
+ profit == o.profit &&
258
+ refunded_profit == o.refunded_profit &&
259
+ refunded_quantity == o.refunded_quantity &&
260
+ refunded_revenue == o.refunded_revenue &&
261
+ revenue == o.revenue &&
262
+ total_visitors_across_all_paths == o.total_visitors_across_all_paths &&
263
+ transactions == o.transactions &&
264
+ views == o.views
265
+ end
266
+
267
+ # @see the `==` method
268
+ # @param [Object] Object to be compared
269
+ def eql?(o)
270
+ self == o
271
+ end
272
+
273
+ # Calculates hash code according to all attributes.
274
+ # @return [Integer] Hash code
275
+ def hash
276
+ [abandons, average_visitor_net_profit, average_visitor_net_revenue, average_visitor_profit, average_visitor_revenue, conversion_rate, declines, per_sale_net_profit, per_sale_net_revenue, per_sale_profit, per_sale_revenue, profit, refunded_profit, refunded_quantity, refunded_revenue, revenue, total_visitors_across_all_paths, transactions, views].hash
277
+ end
278
+
279
+ # Builds the object from hash
280
+ # @param [Hash] attributes Model attributes in the form of hash
281
+ # @return [Object] Returns the model itself
282
+ def self.build_from_hash(attributes)
283
+ new.build_from_hash(attributes)
284
+ end
285
+
286
+ # Builds the object from hash
287
+ # @param [Hash] attributes Model attributes in the form of hash
288
+ # @return [Object] Returns the model itself
289
+ def build_from_hash(attributes)
290
+ return nil unless attributes.is_a?(Hash)
291
+ attributes = attributes.transform_keys(&:to_sym)
292
+ self.class.openapi_types.each_pair do |key, type|
293
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
294
+ self.send("#{key}=", nil)
295
+ elsif type =~ /\AArray<(.*)>/i
296
+ # check to ensure the input is an array given that the attribute
297
+ # is documented as an array but the input is not
298
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
299
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
300
+ end
301
+ elsif !attributes[self.class.attribute_map[key]].nil?
302
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
303
+ end
304
+ end
305
+
306
+ self
307
+ end
308
+
309
+ # Deserializes the data based on type
310
+ # @param string type Data type
311
+ # @param string value Value to be deserialized
312
+ # @return [Object] Deserialized data
313
+ def _deserialize(type, value)
314
+ case type.to_sym
315
+ when :Time
316
+ Time.parse(value)
317
+ when :Date
318
+ Date.parse(value)
319
+ when :String
320
+ value.to_s
321
+ when :Integer
322
+ value.to_i
323
+ when :Float
324
+ value.to_f
325
+ when :Boolean
326
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
327
+ true
328
+ else
329
+ false
330
+ end
331
+ when :Object
332
+ # generic object (usually a Hash), return directly
333
+ value
334
+ when /\AArray<(?<inner_type>.+)>\z/
335
+ inner_type = Regexp.last_match[:inner_type]
336
+ value.map { |v| _deserialize(inner_type, v) }
337
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
338
+ k_type = Regexp.last_match[:k_type]
339
+ v_type = Regexp.last_match[:v_type]
340
+ {}.tap do |hash|
341
+ value.each do |k, v|
342
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
343
+ end
344
+ end
345
+ else # model
346
+ # models (e.g. Pet) or oneOf
347
+ klass = UltracartClient.const_get(type)
348
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
349
+ end
350
+ end
351
+
352
+ # Returns the string representation of the object
353
+ # @return [String] String presentation of the object
354
+ def to_s
355
+ to_hash.to_s
356
+ end
357
+
358
+ # to_body is an alias to to_hash (backward compatibility)
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_body
361
+ to_hash
362
+ end
363
+
364
+ # Returns the object in the form of hash
365
+ # @return [Hash] Returns the object in the form of hash
366
+ def to_hash
367
+ hash = {}
368
+ self.class.attribute_map.each_pair do |attr, param|
369
+ value = self.send(attr)
370
+ if value.nil?
371
+ is_nullable = self.class.openapi_nullable.include?(attr)
372
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
373
+ end
374
+
375
+ hash[param] = _to_hash(value)
376
+ end
377
+ hash
378
+ end
379
+
380
+ # Outputs non-array value in the form of hash
381
+ # For object, use to_hash. Otherwise, just return the value
382
+ # @param [Object] value Any valid value
383
+ # @return [Hash] Returns the value in the form of hash
384
+ def _to_hash(value)
385
+ if value.is_a?(Array)
386
+ value.compact.map { |v| _to_hash(v) }
387
+ elsif value.is_a?(Hash)
388
+ {}.tap do |hash|
389
+ value.each { |k, v| hash[k] = _to_hash(v) }
390
+ end
391
+ elsif value.respond_to? :to_hash
392
+ value.to_hash
393
+ else
394
+ value
395
+ end
396
+ end
397
+
398
+ end
399
+
400
+ end
@@ -0,0 +1,241 @@
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 SfvbUpsellStep
18
+ # An experiment step, splitting shoppers between these offers. Set this or offer, not both.
19
+ attr_accessor :experiment_offers
20
+
21
+ attr_accessor :offer
22
+
23
+ # Read only. offer or experiment, from whichever of the two below is set.
24
+ attr_accessor :type
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'experiment_offers' => :'experiment_offers',
30
+ :'offer' => :'offer',
31
+ :'type' => :'type'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'experiment_offers' => :'Array<SfvbUpsellStepOffer>',
44
+ :'offer' => :'SfvbUpsellStepOffer',
45
+ :'type' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbUpsellStep` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbUpsellStep`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'experiment_offers')
71
+ if (value = attributes[:'experiment_offers']).is_a?(Array)
72
+ self.experiment_offers = value
73
+ end
74
+ end
75
+
76
+ if attributes.key?(:'offer')
77
+ self.offer = attributes[:'offer']
78
+ end
79
+
80
+ if attributes.key?(:'type')
81
+ self.type = attributes[:'type']
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(o)
101
+ return true if self.equal?(o)
102
+ self.class == o.class &&
103
+ experiment_offers == o.experiment_offers &&
104
+ offer == o.offer &&
105
+ type == o.type
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(o)
111
+ self == o
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Integer] Hash code
116
+ def hash
117
+ [experiment_offers, offer, type].hash
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def self.build_from_hash(attributes)
124
+ new.build_from_hash(attributes)
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ self.class.openapi_types.each_pair do |key, type|
134
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
135
+ self.send("#{key}=", nil)
136
+ elsif type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = UltracartClient.const_get(type)
189
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end