ultracart_api 4.1.159 → 4.1.161

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -2
  3. data/docs/SfvbApi.md +1123 -10
  4. data/docs/SfvbBlogPost.md +30 -0
  5. data/docs/SfvbBlogPostsResponse.md +24 -0
  6. data/docs/SfvbExperiment.md +36 -0
  7. data/docs/SfvbExperimentEndRequest.md +18 -0
  8. data/docs/SfvbExperimentObjective.md +24 -0
  9. data/docs/SfvbExperimentObjectivesResponse.md +18 -0
  10. data/docs/SfvbExperimentStartRequest.md +40 -0
  11. data/docs/SfvbExperimentStartVariation.md +22 -0
  12. data/docs/SfvbExperimentVariationUpdateRequest.md +18 -0
  13. data/docs/SfvbExperimentsResponse.md +18 -0
  14. data/docs/SfvbPageBlogPostSelector.md +26 -0
  15. data/docs/SfvbPageBlogPostsRequest.md +18 -0
  16. data/docs/SfvbPageBlogPostsResponse.md +22 -0
  17. data/docs/SfvbPageCreateRequest.md +34 -0
  18. data/docs/SfvbPageDuplicateRequest.md +22 -0
  19. data/docs/SfvbPageItem.md +26 -0
  20. data/docs/SfvbPageItemSelector.md +42 -0
  21. data/docs/SfvbPageItemsAddRequest.md +18 -0
  22. data/docs/SfvbPageItemsRemoveRequest.md +18 -0
  23. data/docs/SfvbPageItemsResponse.md +24 -0
  24. data/docs/SfvbPageListResponse.md +18 -0
  25. data/docs/SfvbPageResponse.md +13 -1
  26. data/docs/SfvbPageSelectors.md +26 -0
  27. data/docs/SfvbPageSettingsRequest.md +44 -0
  28. data/docs/SfvbPageSummary.md +44 -0
  29. data/docs/SfvbTemplate.md +36 -0
  30. data/docs/SfvbTemplatesResponse.md +20 -0
  31. data/lib/ultracart_api/api/sfvb_api.rb +1722 -211
  32. data/lib/ultracart_api/models/sfvb_blog_post.rb +280 -0
  33. data/lib/ultracart_api/models/sfvb_blog_posts_response.rb +252 -0
  34. data/lib/ultracart_api/models/sfvb_experiment.rb +309 -0
  35. data/lib/ultracart_api/models/sfvb_experiment_end_request.rb +220 -0
  36. data/lib/ultracart_api/models/sfvb_experiment_objective.rb +250 -0
  37. data/lib/ultracart_api/models/sfvb_experiment_objectives_response.rb +222 -0
  38. data/lib/ultracart_api/models/sfvb_experiment_start_request.rb +332 -0
  39. data/lib/ultracart_api/models/sfvb_experiment_start_variation.rb +240 -0
  40. data/lib/ultracart_api/models/sfvb_experiment_variation_update_request.rb +220 -0
  41. data/lib/ultracart_api/models/sfvb_experiments_response.rb +222 -0
  42. data/lib/ultracart_api/models/sfvb_page_blog_post_selector.rb +260 -0
  43. data/lib/ultracart_api/models/sfvb_page_blog_posts_request.rb +222 -0
  44. data/lib/ultracart_api/models/sfvb_page_blog_posts_response.rb +242 -0
  45. data/lib/ultracart_api/models/sfvb_page_create_request.rb +300 -0
  46. data/lib/ultracart_api/models/sfvb_page_duplicate_request.rb +240 -0
  47. data/lib/ultracart_api/models/sfvb_page_item.rb +260 -0
  48. data/lib/ultracart_api/models/sfvb_page_item_selector.rb +340 -0
  49. data/lib/ultracart_api/models/sfvb_page_items_add_request.rb +222 -0
  50. data/lib/ultracart_api/models/sfvb_page_items_remove_request.rb +222 -0
  51. data/lib/ultracart_api/models/sfvb_page_items_response.rb +252 -0
  52. data/lib/ultracart_api/models/sfvb_page_list_response.rb +222 -0
  53. data/lib/ultracart_api/models/sfvb_page_response.rb +64 -4
  54. data/lib/ultracart_api/models/sfvb_page_selectors.rb +264 -0
  55. data/lib/ultracart_api/models/sfvb_page_settings_request.rb +350 -0
  56. data/lib/ultracart_api/models/sfvb_page_summary.rb +350 -0
  57. data/lib/ultracart_api/models/sfvb_template.rb +310 -0
  58. data/lib/ultracart_api/models/sfvb_templates_response.rb +232 -0
  59. data/lib/ultracart_api/version.rb +1 -1
  60. data/lib/ultracart_api.rb +26 -0
  61. metadata +53 -1
@@ -0,0 +1,260 @@
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 SfvbPageItem
18
+ # True when this page is the item's canonical home. Read only - set in the store admin.
19
+ attr_accessor :default_assignment
20
+
21
+ # The item id, as the merchant knows it.
22
+ attr_accessor :item_id
23
+
24
+ # The item's internal oid. Read only.
25
+ attr_accessor :merchant_item_oid
26
+
27
+ # Position on the page. Used only when the page sorts its items by a custom order (sort_order_child_items C).
28
+ attr_accessor :sort_order
29
+
30
+ # The item page's name under this page, so the item is shown at the page path plus url_part plus .html. Letters, digits, hyphens and underscores. When empty the item id is used.
31
+ attr_accessor :url_part
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'default_assignment' => :'default_assignment',
37
+ :'item_id' => :'item_id',
38
+ :'merchant_item_oid' => :'merchant_item_oid',
39
+ :'sort_order' => :'sort_order',
40
+ :'url_part' => :'url_part'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'default_assignment' => :'Boolean',
53
+ :'item_id' => :'String',
54
+ :'merchant_item_oid' => :'Integer',
55
+ :'sort_order' => :'Integer',
56
+ :'url_part' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPageItem` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPageItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'default_assignment')
82
+ self.default_assignment = attributes[:'default_assignment']
83
+ end
84
+
85
+ if attributes.key?(:'item_id')
86
+ self.item_id = attributes[:'item_id']
87
+ end
88
+
89
+ if attributes.key?(:'merchant_item_oid')
90
+ self.merchant_item_oid = attributes[:'merchant_item_oid']
91
+ end
92
+
93
+ if attributes.key?(:'sort_order')
94
+ self.sort_order = attributes[:'sort_order']
95
+ end
96
+
97
+ if attributes.key?(:'url_part')
98
+ self.url_part = attributes[:'url_part']
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
+ default_assignment == o.default_assignment &&
121
+ item_id == o.item_id &&
122
+ merchant_item_oid == o.merchant_item_oid &&
123
+ sort_order == o.sort_order &&
124
+ url_part == o.url_part
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [default_assignment, item_id, merchant_item_oid, sort_order, url_part].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ attributes = attributes.transform_keys(&:to_sym)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
+ self.send("#{key}=", nil)
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = UltracartClient.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end
@@ -0,0 +1,340 @@
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 SfvbPageItemSelector
18
+ # attribute - the item attribute name. Required with attribute_value.
19
+ attr_accessor :attribute_name
20
+
21
+ # attribute - the value to match.
22
+ attr_accessor :attribute_value
23
+
24
+ # item folder and item folder tree - the item folder, which must exist.
25
+ attr_accessor :item_folder_oid
26
+
27
+ # manufacturer name - required.
28
+ attr_accessor :manufacturer_name
29
+
30
+ # retail cost - the highest price.
31
+ attr_accessor :retail_cost_high
32
+
33
+ # retail cost - the lowest price. At least one of low and high is required.
34
+ attr_accessor :retail_cost_low
35
+
36
+ # sale item - match items on sale.
37
+ attr_accessor :sale_item
38
+
39
+ # tag - the item tag to match. Required.
40
+ attr_accessor :tag
41
+
42
+ # top seller - how many items, 1 to 250. Required with top_seller_days.
43
+ attr_accessor :top_seller_count
44
+
45
+ # top seller - over how many days, 1 to 180.
46
+ attr_accessor :top_seller_days
47
+
48
+ # One of retail cost, attribute, variation, not variation, manufacturer name, exploded diagram, sale item, item folder, item folder tree, top seller, new, pre-order, tag.
49
+ attr_accessor :type
50
+
51
+ # variation - the variation name. Required with variation_value.
52
+ attr_accessor :variation_name
53
+
54
+ # variation - the variation value to match.
55
+ attr_accessor :variation_value
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'attribute_name' => :'attribute_name',
61
+ :'attribute_value' => :'attribute_value',
62
+ :'item_folder_oid' => :'item_folder_oid',
63
+ :'manufacturer_name' => :'manufacturer_name',
64
+ :'retail_cost_high' => :'retail_cost_high',
65
+ :'retail_cost_low' => :'retail_cost_low',
66
+ :'sale_item' => :'sale_item',
67
+ :'tag' => :'tag',
68
+ :'top_seller_count' => :'top_seller_count',
69
+ :'top_seller_days' => :'top_seller_days',
70
+ :'type' => :'type',
71
+ :'variation_name' => :'variation_name',
72
+ :'variation_value' => :'variation_value'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'attribute_name' => :'String',
85
+ :'attribute_value' => :'String',
86
+ :'item_folder_oid' => :'Integer',
87
+ :'manufacturer_name' => :'String',
88
+ :'retail_cost_high' => :'Float',
89
+ :'retail_cost_low' => :'Float',
90
+ :'sale_item' => :'Boolean',
91
+ :'tag' => :'String',
92
+ :'top_seller_count' => :'Integer',
93
+ :'top_seller_days' => :'Integer',
94
+ :'type' => :'String',
95
+ :'variation_name' => :'String',
96
+ :'variation_value' => :'String'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPageItemSelector` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!self.class.attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPageItemSelector`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'attribute_name')
122
+ self.attribute_name = attributes[:'attribute_name']
123
+ end
124
+
125
+ if attributes.key?(:'attribute_value')
126
+ self.attribute_value = attributes[:'attribute_value']
127
+ end
128
+
129
+ if attributes.key?(:'item_folder_oid')
130
+ self.item_folder_oid = attributes[:'item_folder_oid']
131
+ end
132
+
133
+ if attributes.key?(:'manufacturer_name')
134
+ self.manufacturer_name = attributes[:'manufacturer_name']
135
+ end
136
+
137
+ if attributes.key?(:'retail_cost_high')
138
+ self.retail_cost_high = attributes[:'retail_cost_high']
139
+ end
140
+
141
+ if attributes.key?(:'retail_cost_low')
142
+ self.retail_cost_low = attributes[:'retail_cost_low']
143
+ end
144
+
145
+ if attributes.key?(:'sale_item')
146
+ self.sale_item = attributes[:'sale_item']
147
+ end
148
+
149
+ if attributes.key?(:'tag')
150
+ self.tag = attributes[:'tag']
151
+ end
152
+
153
+ if attributes.key?(:'top_seller_count')
154
+ self.top_seller_count = attributes[:'top_seller_count']
155
+ end
156
+
157
+ if attributes.key?(:'top_seller_days')
158
+ self.top_seller_days = attributes[:'top_seller_days']
159
+ end
160
+
161
+ if attributes.key?(:'type')
162
+ self.type = attributes[:'type']
163
+ end
164
+
165
+ if attributes.key?(:'variation_name')
166
+ self.variation_name = attributes[:'variation_name']
167
+ end
168
+
169
+ if attributes.key?(:'variation_value')
170
+ self.variation_value = attributes[:'variation_value']
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ invalid_properties = Array.new
178
+ invalid_properties
179
+ end
180
+
181
+ # Check to see if the all the properties in the model are valid
182
+ # @return true if the model is valid
183
+ def valid?
184
+ true
185
+ end
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] Object to be compared
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ attribute_name == o.attribute_name &&
193
+ attribute_value == o.attribute_value &&
194
+ item_folder_oid == o.item_folder_oid &&
195
+ manufacturer_name == o.manufacturer_name &&
196
+ retail_cost_high == o.retail_cost_high &&
197
+ retail_cost_low == o.retail_cost_low &&
198
+ sale_item == o.sale_item &&
199
+ tag == o.tag &&
200
+ top_seller_count == o.top_seller_count &&
201
+ top_seller_days == o.top_seller_days &&
202
+ type == o.type &&
203
+ variation_name == o.variation_name &&
204
+ variation_value == o.variation_value
205
+ end
206
+
207
+ # @see the `==` method
208
+ # @param [Object] Object to be compared
209
+ def eql?(o)
210
+ self == o
211
+ end
212
+
213
+ # Calculates hash code according to all attributes.
214
+ # @return [Integer] Hash code
215
+ def hash
216
+ [attribute_name, attribute_value, item_folder_oid, manufacturer_name, retail_cost_high, retail_cost_low, sale_item, tag, top_seller_count, top_seller_days, type, variation_name, variation_value].hash
217
+ end
218
+
219
+ # Builds the object from hash
220
+ # @param [Hash] attributes Model attributes in the form of hash
221
+ # @return [Object] Returns the model itself
222
+ def self.build_from_hash(attributes)
223
+ new.build_from_hash(attributes)
224
+ end
225
+
226
+ # Builds the object from hash
227
+ # @param [Hash] attributes Model attributes in the form of hash
228
+ # @return [Object] Returns the model itself
229
+ def build_from_hash(attributes)
230
+ return nil unless attributes.is_a?(Hash)
231
+ attributes = attributes.transform_keys(&:to_sym)
232
+ self.class.openapi_types.each_pair do |key, type|
233
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
234
+ self.send("#{key}=", nil)
235
+ elsif type =~ /\AArray<(.*)>/i
236
+ # check to ensure the input is an array given that the attribute
237
+ # is documented as an array but the input is not
238
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
239
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
240
+ end
241
+ elsif !attributes[self.class.attribute_map[key]].nil?
242
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
243
+ end
244
+ end
245
+
246
+ self
247
+ end
248
+
249
+ # Deserializes the data based on type
250
+ # @param string type Data type
251
+ # @param string value Value to be deserialized
252
+ # @return [Object] Deserialized data
253
+ def _deserialize(type, value)
254
+ case type.to_sym
255
+ when :Time
256
+ Time.parse(value)
257
+ when :Date
258
+ Date.parse(value)
259
+ when :String
260
+ value.to_s
261
+ when :Integer
262
+ value.to_i
263
+ when :Float
264
+ value.to_f
265
+ when :Boolean
266
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
267
+ true
268
+ else
269
+ false
270
+ end
271
+ when :Object
272
+ # generic object (usually a Hash), return directly
273
+ value
274
+ when /\AArray<(?<inner_type>.+)>\z/
275
+ inner_type = Regexp.last_match[:inner_type]
276
+ value.map { |v| _deserialize(inner_type, v) }
277
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
278
+ k_type = Regexp.last_match[:k_type]
279
+ v_type = Regexp.last_match[:v_type]
280
+ {}.tap do |hash|
281
+ value.each do |k, v|
282
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
283
+ end
284
+ end
285
+ else # model
286
+ # models (e.g. Pet) or oneOf
287
+ klass = UltracartClient.const_get(type)
288
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
289
+ end
290
+ end
291
+
292
+ # Returns the string representation of the object
293
+ # @return [String] String presentation of the object
294
+ def to_s
295
+ to_hash.to_s
296
+ end
297
+
298
+ # to_body is an alias to to_hash (backward compatibility)
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_body
301
+ to_hash
302
+ end
303
+
304
+ # Returns the object in the form of hash
305
+ # @return [Hash] Returns the object in the form of hash
306
+ def to_hash
307
+ hash = {}
308
+ self.class.attribute_map.each_pair do |attr, param|
309
+ value = self.send(attr)
310
+ if value.nil?
311
+ is_nullable = self.class.openapi_nullable.include?(attr)
312
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
313
+ end
314
+
315
+ hash[param] = _to_hash(value)
316
+ end
317
+ hash
318
+ end
319
+
320
+ # Outputs non-array value in the form of hash
321
+ # For object, use to_hash. Otherwise, just return the value
322
+ # @param [Object] value Any valid value
323
+ # @return [Hash] Returns the value in the form of hash
324
+ def _to_hash(value)
325
+ if value.is_a?(Array)
326
+ value.compact.map { |v| _to_hash(v) }
327
+ elsif value.is_a?(Hash)
328
+ {}.tap do |hash|
329
+ value.each { |k, v| hash[k] = _to_hash(v) }
330
+ end
331
+ elsif value.respond_to? :to_hash
332
+ value.to_hash
333
+ else
334
+ value
335
+ end
336
+ end
337
+
338
+ end
339
+
340
+ end