ultracart_api 4.1.233 → 4.1.235

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -2
  3. data/docs/SfvbApi.md +178 -5
  4. data/docs/SfvbApprovalParams.md +1 -1
  5. data/docs/SfvbCommsLookupOwner.md +2 -0
  6. data/docs/SfvbCommsLookupResponse.md +2 -0
  7. data/docs/SfvbPreviewTrackingHtmlRequest.md +20 -0
  8. data/docs/SfvbServerLog.md +1 -1
  9. data/docs/SfvbTrackingCheckPlan.md +42 -0
  10. data/docs/SfvbTrackingCheckPlanEvent.md +22 -0
  11. data/docs/SfvbTrackingCheckPlanGate.md +20 -0
  12. data/docs/SfvbTrackingCheckPlanProvider.md +34 -0
  13. data/docs/SfvbTrackingCheckPlanRequest.md +24 -0
  14. data/docs/SfvbTrackingCheckPlanServerSide.md +20 -0
  15. data/docs/SfvbTrackingCheckPlanUnchecked.md +20 -0
  16. data/docs/SfvbTrackingHtmlRenderRequest.md +20 -0
  17. data/docs/SfvbTrackingHtmlRenderResponse.md +32 -0
  18. data/docs/SfvbTrackingProvider.md +2 -0
  19. data/lib/ultracart_api/api/sfvb_api.rb +255 -4
  20. data/lib/ultracart_api/models/sfvb_approval_params.rb +1 -1
  21. data/lib/ultracart_api/models/sfvb_comms_lookup_owner.rb +11 -1
  22. data/lib/ultracart_api/models/sfvb_comms_lookup_response.rb +11 -1
  23. data/lib/ultracart_api/models/sfvb_preview_tracking_html_request.rb +230 -0
  24. data/lib/ultracart_api/models/sfvb_server_log.rb +1 -1
  25. data/lib/ultracart_api/models/sfvb_tracking_check_plan.rb +394 -0
  26. data/lib/ultracart_api/models/sfvb_tracking_check_plan_event.rb +274 -0
  27. data/lib/ultracart_api/models/sfvb_tracking_check_plan_gate.rb +276 -0
  28. data/lib/ultracart_api/models/sfvb_tracking_check_plan_provider.rb +349 -0
  29. data/lib/ultracart_api/models/sfvb_tracking_check_plan_request.rb +284 -0
  30. data/lib/ultracart_api/models/sfvb_tracking_check_plan_server_side.rb +230 -0
  31. data/lib/ultracart_api/models/sfvb_tracking_check_plan_unchecked.rb +230 -0
  32. data/lib/ultracart_api/models/sfvb_tracking_html_render_request.rb +230 -0
  33. data/lib/ultracart_api/models/sfvb_tracking_html_render_response.rb +328 -0
  34. data/lib/ultracart_api/models/sfvb_tracking_provider.rb +11 -1
  35. data/lib/ultracart_api/version.rb +1 -1
  36. data/lib/ultracart_api.rb +10 -0
  37. metadata +22 -2
@@ -0,0 +1,230 @@
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 SfvbPreviewTrackingHtmlRequest
18
+ # Conversion HTML to run instead of the live slot on a test order's receipt opened through this session's preview access link. Never on a real order's receipt. An empty string unstages it. The same checks as a write apply.
19
+ attr_accessor :conversion_html
20
+
21
+ # Tracking HTML to run instead of the live slot on pages opened through this session's preview access link. An empty string unstages it. The same checks as a write apply.
22
+ attr_accessor :tracking_html
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'conversion_html' => :'conversion_html',
28
+ :'tracking_html' => :'tracking_html'
29
+ }
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'conversion_html' => :'String',
41
+ :'tracking_html' => :'String'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPreviewTrackingHtmlRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!self.class.attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPreviewTrackingHtmlRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'conversion_html')
67
+ self.conversion_html = attributes[:'conversion_html']
68
+ end
69
+
70
+ if attributes.key?(:'tracking_html')
71
+ self.tracking_html = attributes[:'tracking_html']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ conversion_html == o.conversion_html &&
94
+ tracking_html == o.tracking_html
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 [Integer] Hash code
105
+ def hash
106
+ [conversion_html, tracking_html].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 self.build_from_hash(attributes)
113
+ new.build_from_hash(attributes)
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ self.class.openapi_types.each_pair do |key, type|
123
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
124
+ self.send("#{key}=", nil)
125
+ elsif 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
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 :Time
146
+ Time.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
+ # models (e.g. Pet) or oneOf
177
+ klass = UltracartClient.const_get(type)
178
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -21,7 +21,7 @@ module UltracartClient
21
21
  # How long the render took in milliseconds.
22
22
  attr_accessor :duration_ms
23
23
 
24
- # Error lines in the log, including Velocity problems such as a null
24
+ # Error lines in the log, including Velocity problems such as setting a variable to null.
25
25
  attr_accessor :error_count
26
26
 
27
27
  # Lines in the full log text.
@@ -0,0 +1,394 @@
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 SfvbTrackingCheckPlan
18
+ # The tracking provider catalog version the plan was built from.
19
+ attr_accessor :catalog_version
20
+
21
+ # The consent state the plan assumes. none, all, or the granted categories in the order statistics, preferences, marketing. Left out when the plan lists every gate instead.
22
+ attr_accessor :consent
23
+
24
+ # page_view, or purchase for a test order receipt.
25
+ attr_accessor :event
26
+
27
+ # What the plan assumes about the browser and the page.
28
+ attr_accessor :notes
29
+
30
+ # The test order a purchase plan is for. Left out for a page view.
31
+ attr_accessor :order_id
32
+
33
+ # The page path the plan is for, as given.
34
+ attr_accessor :path
35
+
36
+ # The lowercase SHA-256 hex of the UTF-8 bytes of this response written as JSON without plan_id and snippet, with object keys sorted, no white space, and keys whose value is null left out, as JavaScript JSON.stringify writes values. A results file carries it, so the CLI can tell which plan the results belong to.
37
+ attr_accessor :plan_id
38
+
39
+ # One entry per provider the storefront turns on for this event, then one per host found in custom or affiliate network HTML.
40
+ attr_accessor :providers
41
+
42
+ # Where the browser is, which decides which gates apply. eea, non-us or other. Left out when the plan lists every gate instead.
43
+ attr_accessor :region
44
+
45
+ # What providers send from UltraCart servers for this event. The browser never sees these, so they are reported as not checked.
46
+ attr_accessor :server_side
47
+
48
+ # The collector, the source of one JavaScript async arrow function. Run it with addInitScript before the action so it starts before the page scripts, then run it again with evaluate after the action. The second run waits for 3 seconds of quiet, or 15 seconds at most, and returns plan_id, page, collected_at, requests (url, initiator) and events (via, name, params). URLs keep only the query params the plan names for that host, and events only the params the plan names. It never reads cookies, storage or form fields and sends nothing anywhere.
49
+ attr_accessor :snippet
50
+
51
+ # The storefront.
52
+ attr_accessor :storefront_oid
53
+
54
+ # What the plan could not predict, and why.
55
+ attr_accessor :unchecked
56
+
57
+ class EnumAttributeValidator
58
+ attr_reader :datatype
59
+ attr_reader :allowable_values
60
+
61
+ def initialize(datatype, allowable_values)
62
+ @allowable_values = allowable_values.map do |value|
63
+ case datatype.to_s
64
+ when /Integer/i
65
+ value.to_i
66
+ when /Float/i
67
+ value.to_f
68
+ else
69
+ value
70
+ end
71
+ end
72
+ end
73
+
74
+ def valid?(value)
75
+ !value || allowable_values.include?(value)
76
+ end
77
+ end
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'catalog_version' => :'catalog_version',
83
+ :'consent' => :'consent',
84
+ :'event' => :'event',
85
+ :'notes' => :'notes',
86
+ :'order_id' => :'order_id',
87
+ :'path' => :'path',
88
+ :'plan_id' => :'plan_id',
89
+ :'providers' => :'providers',
90
+ :'region' => :'region',
91
+ :'server_side' => :'server_side',
92
+ :'snippet' => :'snippet',
93
+ :'storefront_oid' => :'storefront_oid',
94
+ :'unchecked' => :'unchecked'
95
+ }
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'catalog_version' => :'Integer',
107
+ :'consent' => :'String',
108
+ :'event' => :'String',
109
+ :'notes' => :'Array<String>',
110
+ :'order_id' => :'String',
111
+ :'path' => :'String',
112
+ :'plan_id' => :'String',
113
+ :'providers' => :'Array<SfvbTrackingCheckPlanProvider>',
114
+ :'region' => :'String',
115
+ :'server_side' => :'Array<SfvbTrackingCheckPlanServerSide>',
116
+ :'snippet' => :'String',
117
+ :'storefront_oid' => :'Integer',
118
+ :'unchecked' => :'Array<SfvbTrackingCheckPlanUnchecked>'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ ])
126
+ end
127
+
128
+ # Initializes the object
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ def initialize(attributes = {})
131
+ if (!attributes.is_a?(Hash))
132
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlan` initialize method"
133
+ end
134
+
135
+ # check to see if the attribute exists and convert string to symbol for hash key
136
+ attributes = attributes.each_with_object({}) { |(k, v), h|
137
+ if (!self.class.attribute_map.key?(k.to_sym))
138
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
139
+ end
140
+ h[k.to_sym] = v
141
+ }
142
+
143
+ if attributes.key?(:'catalog_version')
144
+ self.catalog_version = attributes[:'catalog_version']
145
+ end
146
+
147
+ if attributes.key?(:'consent')
148
+ self.consent = attributes[:'consent']
149
+ end
150
+
151
+ if attributes.key?(:'event')
152
+ self.event = attributes[:'event']
153
+ end
154
+
155
+ if attributes.key?(:'notes')
156
+ if (value = attributes[:'notes']).is_a?(Array)
157
+ self.notes = value
158
+ end
159
+ end
160
+
161
+ if attributes.key?(:'order_id')
162
+ self.order_id = attributes[:'order_id']
163
+ end
164
+
165
+ if attributes.key?(:'path')
166
+ self.path = attributes[:'path']
167
+ end
168
+
169
+ if attributes.key?(:'plan_id')
170
+ self.plan_id = attributes[:'plan_id']
171
+ end
172
+
173
+ if attributes.key?(:'providers')
174
+ if (value = attributes[:'providers']).is_a?(Array)
175
+ self.providers = value
176
+ end
177
+ end
178
+
179
+ if attributes.key?(:'region')
180
+ self.region = attributes[:'region']
181
+ end
182
+
183
+ if attributes.key?(:'server_side')
184
+ if (value = attributes[:'server_side']).is_a?(Array)
185
+ self.server_side = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'snippet')
190
+ self.snippet = attributes[:'snippet']
191
+ end
192
+
193
+ if attributes.key?(:'storefront_oid')
194
+ self.storefront_oid = attributes[:'storefront_oid']
195
+ end
196
+
197
+ if attributes.key?(:'unchecked')
198
+ if (value = attributes[:'unchecked']).is_a?(Array)
199
+ self.unchecked = value
200
+ end
201
+ end
202
+ end
203
+
204
+ # Show invalid properties with the reasons. Usually used together with valid?
205
+ # @return Array for valid properties with the reasons
206
+ def list_invalid_properties
207
+ invalid_properties = Array.new
208
+ invalid_properties
209
+ end
210
+
211
+ # Check to see if the all the properties in the model are valid
212
+ # @return true if the model is valid
213
+ def valid?
214
+ event_validator = EnumAttributeValidator.new('String', ["page_view", "purchase"])
215
+ return false unless event_validator.valid?(@event)
216
+ region_validator = EnumAttributeValidator.new('String', ["eea", "non-us", "other"])
217
+ return false unless region_validator.valid?(@region)
218
+ true
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] event Object to be assigned
223
+ def event=(event)
224
+ validator = EnumAttributeValidator.new('String', ["page_view", "purchase"])
225
+ unless validator.valid?(event)
226
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
227
+ end
228
+ @event = event
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] region Object to be assigned
233
+ def region=(region)
234
+ validator = EnumAttributeValidator.new('String', ["eea", "non-us", "other"])
235
+ unless validator.valid?(region)
236
+ fail ArgumentError, "invalid value for \"region\", must be one of #{validator.allowable_values}."
237
+ end
238
+ @region = region
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
+ catalog_version == o.catalog_version &&
247
+ consent == o.consent &&
248
+ event == o.event &&
249
+ notes == o.notes &&
250
+ order_id == o.order_id &&
251
+ path == o.path &&
252
+ plan_id == o.plan_id &&
253
+ providers == o.providers &&
254
+ region == o.region &&
255
+ server_side == o.server_side &&
256
+ snippet == o.snippet &&
257
+ storefront_oid == o.storefront_oid &&
258
+ unchecked == o.unchecked
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Integer] Hash code
269
+ def hash
270
+ [catalog_version, consent, event, notes, order_id, path, plan_id, providers, region, server_side, snippet, storefront_oid, unchecked].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def self.build_from_hash(attributes)
277
+ new.build_from_hash(attributes)
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ self.class.openapi_types.each_pair do |key, type|
287
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
288
+ self.send("#{key}=", nil)
289
+ elsif type =~ /\AArray<(.*)>/i
290
+ # check to ensure the input is an array given that the attribute
291
+ # is documented as an array but the input is not
292
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
293
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
294
+ end
295
+ elsif !attributes[self.class.attribute_map[key]].nil?
296
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
297
+ end
298
+ end
299
+
300
+ self
301
+ end
302
+
303
+ # Deserializes the data based on type
304
+ # @param string type Data type
305
+ # @param string value Value to be deserialized
306
+ # @return [Object] Deserialized data
307
+ def _deserialize(type, value)
308
+ case type.to_sym
309
+ when :Time
310
+ Time.parse(value)
311
+ when :Date
312
+ Date.parse(value)
313
+ when :String
314
+ value.to_s
315
+ when :Integer
316
+ value.to_i
317
+ when :Float
318
+ value.to_f
319
+ when :Boolean
320
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
321
+ true
322
+ else
323
+ false
324
+ end
325
+ when :Object
326
+ # generic object (usually a Hash), return directly
327
+ value
328
+ when /\AArray<(?<inner_type>.+)>\z/
329
+ inner_type = Regexp.last_match[:inner_type]
330
+ value.map { |v| _deserialize(inner_type, v) }
331
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
332
+ k_type = Regexp.last_match[:k_type]
333
+ v_type = Regexp.last_match[:v_type]
334
+ {}.tap do |hash|
335
+ value.each do |k, v|
336
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
337
+ end
338
+ end
339
+ else # model
340
+ # models (e.g. Pet) or oneOf
341
+ klass = UltracartClient.const_get(type)
342
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
343
+ end
344
+ end
345
+
346
+ # Returns the string representation of the object
347
+ # @return [String] String presentation of the object
348
+ def to_s
349
+ to_hash.to_s
350
+ end
351
+
352
+ # to_body is an alias to to_hash (backward compatibility)
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_body
355
+ to_hash
356
+ end
357
+
358
+ # Returns the object in the form of hash
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_hash
361
+ hash = {}
362
+ self.class.attribute_map.each_pair do |attr, param|
363
+ value = self.send(attr)
364
+ if value.nil?
365
+ is_nullable = self.class.openapi_nullable.include?(attr)
366
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
367
+ end
368
+
369
+ hash[param] = _to_hash(value)
370
+ end
371
+ hash
372
+ end
373
+
374
+ # Outputs non-array value in the form of hash
375
+ # For object, use to_hash. Otherwise, just return the value
376
+ # @param [Object] value Any valid value
377
+ # @return [Hash] Returns the value in the form of hash
378
+ def _to_hash(value)
379
+ if value.is_a?(Array)
380
+ value.compact.map { |v| _to_hash(v) }
381
+ elsif value.is_a?(Hash)
382
+ {}.tap do |hash|
383
+ value.each { |k, v| hash[k] = _to_hash(v) }
384
+ end
385
+ elsif value.respond_to? :to_hash
386
+ value.to_hash
387
+ else
388
+ value
389
+ end
390
+ end
391
+
392
+ end
393
+
394
+ end