ultracart_api 3.11.22 → 3.11.23

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -4
  3. data/docs/ConversationApi.md +213 -0
  4. data/docs/ConversationDeleteKnowledgeBaseDocumentResponse.md +12 -0
  5. data/docs/ConversationInsertKnowledgeBaseDocumentRequest.md +8 -0
  6. data/docs/ConversationInsertKnowledgeBaseDocumentResponse.md +14 -0
  7. data/docs/ConversationKnowledgeBaseDocument.md +14 -0
  8. data/docs/ConversationKnowledgeBaseDocumentUploadUrl.md +9 -0
  9. data/docs/ConversationKnowledgeBaseDocumentUploadUrlResponse.md +12 -0
  10. data/docs/ConversationKnowledgeBaseDocumentsResponse.md +12 -0
  11. data/docs/CustomReportAccountConfig.md +1 -0
  12. data/docs/CustomReportUsageBreakdown.md +9 -0
  13. data/docs/CustomerApi.md +4 -5
  14. data/docs/ItemApi.md +3 -3
  15. data/docs/OrderApi.md +2 -2
  16. data/lib/ultracart_api/api/conversation_api.rb +238 -0
  17. data/lib/ultracart_api/api/customer_api.rb +6 -7
  18. data/lib/ultracart_api/api/item_api.rb +3 -3
  19. data/lib/ultracart_api/api/order_api.rb +2 -2
  20. data/lib/ultracart_api/models/conversation_delete_knowledge_base_document_response.rb +221 -0
  21. data/lib/ultracart_api/models/conversation_insert_knowledge_base_document_request.rb +184 -0
  22. data/lib/ultracart_api/models/conversation_insert_knowledge_base_document_response.rb +241 -0
  23. data/lib/ultracart_api/models/conversation_knowledge_base_document.rb +239 -0
  24. data/lib/ultracart_api/models/conversation_knowledge_base_document_upload_url.rb +193 -0
  25. data/lib/ultracart_api/models/conversation_knowledge_base_document_upload_url_response.rb +221 -0
  26. data/lib/ultracart_api/models/conversation_knowledge_base_documents_response.rb +224 -0
  27. data/lib/ultracart_api/models/custom_report_account_config.rb +12 -1
  28. data/lib/ultracart_api/models/custom_report_usage_breakdown.rb +194 -0
  29. data/lib/ultracart_api/version.rb +1 -1
  30. data/lib/ultracart_api.rb +8 -0
  31. metadata +18 -2
@@ -32,6 +32,67 @@ module UltracartClient
32
32
  UltracartClient::ConversationApi.new(api_client)
33
33
  end
34
34
 
35
+ # Delete a knowledge base document
36
+ # Delete a knowledge base document
37
+ # @param user_id
38
+ # @param document_uuid
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [ConversationDeleteKnowledgeBaseDocumentResponse]
41
+ def delete_agent_profile_knowledge_base_document(user_id, document_uuid, opts = {})
42
+ data, _status_code, _headers = delete_agent_profile_knowledge_base_document_with_http_info(user_id, document_uuid, opts)
43
+ data
44
+ end
45
+
46
+ # Delete a knowledge base document
47
+ # Delete a knowledge base document
48
+ # @param user_id
49
+ # @param document_uuid
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Array<(ConversationDeleteKnowledgeBaseDocumentResponse, Fixnum, Hash)>] ConversationDeleteKnowledgeBaseDocumentResponse data, response status code and response headers
52
+ def delete_agent_profile_knowledge_base_document_with_http_info(user_id, document_uuid, opts = {})
53
+ if @api_client.config.debugging
54
+ @api_client.config.logger.debug 'Calling API: ConversationApi.delete_agent_profile_knowledge_base_document ...'
55
+ end
56
+ # verify the required parameter 'user_id' is set
57
+ if @api_client.config.client_side_validation && user_id.nil?
58
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.delete_agent_profile_knowledge_base_document"
59
+ end
60
+ # verify the required parameter 'document_uuid' is set
61
+ if @api_client.config.client_side_validation && document_uuid.nil?
62
+ fail ArgumentError, "Missing the required parameter 'document_uuid' when calling ConversationApi.delete_agent_profile_knowledge_base_document"
63
+ end
64
+ # resource path
65
+ local_var_path = '/conversation/agent/profiles/{user_id}/knowledge_base/{document_uuid}'.sub('{' + 'user_id' + '}', user_id.to_s).sub('{' + 'document_uuid' + '}', document_uuid.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(:DELETE, 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 => 'ConversationDeleteKnowledgeBaseDocumentResponse')
91
+ if @api_client.config.debugging
92
+ @api_client.config.logger.debug "API called: ConversationApi#delete_agent_profile_knowledge_base_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
93
+ end
94
+ return data, status_code, headers
95
+ end
35
96
  # Delete a conversation canned message
36
97
  # Delete a conversation canned message
37
98
  # @param conversation_canned_message_oid
@@ -735,6 +796,61 @@ module UltracartClient
735
796
  end
736
797
  return data, status_code, headers
737
798
  end
799
+ # Get the list of knowledge base documents associated with this agent profile
800
+ # Retrieve knowledge base documents
801
+ # @param user_id
802
+ # @param [Hash] opts the optional parameters
803
+ # @return [ConversationKnowledgeBaseDocumentsResponse]
804
+ def get_agent_profile_knowledge_base(user_id, opts = {})
805
+ data, _status_code, _headers = get_agent_profile_knowledge_base_with_http_info(user_id, opts)
806
+ data
807
+ end
808
+
809
+ # Get the list of knowledge base documents associated with this agent profile
810
+ # Retrieve knowledge base documents
811
+ # @param user_id
812
+ # @param [Hash] opts the optional parameters
813
+ # @return [Array<(ConversationKnowledgeBaseDocumentsResponse, Fixnum, Hash)>] ConversationKnowledgeBaseDocumentsResponse data, response status code and response headers
814
+ def get_agent_profile_knowledge_base_with_http_info(user_id, opts = {})
815
+ if @api_client.config.debugging
816
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_agent_profile_knowledge_base ...'
817
+ end
818
+ # verify the required parameter 'user_id' is set
819
+ if @api_client.config.client_side_validation && user_id.nil?
820
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.get_agent_profile_knowledge_base"
821
+ end
822
+ # resource path
823
+ local_var_path = '/conversation/agent/profiles/{user_id}/knowledge_base'.sub('{' + 'user_id' + '}', user_id.to_s)
824
+
825
+ # query parameters
826
+ query_params = {}
827
+
828
+ # header parameters
829
+ header_params = {}
830
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
831
+ # HTTP header 'Accept' (if needed)
832
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
833
+ # HTTP header 'Content-Type'
834
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
835
+
836
+ # form parameters
837
+ form_params = {}
838
+
839
+ # http body (model)
840
+ post_body = nil
841
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
842
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
843
+ :header_params => header_params,
844
+ :query_params => query_params,
845
+ :form_params => form_params,
846
+ :body => post_body,
847
+ :auth_names => auth_names,
848
+ :return_type => 'ConversationKnowledgeBaseDocumentsResponse')
849
+ if @api_client.config.debugging
850
+ @api_client.config.logger.debug "API called: ConversationApi#get_agent_profile_knowledge_base\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
851
+ end
852
+ return data, status_code, headers
853
+ end
738
854
  # Get agent profiles
739
855
  # Retrieve the agents profile
740
856
  # @param [Hash] opts the optional parameters
@@ -1197,6 +1313,67 @@ module UltracartClient
1197
1313
  end
1198
1314
  return data, status_code, headers
1199
1315
  end
1316
+ # Get a pre-signed conversation knowledge base document upload URL
1317
+ # Get a pre-signed conversation knowledge base document upload URL
1318
+ # @param user_id
1319
+ # @param extension
1320
+ # @param [Hash] opts the optional parameters
1321
+ # @return [ConversationKnowledgeBaseDocumentUploadUrlResponse]
1322
+ def get_conversation_knowledge_base_document_upload_url(user_id, extension, opts = {})
1323
+ data, _status_code, _headers = get_conversation_knowledge_base_document_upload_url_with_http_info(user_id, extension, opts)
1324
+ data
1325
+ end
1326
+
1327
+ # Get a pre-signed conversation knowledge base document upload URL
1328
+ # Get a pre-signed conversation knowledge base document upload URL
1329
+ # @param user_id
1330
+ # @param extension
1331
+ # @param [Hash] opts the optional parameters
1332
+ # @return [Array<(ConversationKnowledgeBaseDocumentUploadUrlResponse, Fixnum, Hash)>] ConversationKnowledgeBaseDocumentUploadUrlResponse data, response status code and response headers
1333
+ def get_conversation_knowledge_base_document_upload_url_with_http_info(user_id, extension, opts = {})
1334
+ if @api_client.config.debugging
1335
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversation_knowledge_base_document_upload_url ...'
1336
+ end
1337
+ # verify the required parameter 'user_id' is set
1338
+ if @api_client.config.client_side_validation && user_id.nil?
1339
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.get_conversation_knowledge_base_document_upload_url"
1340
+ end
1341
+ # verify the required parameter 'extension' is set
1342
+ if @api_client.config.client_side_validation && extension.nil?
1343
+ fail ArgumentError, "Missing the required parameter 'extension' when calling ConversationApi.get_conversation_knowledge_base_document_upload_url"
1344
+ end
1345
+ # resource path
1346
+ local_var_path = '/conversation//rest/v2/conversation/agent/profiles/{user_id}/knowledge_base/upload_url/{extension}'.sub('{' + 'user_id' + '}', user_id.to_s).sub('{' + 'extension' + '}', extension.to_s)
1347
+
1348
+ # query parameters
1349
+ query_params = {}
1350
+
1351
+ # header parameters
1352
+ header_params = {}
1353
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
1354
+ # HTTP header 'Accept' (if needed)
1355
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1356
+ # HTTP header 'Content-Type'
1357
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1358
+
1359
+ # form parameters
1360
+ form_params = {}
1361
+
1362
+ # http body (model)
1363
+ post_body = nil
1364
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
1365
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1366
+ :header_params => header_params,
1367
+ :query_params => query_params,
1368
+ :form_params => form_params,
1369
+ :body => post_body,
1370
+ :auth_names => auth_names,
1371
+ :return_type => 'ConversationKnowledgeBaseDocumentUploadUrlResponse')
1372
+ if @api_client.config.debugging
1373
+ @api_client.config.logger.debug "API called: ConversationApi#get_conversation_knowledge_base_document_upload_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1374
+ end
1375
+ return data, status_code, headers
1376
+ end
1200
1377
  # Retrieve conversation messages
1201
1378
  # Retrieve conversation messages since a particular time
1202
1379
  # @param conversation_uuid
@@ -2949,6 +3126,67 @@ module UltracartClient
2949
3126
  end
2950
3127
  return data, status_code, headers
2951
3128
  end
3129
+ # Insert a knowledge base document
3130
+ # Insert a knowledge base document
3131
+ # @param user_id
3132
+ # @param knowledge_base_document_request Insert request
3133
+ # @param [Hash] opts the optional parameters
3134
+ # @return [ConversationInsertKnowledgeBaseDocumentResponse]
3135
+ def insert_agent_profile_knowledge_base_document(user_id, knowledge_base_document_request, opts = {})
3136
+ data, _status_code, _headers = insert_agent_profile_knowledge_base_document_with_http_info(user_id, knowledge_base_document_request, opts)
3137
+ data
3138
+ end
3139
+
3140
+ # Insert a knowledge base document
3141
+ # Insert a knowledge base document
3142
+ # @param user_id
3143
+ # @param knowledge_base_document_request Insert request
3144
+ # @param [Hash] opts the optional parameters
3145
+ # @return [Array<(ConversationInsertKnowledgeBaseDocumentResponse, Fixnum, Hash)>] ConversationInsertKnowledgeBaseDocumentResponse data, response status code and response headers
3146
+ def insert_agent_profile_knowledge_base_document_with_http_info(user_id, knowledge_base_document_request, opts = {})
3147
+ if @api_client.config.debugging
3148
+ @api_client.config.logger.debug 'Calling API: ConversationApi.insert_agent_profile_knowledge_base_document ...'
3149
+ end
3150
+ # verify the required parameter 'user_id' is set
3151
+ if @api_client.config.client_side_validation && user_id.nil?
3152
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.insert_agent_profile_knowledge_base_document"
3153
+ end
3154
+ # verify the required parameter 'knowledge_base_document_request' is set
3155
+ if @api_client.config.client_side_validation && knowledge_base_document_request.nil?
3156
+ fail ArgumentError, "Missing the required parameter 'knowledge_base_document_request' when calling ConversationApi.insert_agent_profile_knowledge_base_document"
3157
+ end
3158
+ # resource path
3159
+ local_var_path = '/conversation/agent/profiles/{user_id}/knowledge_base'.sub('{' + 'user_id' + '}', user_id.to_s)
3160
+
3161
+ # query parameters
3162
+ query_params = {}
3163
+
3164
+ # header parameters
3165
+ header_params = {}
3166
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3167
+ # HTTP header 'Accept' (if needed)
3168
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3169
+ # HTTP header 'Content-Type'
3170
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
3171
+
3172
+ # form parameters
3173
+ form_params = {}
3174
+
3175
+ # http body (model)
3176
+ post_body = @api_client.object_to_http_body(knowledge_base_document_request)
3177
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
3178
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
3179
+ :header_params => header_params,
3180
+ :query_params => query_params,
3181
+ :form_params => form_params,
3182
+ :body => post_body,
3183
+ :auth_names => auth_names,
3184
+ :return_type => 'ConversationInsertKnowledgeBaseDocumentResponse')
3185
+ if @api_client.config.debugging
3186
+ @api_client.config.logger.debug "API called: ConversationApi#insert_agent_profile_knowledge_base_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3187
+ end
3188
+ return data, status_code, headers
3189
+ end
2952
3190
  # Insert a canned message
2953
3191
  # Insert a canned message
2954
3192
  # @param canned_message Canned message
@@ -213,10 +213,10 @@ module UltracartClient
213
213
  # @param customer_profile_oid The customer oid for this wishlist.
214
214
  # @param customer_wishlist_item_oid The wishlist oid for this wishlist item to delete.
215
215
  # @param [Hash] opts the optional parameters
216
- # @return [CustomerWishListItem]
216
+ # @return [nil]
217
217
  def delete_wish_list_item(customer_profile_oid, customer_wishlist_item_oid, opts = {})
218
- data, _status_code, _headers = delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts)
219
- data
218
+ delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts)
219
+ nil
220
220
  end
221
221
 
222
222
  # Delete a customer wishlist item
@@ -224,7 +224,7 @@ module UltracartClient
224
224
  # @param customer_profile_oid The customer oid for this wishlist.
225
225
  # @param customer_wishlist_item_oid The wishlist oid for this wishlist item to delete.
226
226
  # @param [Hash] opts the optional parameters
227
- # @return [Array<(CustomerWishListItem, Fixnum, Hash)>] CustomerWishListItem data, response status code and response headers
227
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
228
228
  def delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts = {})
229
229
  if @api_client.config.debugging
230
230
  @api_client.config.logger.debug 'Calling API: CustomerApi.delete_wish_list_item ...'
@@ -249,7 +249,7 @@ module UltracartClient
249
249
  # HTTP header 'Accept' (if needed)
250
250
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
251
251
  # HTTP header 'Content-Type'
252
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
252
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
253
253
 
254
254
  # form parameters
255
255
  form_params = {}
@@ -262,8 +262,7 @@ module UltracartClient
262
262
  :query_params => query_params,
263
263
  :form_params => form_params,
264
264
  :body => post_body,
265
- :auth_names => auth_names,
266
- :return_type => 'CustomerWishListItem')
265
+ :auth_names => auth_names)
267
266
  if @api_client.config.debugging
268
267
  @api_client.config.logger.debug "API called: CustomerApi#delete_wish_list_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
269
268
  end
@@ -181,7 +181,7 @@ module UltracartClient
181
181
  # HTTP header 'Accept' (if needed)
182
182
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
183
183
  # HTTP header 'Content-Type'
184
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
184
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
185
185
 
186
186
  # form parameters
187
187
  form_params = {}
@@ -714,7 +714,7 @@ module UltracartClient
714
714
  # HTTP header 'Accept' (if needed)
715
715
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
716
716
  # HTTP header 'Content-Type'
717
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
717
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
718
718
 
719
719
  # form parameters
720
720
  form_params = {}
@@ -769,7 +769,7 @@ module UltracartClient
769
769
  # HTTP header 'Accept' (if needed)
770
770
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
771
771
  # HTTP header 'Content-Type'
772
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
772
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
773
773
 
774
774
  # form parameters
775
775
  form_params = {}
@@ -865,7 +865,7 @@ module UltracartClient
865
865
  # HTTP header 'Accept' (if needed)
866
866
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
867
867
  # HTTP header 'Content-Type'
868
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
868
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
869
869
 
870
870
  # form parameters
871
871
  form_params = {}
@@ -1245,7 +1245,7 @@ module UltracartClient
1245
1245
  # HTTP header 'Accept' (if needed)
1246
1246
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1247
1247
  # HTTP header 'Content-Type'
1248
- header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
1248
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1249
1249
 
1250
1250
  # form parameters
1251
1251
  form_params = {}
@@ -0,0 +1,221 @@
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 ConversationDeleteKnowledgeBaseDocumentResponse
17
+ attr_accessor :document_id
18
+
19
+ attr_accessor :error
20
+
21
+ attr_accessor :metadata
22
+
23
+ # Indicates if API call was successful
24
+ attr_accessor :success
25
+
26
+ attr_accessor :warning
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'document_id' => :'document_id',
32
+ :'error' => :'error',
33
+ :'metadata' => :'metadata',
34
+ :'success' => :'success',
35
+ :'warning' => :'warning'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'document_id' => :'String',
43
+ :'error' => :'Error',
44
+ :'metadata' => :'ResponseMetadata',
45
+ :'success' => :'BOOLEAN',
46
+ :'warning' => :'Warning'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'document_id')
59
+ self.document_id = attributes[:'document_id']
60
+ end
61
+
62
+ if attributes.has_key?(:'error')
63
+ self.error = attributes[:'error']
64
+ end
65
+
66
+ if attributes.has_key?(:'metadata')
67
+ self.metadata = attributes[:'metadata']
68
+ end
69
+
70
+ if attributes.has_key?(:'success')
71
+ self.success = attributes[:'success']
72
+ end
73
+
74
+ if attributes.has_key?(:'warning')
75
+ self.warning = attributes[:'warning']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ document_id == o.document_id &&
98
+ error == o.error &&
99
+ metadata == o.metadata &&
100
+ success == o.success &&
101
+ warning == o.warning
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [document_id, error, metadata, success, warning].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = UltracartClient.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end