ultracart_api 4.1.15 → 4.1.17

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -5
  3. data/docs/CustomDashboard.md +24 -0
  4. data/docs/CustomDashboardPage.md +22 -0
  5. data/docs/CustomDashboardPageReport.md +26 -0
  6. data/docs/CustomDashboardResponse.md +26 -0
  7. data/docs/CustomDashboardsResponse.md +26 -0
  8. data/docs/CustomReportExecutionResponse.md +32 -0
  9. data/docs/CustomReportsExecutionReportData.md +22 -0
  10. data/docs/CustomReportsExecutionRequest.md +20 -0
  11. data/docs/CustomReportsExecutionResponse.md +28 -0
  12. data/docs/CustomReportsResponse.md +26 -0
  13. data/docs/DatawarehouseApi.md +379 -4
  14. data/docs/EmailEditorValuesResponse.md +26 -0
  15. data/docs/OrderApi.md +32 -67
  16. data/docs/StorefrontApi.md +52 -0
  17. data/docs/WebhookApi.md +0 -8
  18. data/lib/ultracart_api/api/datawarehouse_api.rb +460 -3
  19. data/lib/ultracart_api/api/order_api.rb +2 -93
  20. data/lib/ultracart_api/api/storefront_api.rb +62 -0
  21. data/lib/ultracart_api/api/webhook_api.rb +0 -24
  22. data/lib/ultracart_api/models/custom_dashboard.rb +248 -0
  23. data/lib/ultracart_api/models/custom_dashboard_page.rb +239 -0
  24. data/lib/ultracart_api/models/custom_dashboard_page_report.rb +255 -0
  25. data/lib/ultracart_api/models/custom_dashboard_response.rb +256 -0
  26. data/lib/ultracart_api/models/custom_dashboards_response.rb +259 -0
  27. data/lib/ultracart_api/models/custom_report_execution_response.rb +285 -0
  28. data/lib/ultracart_api/models/custom_reports_execution_report_data.rb +237 -0
  29. data/lib/ultracart_api/models/custom_reports_execution_request.rb +232 -0
  30. data/lib/ultracart_api/models/custom_reports_execution_response.rb +269 -0
  31. data/lib/ultracart_api/models/custom_reports_response.rb +259 -0
  32. data/lib/ultracart_api/models/email_editor_values_response.rb +258 -0
  33. data/lib/ultracart_api/version.rb +1 -1
  34. data/lib/ultracart_api.rb +11 -0
  35. metadata +24 -2
@@ -2729,6 +2729,68 @@ module UltracartClient
2729
2729
  return data, status_code, headers
2730
2730
  end
2731
2731
 
2732
+ # Get email merchant specific editor values
2733
+ # @param storefront_oid [Integer]
2734
+ # @param [Hash] opts the optional parameters
2735
+ # @return [EmailEditorValuesResponse]
2736
+ def get_email_commseq_editor_values(storefront_oid, opts = {})
2737
+ data, _status_code, _headers = get_email_commseq_editor_values_with_http_info(storefront_oid, opts)
2738
+ data
2739
+ end
2740
+
2741
+ # Get email merchant specific editor values
2742
+ # @param storefront_oid [Integer]
2743
+ # @param [Hash] opts the optional parameters
2744
+ # @return [Array<(EmailEditorValuesResponse, Integer, Hash)>] EmailEditorValuesResponse data, response status code and response headers
2745
+ def get_email_commseq_editor_values_with_http_info(storefront_oid, opts = {})
2746
+ if @api_client.config.debugging
2747
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_email_commseq_editor_values ...'
2748
+ end
2749
+ # verify the required parameter 'storefront_oid' is set
2750
+ if @api_client.config.client_side_validation && storefront_oid.nil?
2751
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling StorefrontApi.get_email_commseq_editor_values"
2752
+ end
2753
+ # resource path
2754
+ local_var_path = '/storefront/{storefront_oid}/email/commseqs/editorValues'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
2755
+
2756
+ # query parameters
2757
+ query_params = opts[:query_params] || {}
2758
+
2759
+ # header parameters
2760
+ header_params = opts[:header_params] || {}
2761
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
2762
+ # HTTP header 'Accept' (if needed)
2763
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2764
+
2765
+ # form parameters
2766
+ form_params = opts[:form_params] || {}
2767
+
2768
+ # http body (model)
2769
+ post_body = opts[:debug_body]
2770
+
2771
+ # return_type
2772
+ return_type = opts[:debug_return_type] || 'EmailEditorValuesResponse'
2773
+
2774
+ # auth_names
2775
+ auth_names = opts[:debug_auth_names] || ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
2776
+
2777
+ new_options = opts.merge(
2778
+ :operation => :"StorefrontApi.get_email_commseq_editor_values",
2779
+ :header_params => header_params,
2780
+ :query_params => query_params,
2781
+ :form_params => form_params,
2782
+ :body => post_body,
2783
+ :auth_names => auth_names,
2784
+ :return_type => return_type
2785
+ )
2786
+
2787
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2788
+ if @api_client.config.debugging
2789
+ @api_client.config.logger.debug "API called: StorefrontApi#get_email_commseq_editor_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2790
+ end
2791
+ return data, status_code, headers
2792
+ end
2793
+
2732
2794
  # Get email communication sequence emails stats
2733
2795
  # @param storefront_oid [Integer]
2734
2796
  # @param commseq_uuid [String]
@@ -239,14 +239,6 @@ module UltracartClient
239
239
  # Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
240
240
  # @param webhook_oid [Integer] The webhook oid to retrieve log summaries for.
241
241
  # @param [Hash] opts the optional parameters
242
- # @option opts [String] :request_id
243
- # @option opts [String] :begin_date
244
- # @option opts [String] :end_date
245
- # @option opts [String] :status
246
- # @option opts [String] :event
247
- # @option opts [String] :order_id
248
- # @option opts [String] :request
249
- # @option opts [Integer] :duration
250
242
  # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (default to 100)
251
243
  # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
252
244
  # @option opts [String] :_since Fetch log summaries that have been delivered since this date/time.
@@ -260,14 +252,6 @@ module UltracartClient
260
252
  # Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
261
253
  # @param webhook_oid [Integer] The webhook oid to retrieve log summaries for.
262
254
  # @param [Hash] opts the optional parameters
263
- # @option opts [String] :request_id
264
- # @option opts [String] :begin_date
265
- # @option opts [String] :end_date
266
- # @option opts [String] :status
267
- # @option opts [String] :event
268
- # @option opts [String] :order_id
269
- # @option opts [String] :request
270
- # @option opts [Integer] :duration
271
255
  # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (default to 100)
272
256
  # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
273
257
  # @option opts [String] :_since Fetch log summaries that have been delivered since this date/time.
@@ -285,14 +269,6 @@ module UltracartClient
285
269
 
286
270
  # query parameters
287
271
  query_params = opts[:query_params] || {}
288
- query_params[:'requestId'] = opts[:'request_id'] if !opts[:'request_id'].nil?
289
- query_params[:'beginDate'] = opts[:'begin_date'] if !opts[:'begin_date'].nil?
290
- query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
291
- query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
292
- query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
293
- query_params[:'orderId'] = opts[:'order_id'] if !opts[:'order_id'].nil?
294
- query_params[:'request'] = opts[:'request'] if !opts[:'request'].nil?
295
- query_params[:'duration'] = opts[:'duration'] if !opts[:'duration'].nil?
296
272
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
297
273
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
298
274
  query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?
@@ -0,0 +1,248 @@
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 CustomDashboard
18
+ attr_accessor :data_warehouse_custom_dashboard_oid
19
+
20
+ attr_accessor :merchant_id
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :pages
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'data_warehouse_custom_dashboard_oid' => :'data_warehouse_custom_dashboard_oid',
30
+ :'merchant_id' => :'merchant_id',
31
+ :'name' => :'name',
32
+ :'pages' => :'pages'
33
+ }
34
+ end
35
+
36
+ # Returns all the JSON keys this model knows about
37
+ def self.acceptable_attributes
38
+ attribute_map.values
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.openapi_types
43
+ {
44
+ :'data_warehouse_custom_dashboard_oid' => :'Integer',
45
+ :'merchant_id' => :'String',
46
+ :'name' => :'String',
47
+ :'pages' => :'Array<CustomDashboardPage>'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CustomDashboard` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::CustomDashboard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'data_warehouse_custom_dashboard_oid')
73
+ self.data_warehouse_custom_dashboard_oid = attributes[:'data_warehouse_custom_dashboard_oid']
74
+ end
75
+
76
+ if attributes.key?(:'merchant_id')
77
+ self.merchant_id = attributes[:'merchant_id']
78
+ end
79
+
80
+ if attributes.key?(:'name')
81
+ self.name = attributes[:'name']
82
+ end
83
+
84
+ if attributes.key?(:'pages')
85
+ if (value = attributes[:'pages']).is_a?(Array)
86
+ self.pages = value
87
+ end
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ data_warehouse_custom_dashboard_oid == o.data_warehouse_custom_dashboard_oid &&
110
+ merchant_id == o.merchant_id &&
111
+ name == o.name &&
112
+ pages == o.pages
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [data_warehouse_custom_dashboard_oid, merchant_id, name, pages].hash
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 self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = UltracartClient.const_get(type)
196
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
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
+
248
+ end
@@ -0,0 +1,239 @@
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 CustomDashboardPage
18
+ attr_accessor :page_height_inches
19
+
20
+ attr_accessor :page_width_inches
21
+
22
+ attr_accessor :reports
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'page_height_inches' => :'page_height_inches',
28
+ :'page_width_inches' => :'page_width_inches',
29
+ :'reports' => :'reports'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'page_height_inches' => :'Float',
42
+ :'page_width_inches' => :'Float',
43
+ :'reports' => :'Array<CustomDashboardPageReport>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::CustomDashboardPage` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::CustomDashboardPage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'page_height_inches')
69
+ self.page_height_inches = attributes[:'page_height_inches']
70
+ end
71
+
72
+ if attributes.key?(:'page_width_inches')
73
+ self.page_width_inches = attributes[:'page_width_inches']
74
+ end
75
+
76
+ if attributes.key?(:'reports')
77
+ if (value = attributes[:'reports']).is_a?(Array)
78
+ self.reports = value
79
+ end
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ page_height_inches == o.page_height_inches &&
102
+ page_width_inches == o.page_width_inches &&
103
+ reports == o.reports
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [page_height_inches, page_width_inches, reports].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = UltracartClient.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end