ultracart_api 3.10.49 → 3.10.51

Sign up to get free protection for your applications and to get access to all the features.
@@ -616,6 +616,65 @@ module UltracartClient
616
616
  end
617
617
  return data, status_code, headers
618
618
  end
619
+ # Create file manager directory
620
+ # @param id
621
+ # @param [Hash] opts the optional parameters
622
+ # @option opts [String] :name
623
+ # @option opts [Integer] :parent_storefront_fs_directory_oid
624
+ # @return [FileManagerPage]
625
+ def create_fs_directory(id, opts = {})
626
+ data, _status_code, _headers = create_fs_directory_with_http_info(id, opts)
627
+ data
628
+ end
629
+
630
+ # Create file manager directory
631
+ # @param id
632
+ # @param [Hash] opts the optional parameters
633
+ # @option opts [String] :name
634
+ # @option opts [Integer] :parent_storefront_fs_directory_oid
635
+ # @return [Array<(FileManagerPage, Fixnum, Hash)>] FileManagerPage data, response status code and response headers
636
+ def create_fs_directory_with_http_info(id, opts = {})
637
+ if @api_client.config.debugging
638
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.create_fs_directory ...'
639
+ end
640
+ # verify the required parameter 'id' is set
641
+ if @api_client.config.client_side_validation && id.nil?
642
+ fail ArgumentError, "Missing the required parameter 'id' when calling StorefrontApi.create_fs_directory"
643
+ end
644
+ # resource path
645
+ local_var_path = '/storefront/{id}/fs/dir'.sub('{' + 'id' + '}', id.to_s)
646
+
647
+ # query parameters
648
+ query_params = {}
649
+ query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
650
+ query_params[:'parent_storefront_fs_directory_oid'] = opts[:'parent_storefront_fs_directory_oid'] if !opts[:'parent_storefront_fs_directory_oid'].nil?
651
+
652
+ # header parameters
653
+ header_params = {}
654
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
655
+ # HTTP header 'Accept' (if needed)
656
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
657
+ # HTTP header 'Content-Type'
658
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
659
+
660
+ # form parameters
661
+ form_params = {}
662
+
663
+ # http body (model)
664
+ post_body = nil
665
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
666
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
667
+ :header_params => header_params,
668
+ :query_params => query_params,
669
+ :form_params => form_params,
670
+ :body => post_body,
671
+ :auth_names => auth_names,
672
+ :return_type => 'FileManagerPage')
673
+ if @api_client.config.debugging
674
+ @api_client.config.logger.debug "API called: StorefrontApi#create_fs_directory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
675
+ end
676
+ return data, status_code, headers
677
+ end
619
678
  # Create Twilio account
620
679
  # @param twilio Twilio
621
680
  # @param [Hash] opts the optional parameters
@@ -1198,6 +1257,65 @@ module UltracartClient
1198
1257
  end
1199
1258
  return data, status_code, headers
1200
1259
  end
1260
+ # Delete file manager directory
1261
+ # @param id
1262
+ # @param [Hash] opts the optional parameters
1263
+ # @option opts [Integer] :parent_storefront_fs_directory_oid
1264
+ # @option opts [Integer] :storefront_fs_file_oid
1265
+ # @return [FileManagerPage]
1266
+ def delete_fs_file(id, opts = {})
1267
+ data, _status_code, _headers = delete_fs_file_with_http_info(id, opts)
1268
+ data
1269
+ end
1270
+
1271
+ # Delete file manager directory
1272
+ # @param id
1273
+ # @param [Hash] opts the optional parameters
1274
+ # @option opts [Integer] :parent_storefront_fs_directory_oid
1275
+ # @option opts [Integer] :storefront_fs_file_oid
1276
+ # @return [Array<(FileManagerPage, Fixnum, Hash)>] FileManagerPage data, response status code and response headers
1277
+ def delete_fs_file_with_http_info(id, opts = {})
1278
+ if @api_client.config.debugging
1279
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.delete_fs_file ...'
1280
+ end
1281
+ # verify the required parameter 'id' is set
1282
+ if @api_client.config.client_side_validation && id.nil?
1283
+ fail ArgumentError, "Missing the required parameter 'id' when calling StorefrontApi.delete_fs_file"
1284
+ end
1285
+ # resource path
1286
+ local_var_path = '/storefront/{id}/fs/file'.sub('{' + 'id' + '}', id.to_s)
1287
+
1288
+ # query parameters
1289
+ query_params = {}
1290
+ query_params[:'parent_storefront_fs_directory_oid'] = opts[:'parent_storefront_fs_directory_oid'] if !opts[:'parent_storefront_fs_directory_oid'].nil?
1291
+ query_params[:'storefront_fs_file_oid'] = opts[:'storefront_fs_file_oid'] if !opts[:'storefront_fs_file_oid'].nil?
1292
+
1293
+ # header parameters
1294
+ header_params = {}
1295
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
1296
+ # HTTP header 'Accept' (if needed)
1297
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1298
+ # HTTP header 'Content-Type'
1299
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1300
+
1301
+ # form parameters
1302
+ form_params = {}
1303
+
1304
+ # http body (model)
1305
+ post_body = nil
1306
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
1307
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
1308
+ :header_params => header_params,
1309
+ :query_params => query_params,
1310
+ :form_params => form_params,
1311
+ :body => post_body,
1312
+ :auth_names => auth_names,
1313
+ :return_type => 'FileManagerPage')
1314
+ if @api_client.config.debugging
1315
+ @api_client.config.logger.debug "API called: StorefrontApi#delete_fs_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1316
+ end
1317
+ return data, status_code, headers
1318
+ end
1201
1319
  # Delete screen recording heatmap
1202
1320
  # Delete screen recording heatmap
1203
1321
  # @param storefront_oid
@@ -5011,6 +5129,68 @@ module UltracartClient
5011
5129
  end
5012
5130
  return data, status_code, headers
5013
5131
  end
5132
+ # Get file manager directory
5133
+ # @param id
5134
+ # @param [Hash] opts the optional parameters
5135
+ # @option opts [String] :path
5136
+ # @option opts [Integer] :storefront_fs_directory_oid
5137
+ # @option opts [Integer] :storefront_theme_oid
5138
+ # @return [FileManagerPage]
5139
+ def get_fs_directory(id, opts = {})
5140
+ data, _status_code, _headers = get_fs_directory_with_http_info(id, opts)
5141
+ data
5142
+ end
5143
+
5144
+ # Get file manager directory
5145
+ # @param id
5146
+ # @param [Hash] opts the optional parameters
5147
+ # @option opts [String] :path
5148
+ # @option opts [Integer] :storefront_fs_directory_oid
5149
+ # @option opts [Integer] :storefront_theme_oid
5150
+ # @return [Array<(FileManagerPage, Fixnum, Hash)>] FileManagerPage data, response status code and response headers
5151
+ def get_fs_directory_with_http_info(id, opts = {})
5152
+ if @api_client.config.debugging
5153
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_fs_directory ...'
5154
+ end
5155
+ # verify the required parameter 'id' is set
5156
+ if @api_client.config.client_side_validation && id.nil?
5157
+ fail ArgumentError, "Missing the required parameter 'id' when calling StorefrontApi.get_fs_directory"
5158
+ end
5159
+ # resource path
5160
+ local_var_path = '/storefront/{id}/fs/dir'.sub('{' + 'id' + '}', id.to_s)
5161
+
5162
+ # query parameters
5163
+ query_params = {}
5164
+ query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?
5165
+ query_params[:'storefront_fs_directory_oid'] = opts[:'storefront_fs_directory_oid'] if !opts[:'storefront_fs_directory_oid'].nil?
5166
+ query_params[:'storefront_theme_oid'] = opts[:'storefront_theme_oid'] if !opts[:'storefront_theme_oid'].nil?
5167
+
5168
+ # header parameters
5169
+ header_params = {}
5170
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
5171
+ # HTTP header 'Accept' (if needed)
5172
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
5173
+ # HTTP header 'Content-Type'
5174
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
5175
+
5176
+ # form parameters
5177
+ form_params = {}
5178
+
5179
+ # http body (model)
5180
+ post_body = nil
5181
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
5182
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
5183
+ :header_params => header_params,
5184
+ :query_params => query_params,
5185
+ :form_params => form_params,
5186
+ :body => post_body,
5187
+ :auth_names => auth_names,
5188
+ :return_type => 'FileManagerPage')
5189
+ if @api_client.config.debugging
5190
+ @api_client.config.logger.debug "API called: StorefrontApi#get_fs_directory\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
5191
+ end
5192
+ return data, status_code, headers
5193
+ end
5014
5194
  # Get screen recording heatmap
5015
5195
  # Get screen recording heatmap
5016
5196
  # @param storefront_oid
@@ -6332,6 +6512,65 @@ module UltracartClient
6332
6512
  end
6333
6513
  return data, status_code, headers
6334
6514
  end
6515
+ # Retrieves a S3 url where a file may be uploaded. Once uploaded, use uploadFsFile to trigger the server into reading the S3 bucket and retrieving the file.
6516
+ # @param id
6517
+ # @param extension
6518
+ # @param [Hash] opts the optional parameters
6519
+ # @return [FileManagerUploadUrlResponse]
6520
+ def get_upload_fs_file_url(id, extension, opts = {})
6521
+ data, _status_code, _headers = get_upload_fs_file_url_with_http_info(id, extension, opts)
6522
+ data
6523
+ end
6524
+
6525
+ # Retrieves a S3 url where a file may be uploaded. Once uploaded, use uploadFsFile to trigger the server into reading the S3 bucket and retrieving the file.
6526
+ # @param id
6527
+ # @param extension
6528
+ # @param [Hash] opts the optional parameters
6529
+ # @return [Array<(FileManagerUploadUrlResponse, Fixnum, Hash)>] FileManagerUploadUrlResponse data, response status code and response headers
6530
+ def get_upload_fs_file_url_with_http_info(id, extension, opts = {})
6531
+ if @api_client.config.debugging
6532
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_upload_fs_file_url ...'
6533
+ end
6534
+ # verify the required parameter 'id' is set
6535
+ if @api_client.config.client_side_validation && id.nil?
6536
+ fail ArgumentError, "Missing the required parameter 'id' when calling StorefrontApi.get_upload_fs_file_url"
6537
+ end
6538
+ # verify the required parameter 'extension' is set
6539
+ if @api_client.config.client_side_validation && extension.nil?
6540
+ fail ArgumentError, "Missing the required parameter 'extension' when calling StorefrontApi.get_upload_fs_file_url"
6541
+ end
6542
+ # resource path
6543
+ local_var_path = '/storefront/{id}/fs/upload_url/{extension}'.sub('{' + 'id' + '}', id.to_s).sub('{' + 'extension' + '}', extension.to_s)
6544
+
6545
+ # query parameters
6546
+ query_params = {}
6547
+
6548
+ # header parameters
6549
+ header_params = {}
6550
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
6551
+ # HTTP header 'Accept' (if needed)
6552
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
6553
+ # HTTP header 'Content-Type'
6554
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
6555
+
6556
+ # form parameters
6557
+ form_params = {}
6558
+
6559
+ # http body (model)
6560
+ post_body = nil
6561
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
6562
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
6563
+ :header_params => header_params,
6564
+ :query_params => query_params,
6565
+ :form_params => form_params,
6566
+ :body => post_body,
6567
+ :auth_names => auth_names,
6568
+ :return_type => 'FileManagerUploadUrlResponse')
6569
+ if @api_client.config.debugging
6570
+ @api_client.config.logger.debug "API called: StorefrontApi#get_upload_fs_file_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
6571
+ end
6572
+ return data, status_code, headers
6573
+ end
6335
6574
  # Globally unsubscribe a customer
6336
6575
  # @param storefront_oid
6337
6576
  # @param unsubscribe Unsubscribe
@@ -9784,6 +10023,64 @@ module UltracartClient
9784
10023
  end
9785
10024
  return data, status_code, headers
9786
10025
  end
10026
+ # This is the last step in uploading a file after 1) calling getUploadFsFileUrl and 2) uploading a file to the provided url, then finally 3) calling this method and providing the key to trigger the server into reading the S3 bucket and retrieving the file.
10027
+ # @param id
10028
+ # @param upload_request UploadRequest
10029
+ # @param [Hash] opts the optional parameters
10030
+ # @return [nil]
10031
+ def upload_fs_file(id, upload_request, opts = {})
10032
+ upload_fs_file_with_http_info(id, upload_request, opts)
10033
+ nil
10034
+ end
10035
+
10036
+ # This is the last step in uploading a file after 1) calling getUploadFsFileUrl and 2) uploading a file to the provided url, then finally 3) calling this method and providing the key to trigger the server into reading the S3 bucket and retrieving the file.
10037
+ # @param id
10038
+ # @param upload_request UploadRequest
10039
+ # @param [Hash] opts the optional parameters
10040
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
10041
+ def upload_fs_file_with_http_info(id, upload_request, opts = {})
10042
+ if @api_client.config.debugging
10043
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.upload_fs_file ...'
10044
+ end
10045
+ # verify the required parameter 'id' is set
10046
+ if @api_client.config.client_side_validation && id.nil?
10047
+ fail ArgumentError, "Missing the required parameter 'id' when calling StorefrontApi.upload_fs_file"
10048
+ end
10049
+ # verify the required parameter 'upload_request' is set
10050
+ if @api_client.config.client_side_validation && upload_request.nil?
10051
+ fail ArgumentError, "Missing the required parameter 'upload_request' when calling StorefrontApi.upload_fs_file"
10052
+ end
10053
+ # resource path
10054
+ local_var_path = '/storefront/{id}/fs/upload'.sub('{' + 'id' + '}', id.to_s)
10055
+
10056
+ # query parameters
10057
+ query_params = {}
10058
+
10059
+ # header parameters
10060
+ header_params = {}
10061
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
10062
+ # HTTP header 'Accept' (if needed)
10063
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
10064
+ # HTTP header 'Content-Type'
10065
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
10066
+
10067
+ # form parameters
10068
+ form_params = {}
10069
+
10070
+ # http body (model)
10071
+ post_body = @api_client.object_to_http_body(upload_request)
10072
+ auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey']
10073
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
10074
+ :header_params => header_params,
10075
+ :query_params => query_params,
10076
+ :form_params => form_params,
10077
+ :body => post_body,
10078
+ :auth_names => auth_names)
10079
+ if @api_client.config.debugging
10080
+ @api_client.config.logger.debug "API called: StorefrontApi#upload_fs_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
10081
+ end
10082
+ return data, status_code, headers
10083
+ end
9787
10084
  # Validate AWS Event Ruler
9788
10085
  # @param ruler_validate_request Ruler Validate Request
9789
10086
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,292 @@
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 FileManagerDirectory
17
+ attr_accessor :active_theme_directory
18
+
19
+ attr_accessor :favorite
20
+
21
+ attr_accessor :hostname
22
+
23
+ attr_accessor :icon
24
+
25
+ attr_accessor :last_modified
26
+
27
+ attr_accessor :name
28
+
29
+ attr_accessor :parent_storefront_fs_directory_oid
30
+
31
+ attr_accessor :part_of_active_theme
32
+
33
+ attr_accessor :selected
34
+
35
+ attr_accessor :storefront_fs_directory_oid
36
+
37
+ attr_accessor :storefront_fs_file_oid
38
+
39
+ attr_accessor :storefront_oid
40
+
41
+ attr_accessor :type
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'active_theme_directory' => :'active_theme_directory',
47
+ :'favorite' => :'favorite',
48
+ :'hostname' => :'hostname',
49
+ :'icon' => :'icon',
50
+ :'last_modified' => :'last_modified',
51
+ :'name' => :'name',
52
+ :'parent_storefront_fs_directory_oid' => :'parent_storefront_fs_directory_oid',
53
+ :'part_of_active_theme' => :'part_of_active_theme',
54
+ :'selected' => :'selected',
55
+ :'storefront_fs_directory_oid' => :'storefront_fs_directory_oid',
56
+ :'storefront_fs_file_oid' => :'storefront_fs_file_oid',
57
+ :'storefront_oid' => :'storefront_oid',
58
+ :'type' => :'type'
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ :'active_theme_directory' => :'BOOLEAN',
66
+ :'favorite' => :'BOOLEAN',
67
+ :'hostname' => :'String',
68
+ :'icon' => :'String',
69
+ :'last_modified' => :'String',
70
+ :'name' => :'String',
71
+ :'parent_storefront_fs_directory_oid' => :'Integer',
72
+ :'part_of_active_theme' => :'BOOLEAN',
73
+ :'selected' => :'BOOLEAN',
74
+ :'storefront_fs_directory_oid' => :'Integer',
75
+ :'storefront_fs_file_oid' => :'Integer',
76
+ :'storefront_oid' => :'Integer',
77
+ :'type' => :'String'
78
+ }
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ return unless attributes.is_a?(Hash)
85
+
86
+ # convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
88
+
89
+ if attributes.has_key?(:'active_theme_directory')
90
+ self.active_theme_directory = attributes[:'active_theme_directory']
91
+ end
92
+
93
+ if attributes.has_key?(:'favorite')
94
+ self.favorite = attributes[:'favorite']
95
+ end
96
+
97
+ if attributes.has_key?(:'hostname')
98
+ self.hostname = attributes[:'hostname']
99
+ end
100
+
101
+ if attributes.has_key?(:'icon')
102
+ self.icon = attributes[:'icon']
103
+ end
104
+
105
+ if attributes.has_key?(:'last_modified')
106
+ self.last_modified = attributes[:'last_modified']
107
+ end
108
+
109
+ if attributes.has_key?(:'name')
110
+ self.name = attributes[:'name']
111
+ end
112
+
113
+ if attributes.has_key?(:'parent_storefront_fs_directory_oid')
114
+ self.parent_storefront_fs_directory_oid = attributes[:'parent_storefront_fs_directory_oid']
115
+ end
116
+
117
+ if attributes.has_key?(:'part_of_active_theme')
118
+ self.part_of_active_theme = attributes[:'part_of_active_theme']
119
+ end
120
+
121
+ if attributes.has_key?(:'selected')
122
+ self.selected = attributes[:'selected']
123
+ end
124
+
125
+ if attributes.has_key?(:'storefront_fs_directory_oid')
126
+ self.storefront_fs_directory_oid = attributes[:'storefront_fs_directory_oid']
127
+ end
128
+
129
+ if attributes.has_key?(:'storefront_fs_file_oid')
130
+ self.storefront_fs_file_oid = attributes[:'storefront_fs_file_oid']
131
+ end
132
+
133
+ if attributes.has_key?(:'storefront_oid')
134
+ self.storefront_oid = attributes[:'storefront_oid']
135
+ end
136
+
137
+ if attributes.has_key?(:'type')
138
+ self.type = attributes[:'type']
139
+ end
140
+ end
141
+
142
+ # Show invalid properties with the reasons. Usually used together with valid?
143
+ # @return Array for valid properties with the reasons
144
+ def list_invalid_properties
145
+ invalid_properties = Array.new
146
+ invalid_properties
147
+ end
148
+
149
+ # Check to see if the all the properties in the model are valid
150
+ # @return true if the model is valid
151
+ def valid?
152
+ true
153
+ end
154
+
155
+ # Checks equality by comparing each attribute.
156
+ # @param [Object] Object to be compared
157
+ def ==(o)
158
+ return true if self.equal?(o)
159
+ self.class == o.class &&
160
+ active_theme_directory == o.active_theme_directory &&
161
+ favorite == o.favorite &&
162
+ hostname == o.hostname &&
163
+ icon == o.icon &&
164
+ last_modified == o.last_modified &&
165
+ name == o.name &&
166
+ parent_storefront_fs_directory_oid == o.parent_storefront_fs_directory_oid &&
167
+ part_of_active_theme == o.part_of_active_theme &&
168
+ selected == o.selected &&
169
+ storefront_fs_directory_oid == o.storefront_fs_directory_oid &&
170
+ storefront_fs_file_oid == o.storefront_fs_file_oid &&
171
+ storefront_oid == o.storefront_oid &&
172
+ type == o.type
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Fixnum] Hash code
183
+ def hash
184
+ [active_theme_directory, favorite, hostname, icon, last_modified, name, parent_storefront_fs_directory_oid, part_of_active_theme, selected, storefront_fs_directory_oid, storefront_fs_file_oid, storefront_oid, type].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ self.class.swagger_types.each_pair do |key, type|
193
+ if type =~ /\AArray<(.*)>/i
194
+ # check to ensure the input is an array given that the attribute
195
+ # is documented as an array but the input is not
196
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
197
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
202
+ end
203
+
204
+ self
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def _deserialize(type, value)
212
+ case type.to_sym
213
+ when :DateTime
214
+ DateTime.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :BOOLEAN
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ temp_model = UltracartClient.const_get(type).new
245
+ temp_model.build_from_hash(value)
246
+ end
247
+ end
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # to_body is an alias to to_hash (backward compatibility)
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_body
258
+ to_hash
259
+ end
260
+
261
+ # Returns the object in the form of hash
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_hash
264
+ hash = {}
265
+ self.class.attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ next if value.nil?
268
+ hash[param] = _to_hash(value)
269
+ end
270
+ hash
271
+ end
272
+
273
+ # Outputs non-array value in the form of hash
274
+ # For object, use to_hash. Otherwise, just return the value
275
+ # @param [Object] value Any valid value
276
+ # @return [Hash] Returns the value in the form of hash
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map { |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+ end