ultracart_api 3.11.16 → 3.11.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.
@@ -32,6 +32,60 @@ module UltracartClient
32
32
  UltracartClient::DatawarehouseApi.new(api_client)
33
33
  end
34
34
 
35
+ # Delete a custom dashboard
36
+ # Delete a custom dashboard on the UltraCart account.
37
+ # @param custom_dashboard_oid The dashboard oid to delete.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [nil]
40
+ def delete_custom_dashboard(custom_dashboard_oid, opts = {})
41
+ delete_custom_dashboard_with_http_info(custom_dashboard_oid, opts)
42
+ nil
43
+ end
44
+
45
+ # Delete a custom dashboard
46
+ # Delete a custom dashboard on the UltraCart account.
47
+ # @param custom_dashboard_oid The dashboard oid to delete.
48
+ # @param [Hash] opts the optional parameters
49
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
50
+ def delete_custom_dashboard_with_http_info(custom_dashboard_oid, opts = {})
51
+ if @api_client.config.debugging
52
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.delete_custom_dashboard ...'
53
+ end
54
+ # verify the required parameter 'custom_dashboard_oid' is set
55
+ if @api_client.config.client_side_validation && custom_dashboard_oid.nil?
56
+ fail ArgumentError, "Missing the required parameter 'custom_dashboard_oid' when calling DatawarehouseApi.delete_custom_dashboard"
57
+ end
58
+ # resource path
59
+ local_var_path = '/datawarehouse/custom_dashboards/{custom_dashboard_oid}'.sub('{' + 'custom_dashboard_oid' + '}', custom_dashboard_oid.to_s)
60
+
61
+ # query parameters
62
+ query_params = {}
63
+
64
+ # header parameters
65
+ header_params = {}
66
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
67
+ # HTTP header 'Accept' (if needed)
68
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
69
+ # HTTP header 'Content-Type'
70
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
71
+
72
+ # form parameters
73
+ form_params = {}
74
+
75
+ # http body (model)
76
+ post_body = nil
77
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
78
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
79
+ :header_params => header_params,
80
+ :query_params => query_params,
81
+ :form_params => form_params,
82
+ :body => post_body,
83
+ :auth_names => auth_names)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: DatawarehouseApi#delete_custom_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
35
89
  # Delete a custom report
36
90
  # Delete a custom report on the UltraCart account.
37
91
  # @param custom_report_oid The report oid to delete.
@@ -200,7 +254,7 @@ module UltracartClient
200
254
  # @param execution_request Request to execute custom report
201
255
  # @param custom_report_oid The report oid to execute.
202
256
  # @param [Hash] opts the optional parameters
203
- # @return [CustomReportResponse]
257
+ # @return [CustomReportExecutionResponse]
204
258
  def execute_custom_report(execution_request, custom_report_oid, opts = {})
205
259
  data, _status_code, _headers = execute_custom_report_with_http_info(execution_request, custom_report_oid, opts)
206
260
  data
@@ -211,7 +265,7 @@ module UltracartClient
211
265
  # @param execution_request Request to execute custom report
212
266
  # @param custom_report_oid The report oid to execute.
213
267
  # @param [Hash] opts the optional parameters
214
- # @return [Array<(CustomReportResponse, Fixnum, Hash)>] CustomReportResponse data, response status code and response headers
268
+ # @return [Array<(CustomReportExecutionResponse, Fixnum, Hash)>] CustomReportExecutionResponse data, response status code and response headers
215
269
  def execute_custom_report_with_http_info(execution_request, custom_report_oid, opts = {})
216
270
  if @api_client.config.debugging
217
271
  @api_client.config.logger.debug 'Calling API: DatawarehouseApi.execute_custom_report ...'
@@ -250,12 +304,67 @@ module UltracartClient
250
304
  :form_params => form_params,
251
305
  :body => post_body,
252
306
  :auth_names => auth_names,
253
- :return_type => 'CustomReportResponse')
307
+ :return_type => 'CustomReportExecutionResponse')
254
308
  if @api_client.config.debugging
255
309
  @api_client.config.logger.debug "API called: DatawarehouseApi#execute_custom_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
256
310
  end
257
311
  return data, status_code, headers
258
312
  end
313
+ # Execute a custom reports
314
+ # Execute a custom reports on the UltraCart account.
315
+ # @param execution_request Request to execute custom reports
316
+ # @param [Hash] opts the optional parameters
317
+ # @return [CustomReportsExecutionResponse]
318
+ def execute_custom_reports(execution_request, opts = {})
319
+ data, _status_code, _headers = execute_custom_reports_with_http_info(execution_request, opts)
320
+ data
321
+ end
322
+
323
+ # Execute a custom reports
324
+ # Execute a custom reports on the UltraCart account.
325
+ # @param execution_request Request to execute custom reports
326
+ # @param [Hash] opts the optional parameters
327
+ # @return [Array<(CustomReportsExecutionResponse, Fixnum, Hash)>] CustomReportsExecutionResponse data, response status code and response headers
328
+ def execute_custom_reports_with_http_info(execution_request, opts = {})
329
+ if @api_client.config.debugging
330
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.execute_custom_reports ...'
331
+ end
332
+ # verify the required parameter 'execution_request' is set
333
+ if @api_client.config.client_side_validation && execution_request.nil?
334
+ fail ArgumentError, "Missing the required parameter 'execution_request' when calling DatawarehouseApi.execute_custom_reports"
335
+ end
336
+ # resource path
337
+ local_var_path = '/datawarehouse/custom_reports/execute'
338
+
339
+ # query parameters
340
+ query_params = {}
341
+
342
+ # header parameters
343
+ header_params = {}
344
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
345
+ # HTTP header 'Accept' (if needed)
346
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
347
+ # HTTP header 'Content-Type'
348
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
349
+
350
+ # form parameters
351
+ form_params = {}
352
+
353
+ # http body (model)
354
+ post_body = @api_client.object_to_http_body(execution_request)
355
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
356
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
357
+ :header_params => header_params,
358
+ :query_params => query_params,
359
+ :form_params => form_params,
360
+ :body => post_body,
361
+ :auth_names => auth_names,
362
+ :return_type => 'CustomReportsExecutionResponse')
363
+ if @api_client.config.debugging
364
+ @api_client.config.logger.debug "API called: DatawarehouseApi#execute_custom_reports\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
365
+ end
366
+ return data, status_code, headers
367
+ end
259
368
  # Execute the report queries
260
369
  # Execute the report queries
261
370
  # @param query_request Query request
@@ -310,6 +419,110 @@ module UltracartClient
310
419
  end
311
420
  return data, status_code, headers
312
421
  end
422
+ # Get a custom dashboard
423
+ # Retrieve a custom dashboard
424
+ # @param custom_dashboard_oid
425
+ # @param [Hash] opts the optional parameters
426
+ # @return [CustomDashboardResponse]
427
+ def get_custom_dashboard(custom_dashboard_oid, opts = {})
428
+ data, _status_code, _headers = get_custom_dashboard_with_http_info(custom_dashboard_oid, opts)
429
+ data
430
+ end
431
+
432
+ # Get a custom dashboard
433
+ # Retrieve a custom dashboard
434
+ # @param custom_dashboard_oid
435
+ # @param [Hash] opts the optional parameters
436
+ # @return [Array<(CustomDashboardResponse, Fixnum, Hash)>] CustomDashboardResponse data, response status code and response headers
437
+ def get_custom_dashboard_with_http_info(custom_dashboard_oid, opts = {})
438
+ if @api_client.config.debugging
439
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.get_custom_dashboard ...'
440
+ end
441
+ # verify the required parameter 'custom_dashboard_oid' is set
442
+ if @api_client.config.client_side_validation && custom_dashboard_oid.nil?
443
+ fail ArgumentError, "Missing the required parameter 'custom_dashboard_oid' when calling DatawarehouseApi.get_custom_dashboard"
444
+ end
445
+ # resource path
446
+ local_var_path = '/datawarehouse/custom_dashboards/{custom_dashboard_oid}'.sub('{' + 'custom_dashboard_oid' + '}', custom_dashboard_oid.to_s)
447
+
448
+ # query parameters
449
+ query_params = {}
450
+
451
+ # header parameters
452
+ header_params = {}
453
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
454
+ # HTTP header 'Accept' (if needed)
455
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
456
+ # HTTP header 'Content-Type'
457
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
458
+
459
+ # form parameters
460
+ form_params = {}
461
+
462
+ # http body (model)
463
+ post_body = nil
464
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
465
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
466
+ :header_params => header_params,
467
+ :query_params => query_params,
468
+ :form_params => form_params,
469
+ :body => post_body,
470
+ :auth_names => auth_names,
471
+ :return_type => 'CustomDashboardResponse')
472
+ if @api_client.config.debugging
473
+ @api_client.config.logger.debug "API called: DatawarehouseApi#get_custom_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
474
+ end
475
+ return data, status_code, headers
476
+ end
477
+ # Get custom dashboards
478
+ # Retrieve a custom dashboards
479
+ # @param [Hash] opts the optional parameters
480
+ # @return [CustomDashboardsResponse]
481
+ def get_custom_dashboards(opts = {})
482
+ data, _status_code, _headers = get_custom_dashboards_with_http_info(opts)
483
+ data
484
+ end
485
+
486
+ # Get custom dashboards
487
+ # Retrieve a custom dashboards
488
+ # @param [Hash] opts the optional parameters
489
+ # @return [Array<(CustomDashboardsResponse, Fixnum, Hash)>] CustomDashboardsResponse data, response status code and response headers
490
+ def get_custom_dashboards_with_http_info(opts = {})
491
+ if @api_client.config.debugging
492
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.get_custom_dashboards ...'
493
+ end
494
+ # resource path
495
+ local_var_path = '/datawarehouse/custom_dashboards'
496
+
497
+ # query parameters
498
+ query_params = {}
499
+
500
+ # header parameters
501
+ header_params = {}
502
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
503
+ # HTTP header 'Accept' (if needed)
504
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
505
+ # HTTP header 'Content-Type'
506
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
507
+
508
+ # form parameters
509
+ form_params = {}
510
+
511
+ # http body (model)
512
+ post_body = nil
513
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
514
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
515
+ :header_params => header_params,
516
+ :query_params => query_params,
517
+ :form_params => form_params,
518
+ :body => post_body,
519
+ :auth_names => auth_names,
520
+ :return_type => 'CustomDashboardsResponse')
521
+ if @api_client.config.debugging
522
+ @api_client.config.logger.debug "API called: DatawarehouseApi#get_custom_dashboards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
523
+ end
524
+ return data, status_code, headers
525
+ end
313
526
  # Get a custom report
314
527
  # Retrieve a custom report
315
528
  # @param custom_report_oid
@@ -732,6 +945,61 @@ module UltracartClient
732
945
  end
733
946
  return data, status_code, headers
734
947
  end
948
+ # Create a custom dashboard
949
+ # Create a new custom dashboard on the UltraCart account.
950
+ # @param dashboard Dashboard to create
951
+ # @param [Hash] opts the optional parameters
952
+ # @return [CustomDashboardResponse]
953
+ def insert_custom_dashboard(dashboard, opts = {})
954
+ data, _status_code, _headers = insert_custom_dashboard_with_http_info(dashboard, opts)
955
+ data
956
+ end
957
+
958
+ # Create a custom dashboard
959
+ # Create a new custom dashboard on the UltraCart account.
960
+ # @param dashboard Dashboard to create
961
+ # @param [Hash] opts the optional parameters
962
+ # @return [Array<(CustomDashboardResponse, Fixnum, Hash)>] CustomDashboardResponse data, response status code and response headers
963
+ def insert_custom_dashboard_with_http_info(dashboard, opts = {})
964
+ if @api_client.config.debugging
965
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.insert_custom_dashboard ...'
966
+ end
967
+ # verify the required parameter 'dashboard' is set
968
+ if @api_client.config.client_side_validation && dashboard.nil?
969
+ fail ArgumentError, "Missing the required parameter 'dashboard' when calling DatawarehouseApi.insert_custom_dashboard"
970
+ end
971
+ # resource path
972
+ local_var_path = '/datawarehouse/custom_dashboards'
973
+
974
+ # query parameters
975
+ query_params = {}
976
+
977
+ # header parameters
978
+ header_params = {}
979
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
980
+ # HTTP header 'Accept' (if needed)
981
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
982
+ # HTTP header 'Content-Type'
983
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
984
+
985
+ # form parameters
986
+ form_params = {}
987
+
988
+ # http body (model)
989
+ post_body = @api_client.object_to_http_body(dashboard)
990
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
991
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
992
+ :header_params => header_params,
993
+ :query_params => query_params,
994
+ :form_params => form_params,
995
+ :body => post_body,
996
+ :auth_names => auth_names,
997
+ :return_type => 'CustomDashboardResponse')
998
+ if @api_client.config.debugging
999
+ @api_client.config.logger.debug "API called: DatawarehouseApi#insert_custom_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1000
+ end
1001
+ return data, status_code, headers
1002
+ end
735
1003
  # Create a custom report
736
1004
  # Create a new custom report on the UltraCart account.
737
1005
  # @param report Report to create
@@ -842,6 +1110,67 @@ module UltracartClient
842
1110
  end
843
1111
  return data, status_code, headers
844
1112
  end
1113
+ # Update a custom dashboard
1114
+ # Update a custom dashboard on the UltraCart account.
1115
+ # @param dashboard Dashboard to custom update
1116
+ # @param custom_dashboard_oid The dashboard oid to custom update.
1117
+ # @param [Hash] opts the optional parameters
1118
+ # @return [CustomDashboardResponse]
1119
+ def update_custom_dashboard(dashboard, custom_dashboard_oid, opts = {})
1120
+ data, _status_code, _headers = update_custom_dashboard_with_http_info(dashboard, custom_dashboard_oid, opts)
1121
+ data
1122
+ end
1123
+
1124
+ # Update a custom dashboard
1125
+ # Update a custom dashboard on the UltraCart account.
1126
+ # @param dashboard Dashboard to custom update
1127
+ # @param custom_dashboard_oid The dashboard oid to custom update.
1128
+ # @param [Hash] opts the optional parameters
1129
+ # @return [Array<(CustomDashboardResponse, Fixnum, Hash)>] CustomDashboardResponse data, response status code and response headers
1130
+ def update_custom_dashboard_with_http_info(dashboard, custom_dashboard_oid, opts = {})
1131
+ if @api_client.config.debugging
1132
+ @api_client.config.logger.debug 'Calling API: DatawarehouseApi.update_custom_dashboard ...'
1133
+ end
1134
+ # verify the required parameter 'dashboard' is set
1135
+ if @api_client.config.client_side_validation && dashboard.nil?
1136
+ fail ArgumentError, "Missing the required parameter 'dashboard' when calling DatawarehouseApi.update_custom_dashboard"
1137
+ end
1138
+ # verify the required parameter 'custom_dashboard_oid' is set
1139
+ if @api_client.config.client_side_validation && custom_dashboard_oid.nil?
1140
+ fail ArgumentError, "Missing the required parameter 'custom_dashboard_oid' when calling DatawarehouseApi.update_custom_dashboard"
1141
+ end
1142
+ # resource path
1143
+ local_var_path = '/datawarehouse/custom_dashboards/{custom_dashboard_oid}'.sub('{' + 'custom_dashboard_oid' + '}', custom_dashboard_oid.to_s)
1144
+
1145
+ # query parameters
1146
+ query_params = {}
1147
+
1148
+ # header parameters
1149
+ header_params = {}
1150
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
1151
+ # HTTP header 'Accept' (if needed)
1152
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1153
+ # HTTP header 'Content-Type'
1154
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
1155
+
1156
+ # form parameters
1157
+ form_params = {}
1158
+
1159
+ # http body (model)
1160
+ post_body = @api_client.object_to_http_body(dashboard)
1161
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
1162
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
1163
+ :header_params => header_params,
1164
+ :query_params => query_params,
1165
+ :form_params => form_params,
1166
+ :body => post_body,
1167
+ :auth_names => auth_names,
1168
+ :return_type => 'CustomDashboardResponse')
1169
+ if @api_client.config.debugging
1170
+ @api_client.config.logger.debug "API called: DatawarehouseApi#update_custom_dashboard\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1171
+ end
1172
+ return data, status_code, headers
1173
+ end
845
1174
  # Update a custom report
846
1175
  # Update a custom report on the UltraCart account.
847
1176
  # @param report Report to custom update
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class CustomDashboard
17
+ attr_accessor :data_warehouse_custom_dashboard_oid
18
+
19
+ attr_accessor :merchant_id
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :pages
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'data_warehouse_custom_dashboard_oid' => :'data_warehouse_custom_dashboard_oid',
29
+ :'merchant_id' => :'merchant_id',
30
+ :'name' => :'name',
31
+ :'pages' => :'pages'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.swagger_types
37
+ {
38
+ :'data_warehouse_custom_dashboard_oid' => :'Integer',
39
+ :'merchant_id' => :'String',
40
+ :'name' => :'String',
41
+ :'pages' => :'Array<CustomDashboardPage>'
42
+ }
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ return unless attributes.is_a?(Hash)
49
+
50
+ # convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
52
+
53
+ if attributes.has_key?(:'data_warehouse_custom_dashboard_oid')
54
+ self.data_warehouse_custom_dashboard_oid = attributes[:'data_warehouse_custom_dashboard_oid']
55
+ end
56
+
57
+ if attributes.has_key?(:'merchant_id')
58
+ self.merchant_id = attributes[:'merchant_id']
59
+ end
60
+
61
+ if attributes.has_key?(:'name')
62
+ self.name = attributes[:'name']
63
+ end
64
+
65
+ if attributes.has_key?(:'pages')
66
+ if (value = attributes[:'pages']).is_a?(Array)
67
+ self.pages = value
68
+ end
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ true
83
+ end
84
+
85
+ # Checks equality by comparing each attribute.
86
+ # @param [Object] Object to be compared
87
+ def ==(o)
88
+ return true if self.equal?(o)
89
+ self.class == o.class &&
90
+ data_warehouse_custom_dashboard_oid == o.data_warehouse_custom_dashboard_oid &&
91
+ merchant_id == o.merchant_id &&
92
+ name == o.name &&
93
+ pages == o.pages
94
+ end
95
+
96
+ # @see the `==` method
97
+ # @param [Object] Object to be compared
98
+ def eql?(o)
99
+ self == o
100
+ end
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Fixnum] Hash code
104
+ def hash
105
+ [data_warehouse_custom_dashboard_oid, merchant_id, name, pages].hash
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.swagger_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :BOOLEAN
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ temp_model = UltracartClient.const_get(type).new
166
+ temp_model.build_from_hash(value)
167
+ end
168
+ end
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_hash (backward compatibility)
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_body
179
+ to_hash
180
+ end
181
+
182
+ # Returns the object in the form of hash
183
+ # @return [Hash] Returns the object in the form of hash
184
+ def to_hash
185
+ hash = {}
186
+ self.class.attribute_map.each_pair do |attr, param|
187
+ value = self.send(attr)
188
+ next if value.nil?
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+ end