ultracart_api 3.1.46 → 3.2.6

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.
@@ -0,0 +1,228 @@
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 'uri'
14
+
15
+ module UltracartClient
16
+ class IntegrationLogApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+
23
+ def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
24
+ api_config = Configuration.new
25
+ api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
26
+ api_config.api_version = '2017-03-01'
27
+ api_config.verify_ssl = verify_ssl
28
+
29
+ api_client = ApiClient.new(api_config)
30
+ api_client.config.debugging = debugging
31
+
32
+ UltracartClient::IntegrationLogApi.new(api_client)
33
+ end
34
+
35
+ # Retrieve an integration log
36
+ # Retrieve an integration logs from the account based identifiers
37
+ # @param pk
38
+ # @param sk
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [IntegrationLogResponse]
41
+ def get_integration_log(pk, sk, opts = {})
42
+ data, _status_code, _headers = get_integration_log_with_http_info(pk, sk, opts)
43
+ data
44
+ end
45
+
46
+ # Retrieve an integration log
47
+ # Retrieve an integration logs from the account based identifiers
48
+ # @param pk
49
+ # @param sk
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Array<(IntegrationLogResponse, Fixnum, Hash)>] IntegrationLogResponse data, response status code and response headers
52
+ def get_integration_log_with_http_info(pk, sk, opts = {})
53
+ if @api_client.config.debugging
54
+ @api_client.config.logger.debug 'Calling API: IntegrationLogApi.get_integration_log ...'
55
+ end
56
+ # verify the required parameter 'pk' is set
57
+ if @api_client.config.client_side_validation && pk.nil?
58
+ fail ArgumentError, "Missing the required parameter 'pk' when calling IntegrationLogApi.get_integration_log"
59
+ end
60
+ # verify the required parameter 'sk' is set
61
+ if @api_client.config.client_side_validation && sk.nil?
62
+ fail ArgumentError, "Missing the required parameter 'sk' when calling IntegrationLogApi.get_integration_log"
63
+ end
64
+ # resource path
65
+ local_var_path = '/integration_log/query/{pk}/{sk}'.sub('{' + 'pk' + '}', pk.to_s).sub('{' + 'sk' + '}', sk.to_s)
66
+
67
+ # query parameters
68
+ query_params = {}
69
+
70
+ # header parameters
71
+ header_params = {}
72
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
73
+ # HTTP header 'Accept' (if needed)
74
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
75
+ # HTTP header 'Content-Type'
76
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
77
+
78
+ # form parameters
79
+ form_params = {}
80
+
81
+ # http body (model)
82
+ post_body = nil
83
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
84
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
85
+ :header_params => header_params,
86
+ :query_params => query_params,
87
+ :form_params => form_params,
88
+ :body => post_body,
89
+ :auth_names => auth_names,
90
+ :return_type => 'IntegrationLogResponse')
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: IntegrationLogApi#get_integration_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
96
+ # Retrieve an integration log file
97
+ # Retrieve an integration log file from the account based identifiers
98
+ # @param pk
99
+ # @param sk
100
+ # @param uuid
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [File]
103
+ def get_integration_log_file(pk, sk, uuid, opts = {})
104
+ data, _status_code, _headers = get_integration_log_file_with_http_info(pk, sk, uuid, opts)
105
+ data
106
+ end
107
+
108
+ # Retrieve an integration log file
109
+ # Retrieve an integration log file from the account based identifiers
110
+ # @param pk
111
+ # @param sk
112
+ # @param uuid
113
+ # @param [Hash] opts the optional parameters
114
+ # @return [Array<(File, Fixnum, Hash)>] File data, response status code and response headers
115
+ def get_integration_log_file_with_http_info(pk, sk, uuid, opts = {})
116
+ if @api_client.config.debugging
117
+ @api_client.config.logger.debug 'Calling API: IntegrationLogApi.get_integration_log_file ...'
118
+ end
119
+ # verify the required parameter 'pk' is set
120
+ if @api_client.config.client_side_validation && pk.nil?
121
+ fail ArgumentError, "Missing the required parameter 'pk' when calling IntegrationLogApi.get_integration_log_file"
122
+ end
123
+ # verify the required parameter 'sk' is set
124
+ if @api_client.config.client_side_validation && sk.nil?
125
+ fail ArgumentError, "Missing the required parameter 'sk' when calling IntegrationLogApi.get_integration_log_file"
126
+ end
127
+ # verify the required parameter 'uuid' is set
128
+ if @api_client.config.client_side_validation && uuid.nil?
129
+ fail ArgumentError, "Missing the required parameter 'uuid' when calling IntegrationLogApi.get_integration_log_file"
130
+ end
131
+ # resource path
132
+ local_var_path = '/integration_log/query/{pk}/{sk}/{uuid}'.sub('{' + 'pk' + '}', pk.to_s).sub('{' + 'sk' + '}', sk.to_s).sub('{' + 'uuid' + '}', uuid.to_s)
133
+
134
+ # query parameters
135
+ query_params = {}
136
+
137
+ # header parameters
138
+ header_params = {}
139
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
140
+ # HTTP header 'Accept' (if needed)
141
+ header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
142
+ # HTTP header 'Content-Type'
143
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
144
+
145
+ # form parameters
146
+ form_params = {}
147
+
148
+ # http body (model)
149
+ post_body = nil
150
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
151
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :form_params => form_params,
155
+ :body => post_body,
156
+ :auth_names => auth_names,
157
+ :return_type => 'File')
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug "API called: IntegrationLogApi#get_integration_log_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
160
+ end
161
+ return data, status_code, headers
162
+ end
163
+ # Retrieve integration logs
164
+ # Retrieves a set of integration logs from the account based on a query object.
165
+ # @param integration_log_query Integration log query
166
+ # @param [Hash] opts the optional parameters
167
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 500) (default to 100)
168
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
169
+ # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
170
+ # @return [IntegrationLogQueryResponse]
171
+ def get_integration_logs_query(integration_log_query, opts = {})
172
+ data, _status_code, _headers = get_integration_logs_query_with_http_info(integration_log_query, opts)
173
+ data
174
+ end
175
+
176
+ # Retrieve integration logs
177
+ # Retrieves a set of integration logs from the account based on a query object.
178
+ # @param integration_log_query Integration log query
179
+ # @param [Hash] opts the optional parameters
180
+ # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Default 100, Max 500)
181
+ # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index.
182
+ # @option opts [String] :_sort The sort order of the items. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.
183
+ # @return [Array<(IntegrationLogQueryResponse, Fixnum, Hash)>] IntegrationLogQueryResponse data, response status code and response headers
184
+ def get_integration_logs_query_with_http_info(integration_log_query, opts = {})
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug 'Calling API: IntegrationLogApi.get_integration_logs_query ...'
187
+ end
188
+ # verify the required parameter 'integration_log_query' is set
189
+ if @api_client.config.client_side_validation && integration_log_query.nil?
190
+ fail ArgumentError, "Missing the required parameter 'integration_log_query' when calling IntegrationLogApi.get_integration_logs_query"
191
+ end
192
+ # resource path
193
+ local_var_path = '/integration_log/query'
194
+
195
+ # query parameters
196
+ query_params = {}
197
+ query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
198
+ query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
199
+ query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?
200
+
201
+ # header parameters
202
+ header_params = {}
203
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
204
+ # HTTP header 'Accept' (if needed)
205
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
206
+ # HTTP header 'Content-Type'
207
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
208
+
209
+ # form parameters
210
+ form_params = {}
211
+
212
+ # http body (model)
213
+ post_body = @api_client.object_to_http_body(integration_log_query)
214
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
215
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
216
+ :header_params => header_params,
217
+ :query_params => query_params,
218
+ :form_params => form_params,
219
+ :body => post_body,
220
+ :auth_names => auth_names,
221
+ :return_type => 'IntegrationLogQueryResponse')
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug "API called: IntegrationLogApi#get_integration_logs_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
224
+ end
225
+ return data, status_code, headers
226
+ end
227
+ end
228
+ end
@@ -4904,58 +4904,6 @@ module UltracartClient
4904
4904
  end
4905
4905
  return data, status_code, headers
4906
4906
  end
4907
- # Retrieve pricing tiers
4908
- # Retrieves the pricing tiers
4909
- # @param [Hash] opts the optional parameters
4910
- # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
4911
- # @return [PricingTiersResponse]
4912
- def get_pricing_tiers(opts = {})
4913
- data, _status_code, _headers = get_pricing_tiers_with_http_info(opts)
4914
- data
4915
- end
4916
-
4917
- # Retrieve pricing tiers
4918
- # Retrieves the pricing tiers
4919
- # @param [Hash] opts the optional parameters
4920
- # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
4921
- # @return [Array<(PricingTiersResponse, Fixnum, Hash)>] PricingTiersResponse data, response status code and response headers
4922
- def get_pricing_tiers_with_http_info(opts = {})
4923
- if @api_client.config.debugging
4924
- @api_client.config.logger.debug 'Calling API: StorefrontApi.get_pricing_tiers ...'
4925
- end
4926
- # resource path
4927
- local_var_path = '/storefront/pricing_tiers'
4928
-
4929
- # query parameters
4930
- query_params = {}
4931
- query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
4932
-
4933
- # header parameters
4934
- header_params = {}
4935
- header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
4936
- # HTTP header 'Accept' (if needed)
4937
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
4938
- # HTTP header 'Content-Type'
4939
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
4940
-
4941
- # form parameters
4942
- form_params = {}
4943
-
4944
- # http body (model)
4945
- post_body = nil
4946
- auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
4947
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
4948
- :header_params => header_params,
4949
- :query_params => query_params,
4950
- :form_params => form_params,
4951
- :body => post_body,
4952
- :auth_names => auth_names,
4953
- :return_type => 'PricingTiersResponse')
4954
- if @api_client.config.debugging
4955
- @api_client.config.logger.debug "API called: StorefrontApi#get_pricing_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
4956
- end
4957
- return data, status_code, headers
4958
- end
4959
4907
  # Get screen recording
4960
4908
  # Get screen recording
4961
4909
  # @param storefront_oid
@@ -5444,6 +5392,58 @@ module UltracartClient
5444
5392
  end
5445
5393
  return data, status_code, headers
5446
5394
  end
5395
+ # Retrieve pricing tiers
5396
+ # Retrieves the pricing tiers
5397
+ # @param [Hash] opts the optional parameters
5398
+ # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
5399
+ # @return [PricingTiersResponse]
5400
+ def get_store_front_pricing_tiers(opts = {})
5401
+ data, _status_code, _headers = get_store_front_pricing_tiers_with_http_info(opts)
5402
+ data
5403
+ end
5404
+
5405
+ # Retrieve pricing tiers
5406
+ # Retrieves the pricing tiers
5407
+ # @param [Hash] opts the optional parameters
5408
+ # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples
5409
+ # @return [Array<(PricingTiersResponse, Fixnum, Hash)>] PricingTiersResponse data, response status code and response headers
5410
+ def get_store_front_pricing_tiers_with_http_info(opts = {})
5411
+ if @api_client.config.debugging
5412
+ @api_client.config.logger.debug 'Calling API: StorefrontApi.get_store_front_pricing_tiers ...'
5413
+ end
5414
+ # resource path
5415
+ local_var_path = '/storefront/pricing_tiers'
5416
+
5417
+ # query parameters
5418
+ query_params = {}
5419
+ query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?
5420
+
5421
+ # header parameters
5422
+ header_params = {}
5423
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
5424
+ # HTTP header 'Accept' (if needed)
5425
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
5426
+ # HTTP header 'Content-Type'
5427
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
5428
+
5429
+ # form parameters
5430
+ form_params = {}
5431
+
5432
+ # http body (model)
5433
+ post_body = nil
5434
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
5435
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
5436
+ :header_params => header_params,
5437
+ :query_params => query_params,
5438
+ :form_params => form_params,
5439
+ :body => post_body,
5440
+ :auth_names => auth_names,
5441
+ :return_type => 'PricingTiersResponse')
5442
+ if @api_client.config.debugging
5443
+ @api_client.config.logger.debug "API called: StorefrontApi#get_store_front_pricing_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
5444
+ end
5445
+ return data, status_code, headers
5446
+ end
5447
5447
  # Get thumbnail parameters
5448
5448
  # @param thumbnail_parameters Thumbnail Parameters
5449
5449
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,325 @@
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 IntegrationLog
17
+ attr_accessor :action
18
+
19
+ attr_accessor :direction
20
+
21
+ attr_accessor :email
22
+
23
+ attr_accessor :files
24
+
25
+ attr_accessor :integration_log_oid
26
+
27
+ attr_accessor :item_id
28
+
29
+ attr_accessor :item_ipn_oid
30
+
31
+ attr_accessor :log_dts
32
+
33
+ attr_accessor :log_type
34
+
35
+ attr_accessor :logger_id
36
+
37
+ attr_accessor :logger_name
38
+
39
+ attr_accessor :logs
40
+
41
+ attr_accessor :order_ids
42
+
43
+ attr_accessor :pk
44
+
45
+ attr_accessor :sk
46
+
47
+ attr_accessor :status
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'action' => :'action',
53
+ :'direction' => :'direction',
54
+ :'email' => :'email',
55
+ :'files' => :'files',
56
+ :'integration_log_oid' => :'integration_log_oid',
57
+ :'item_id' => :'item_id',
58
+ :'item_ipn_oid' => :'item_ipn_oid',
59
+ :'log_dts' => :'log_dts',
60
+ :'log_type' => :'log_type',
61
+ :'logger_id' => :'logger_id',
62
+ :'logger_name' => :'logger_name',
63
+ :'logs' => :'logs',
64
+ :'order_ids' => :'order_ids',
65
+ :'pk' => :'pk',
66
+ :'sk' => :'sk',
67
+ :'status' => :'status'
68
+ }
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.swagger_types
73
+ {
74
+ :'action' => :'String',
75
+ :'direction' => :'String',
76
+ :'email' => :'String',
77
+ :'files' => :'Array<IntegrationLogFile>',
78
+ :'integration_log_oid' => :'Integer',
79
+ :'item_id' => :'String',
80
+ :'item_ipn_oid' => :'Integer',
81
+ :'log_dts' => :'String',
82
+ :'log_type' => :'String',
83
+ :'logger_id' => :'String',
84
+ :'logger_name' => :'String',
85
+ :'logs' => :'Array<IntegrationLogLog>',
86
+ :'order_ids' => :'Array<String>',
87
+ :'pk' => :'String',
88
+ :'sk' => :'String',
89
+ :'status' => :'String'
90
+ }
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ return unless attributes.is_a?(Hash)
97
+
98
+ # convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
100
+
101
+ if attributes.has_key?(:'action')
102
+ self.action = attributes[:'action']
103
+ end
104
+
105
+ if attributes.has_key?(:'direction')
106
+ self.direction = attributes[:'direction']
107
+ end
108
+
109
+ if attributes.has_key?(:'email')
110
+ self.email = attributes[:'email']
111
+ end
112
+
113
+ if attributes.has_key?(:'files')
114
+ if (value = attributes[:'files']).is_a?(Array)
115
+ self.files = value
116
+ end
117
+ end
118
+
119
+ if attributes.has_key?(:'integration_log_oid')
120
+ self.integration_log_oid = attributes[:'integration_log_oid']
121
+ end
122
+
123
+ if attributes.has_key?(:'item_id')
124
+ self.item_id = attributes[:'item_id']
125
+ end
126
+
127
+ if attributes.has_key?(:'item_ipn_oid')
128
+ self.item_ipn_oid = attributes[:'item_ipn_oid']
129
+ end
130
+
131
+ if attributes.has_key?(:'log_dts')
132
+ self.log_dts = attributes[:'log_dts']
133
+ end
134
+
135
+ if attributes.has_key?(:'log_type')
136
+ self.log_type = attributes[:'log_type']
137
+ end
138
+
139
+ if attributes.has_key?(:'logger_id')
140
+ self.logger_id = attributes[:'logger_id']
141
+ end
142
+
143
+ if attributes.has_key?(:'logger_name')
144
+ self.logger_name = attributes[:'logger_name']
145
+ end
146
+
147
+ if attributes.has_key?(:'logs')
148
+ if (value = attributes[:'logs']).is_a?(Array)
149
+ self.logs = value
150
+ end
151
+ end
152
+
153
+ if attributes.has_key?(:'order_ids')
154
+ if (value = attributes[:'order_ids']).is_a?(Array)
155
+ self.order_ids = value
156
+ end
157
+ end
158
+
159
+ if attributes.has_key?(:'pk')
160
+ self.pk = attributes[:'pk']
161
+ end
162
+
163
+ if attributes.has_key?(:'sk')
164
+ self.sk = attributes[:'sk']
165
+ end
166
+
167
+ if attributes.has_key?(:'status')
168
+ self.status = attributes[:'status']
169
+ end
170
+ end
171
+
172
+ # Show invalid properties with the reasons. Usually used together with valid?
173
+ # @return Array for valid properties with the reasons
174
+ def list_invalid_properties
175
+ invalid_properties = Array.new
176
+ invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ true
183
+ end
184
+
185
+ # Checks equality by comparing each attribute.
186
+ # @param [Object] Object to be compared
187
+ def ==(o)
188
+ return true if self.equal?(o)
189
+ self.class == o.class &&
190
+ action == o.action &&
191
+ direction == o.direction &&
192
+ email == o.email &&
193
+ files == o.files &&
194
+ integration_log_oid == o.integration_log_oid &&
195
+ item_id == o.item_id &&
196
+ item_ipn_oid == o.item_ipn_oid &&
197
+ log_dts == o.log_dts &&
198
+ log_type == o.log_type &&
199
+ logger_id == o.logger_id &&
200
+ logger_name == o.logger_name &&
201
+ logs == o.logs &&
202
+ order_ids == o.order_ids &&
203
+ pk == o.pk &&
204
+ sk == o.sk &&
205
+ status == o.status
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Fixnum] Hash code
216
+ def hash
217
+ [action, direction, email, files, integration_log_oid, item_id, item_ipn_oid, log_dts, log_type, logger_id, logger_name, logs, order_ids, pk, sk, status].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ self.class.swagger_types.each_pair do |key, type|
226
+ if type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
230
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
231
+ end
232
+ elsif !attributes[self.class.attribute_map[key]].nil?
233
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :DateTime
247
+ DateTime.parse(value)
248
+ when :Date
249
+ Date.parse(value)
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :BOOLEAN
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else # model
277
+ temp_model = UltracartClient.const_get(type).new
278
+ temp_model.build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ next if value.nil?
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+
324
+ end
325
+ end