ultracart_api 4.1.22 → 4.1.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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +15 -2
  3. data/docs/ConversationApi.md +219 -0
  4. data/docs/ConversationDeleteKnowledgeBaseDocumentResponse.md +26 -0
  5. data/docs/ConversationInsertKnowledgeBaseDocumentRequest.md +18 -0
  6. data/docs/ConversationInsertKnowledgeBaseDocumentResponse.md +30 -0
  7. data/docs/ConversationKnowledgeBaseDocument.md +30 -0
  8. data/docs/ConversationKnowledgeBaseDocumentUploadUrl.md +20 -0
  9. data/docs/ConversationKnowledgeBaseDocumentUploadUrlResponse.md +26 -0
  10. data/docs/ConversationKnowledgeBaseDocumentsResponse.md +26 -0
  11. data/docs/CustomReportAccountConfig.md +2 -0
  12. data/docs/CustomReportUsageBreakdown.md +20 -0
  13. data/docs/CustomerApi.md +5 -5
  14. data/lib/ultracart_api/api/conversation_api.rb +279 -0
  15. data/lib/ultracart_api/api/customer_api.rb +5 -5
  16. data/lib/ultracart_api/models/conversation_delete_knowledge_base_document_response.rb +256 -0
  17. data/lib/ultracart_api/models/conversation_insert_knowledge_base_document_request.rb +219 -0
  18. data/lib/ultracart_api/models/conversation_insert_knowledge_base_document_response.rb +276 -0
  19. data/lib/ultracart_api/models/conversation_knowledge_base_document.rb +274 -0
  20. data/lib/ultracart_api/models/conversation_knowledge_base_document_upload_url.rb +228 -0
  21. data/lib/ultracart_api/models/conversation_knowledge_base_document_upload_url_response.rb +256 -0
  22. data/lib/ultracart_api/models/conversation_knowledge_base_documents_response.rb +259 -0
  23. data/lib/ultracart_api/models/custom_report_account_config.rb +12 -1
  24. data/lib/ultracart_api/models/custom_report_usage_breakdown.rb +229 -0
  25. data/lib/ultracart_api/version.rb +1 -1
  26. data/lib/ultracart_api.rb +8 -0
  27. metadata +18 -2
@@ -32,6 +32,76 @@ 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 [Integer]
38
+ # @param document_uuid [String]
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 [Integer]
49
+ # @param document_uuid [String]
50
+ # @param [Hash] opts the optional parameters
51
+ # @return [Array<(ConversationDeleteKnowledgeBaseDocumentResponse, Integer, 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' + '}', CGI.escape(user_id.to_s)).sub('{' + 'document_uuid' + '}', CGI.escape(document_uuid.to_s))
66
+
67
+ # query parameters
68
+ query_params = opts[:query_params] || {}
69
+
70
+ # header parameters
71
+ header_params = opts[: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
+
76
+ # form parameters
77
+ form_params = opts[:form_params] || {}
78
+
79
+ # http body (model)
80
+ post_body = opts[:debug_body]
81
+
82
+ # return_type
83
+ return_type = opts[:debug_return_type] || 'ConversationDeleteKnowledgeBaseDocumentResponse'
84
+
85
+ # auth_names
86
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
87
+
88
+ new_options = opts.merge(
89
+ :operation => :"ConversationApi.delete_agent_profile_knowledge_base_document",
90
+ :header_params => header_params,
91
+ :query_params => query_params,
92
+ :form_params => form_params,
93
+ :body => post_body,
94
+ :auth_names => auth_names,
95
+ :return_type => return_type
96
+ )
97
+
98
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug "API called: ConversationApi#delete_agent_profile_knowledge_base_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
101
+ end
102
+ return data, status_code, headers
103
+ end
104
+
35
105
  # Delete a conversation canned message
36
106
  # Delete a conversation canned message
37
107
  # @param conversation_canned_message_oid [Integer]
@@ -858,6 +928,70 @@ module UltracartClient
858
928
  return data, status_code, headers
859
929
  end
860
930
 
931
+ # Get the list of knowledge base documents associated with this agent profile
932
+ # Retrieve knowledge base documents
933
+ # @param user_id [Integer]
934
+ # @param [Hash] opts the optional parameters
935
+ # @return [ConversationKnowledgeBaseDocumentsResponse]
936
+ def get_agent_profile_knowledge_base(user_id, opts = {})
937
+ data, _status_code, _headers = get_agent_profile_knowledge_base_with_http_info(user_id, opts)
938
+ data
939
+ end
940
+
941
+ # Get the list of knowledge base documents associated with this agent profile
942
+ # Retrieve knowledge base documents
943
+ # @param user_id [Integer]
944
+ # @param [Hash] opts the optional parameters
945
+ # @return [Array<(ConversationKnowledgeBaseDocumentsResponse, Integer, Hash)>] ConversationKnowledgeBaseDocumentsResponse data, response status code and response headers
946
+ def get_agent_profile_knowledge_base_with_http_info(user_id, opts = {})
947
+ if @api_client.config.debugging
948
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_agent_profile_knowledge_base ...'
949
+ end
950
+ # verify the required parameter 'user_id' is set
951
+ if @api_client.config.client_side_validation && user_id.nil?
952
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.get_agent_profile_knowledge_base"
953
+ end
954
+ # resource path
955
+ local_var_path = '/conversation/agent/profiles/{user_id}/knowledge_base'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
956
+
957
+ # query parameters
958
+ query_params = opts[:query_params] || {}
959
+
960
+ # header parameters
961
+ header_params = opts[:header_params] || {}
962
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
963
+ # HTTP header 'Accept' (if needed)
964
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
965
+
966
+ # form parameters
967
+ form_params = opts[:form_params] || {}
968
+
969
+ # http body (model)
970
+ post_body = opts[:debug_body]
971
+
972
+ # return_type
973
+ return_type = opts[:debug_return_type] || 'ConversationKnowledgeBaseDocumentsResponse'
974
+
975
+ # auth_names
976
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
977
+
978
+ new_options = opts.merge(
979
+ :operation => :"ConversationApi.get_agent_profile_knowledge_base",
980
+ :header_params => header_params,
981
+ :query_params => query_params,
982
+ :form_params => form_params,
983
+ :body => post_body,
984
+ :auth_names => auth_names,
985
+ :return_type => return_type
986
+ )
987
+
988
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
989
+ if @api_client.config.debugging
990
+ @api_client.config.logger.debug "API called: ConversationApi#get_agent_profile_knowledge_base\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
991
+ end
992
+ return data, status_code, headers
993
+ end
994
+
861
995
  # Get agent profiles
862
996
  # Retrieve the agents profile
863
997
  # @param [Hash] opts the optional parameters
@@ -1401,6 +1535,76 @@ module UltracartClient
1401
1535
  return data, status_code, headers
1402
1536
  end
1403
1537
 
1538
+ # Get a pre-signed conversation knowledge base document upload URL
1539
+ # Get a pre-signed conversation knowledge base document upload URL
1540
+ # @param user_id [Integer]
1541
+ # @param extension [String]
1542
+ # @param [Hash] opts the optional parameters
1543
+ # @return [ConversationKnowledgeBaseDocumentUploadUrlResponse]
1544
+ def get_conversation_knowledge_base_document_upload_url(user_id, extension, opts = {})
1545
+ data, _status_code, _headers = get_conversation_knowledge_base_document_upload_url_with_http_info(user_id, extension, opts)
1546
+ data
1547
+ end
1548
+
1549
+ # Get a pre-signed conversation knowledge base document upload URL
1550
+ # Get a pre-signed conversation knowledge base document upload URL
1551
+ # @param user_id [Integer]
1552
+ # @param extension [String]
1553
+ # @param [Hash] opts the optional parameters
1554
+ # @return [Array<(ConversationKnowledgeBaseDocumentUploadUrlResponse, Integer, Hash)>] ConversationKnowledgeBaseDocumentUploadUrlResponse data, response status code and response headers
1555
+ def get_conversation_knowledge_base_document_upload_url_with_http_info(user_id, extension, opts = {})
1556
+ if @api_client.config.debugging
1557
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversation_knowledge_base_document_upload_url ...'
1558
+ end
1559
+ # verify the required parameter 'user_id' is set
1560
+ if @api_client.config.client_side_validation && user_id.nil?
1561
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.get_conversation_knowledge_base_document_upload_url"
1562
+ end
1563
+ # verify the required parameter 'extension' is set
1564
+ if @api_client.config.client_side_validation && extension.nil?
1565
+ fail ArgumentError, "Missing the required parameter 'extension' when calling ConversationApi.get_conversation_knowledge_base_document_upload_url"
1566
+ end
1567
+ # resource path
1568
+ local_var_path = '/conversation//rest/v2/conversation/agent/profiles/{user_id}/knowledge_base/upload_url/{extension}'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s)).sub('{' + 'extension' + '}', CGI.escape(extension.to_s))
1569
+
1570
+ # query parameters
1571
+ query_params = opts[:query_params] || {}
1572
+
1573
+ # header parameters
1574
+ header_params = opts[:header_params] || {}
1575
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
1576
+ # HTTP header 'Accept' (if needed)
1577
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1578
+
1579
+ # form parameters
1580
+ form_params = opts[:form_params] || {}
1581
+
1582
+ # http body (model)
1583
+ post_body = opts[:debug_body]
1584
+
1585
+ # return_type
1586
+ return_type = opts[:debug_return_type] || 'ConversationKnowledgeBaseDocumentUploadUrlResponse'
1587
+
1588
+ # auth_names
1589
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
1590
+
1591
+ new_options = opts.merge(
1592
+ :operation => :"ConversationApi.get_conversation_knowledge_base_document_upload_url",
1593
+ :header_params => header_params,
1594
+ :query_params => query_params,
1595
+ :form_params => form_params,
1596
+ :body => post_body,
1597
+ :auth_names => auth_names,
1598
+ :return_type => return_type
1599
+ )
1600
+
1601
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1602
+ if @api_client.config.debugging
1603
+ @api_client.config.logger.debug "API called: ConversationApi#get_conversation_knowledge_base_document_upload_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1604
+ end
1605
+ return data, status_code, headers
1606
+ end
1607
+
1404
1608
  # Retrieve conversation messages
1405
1609
  # Retrieve conversation messages since a particular time
1406
1610
  # @param conversation_uuid [String]
@@ -3465,6 +3669,81 @@ module UltracartClient
3465
3669
  return data, status_code, headers
3466
3670
  end
3467
3671
 
3672
+ # Insert a knowledge base document
3673
+ # Insert a knowledge base document
3674
+ # @param user_id [Integer]
3675
+ # @param knowledge_base_document_request [ConversationInsertKnowledgeBaseDocumentRequest] Insert request
3676
+ # @param [Hash] opts the optional parameters
3677
+ # @return [ConversationInsertKnowledgeBaseDocumentResponse]
3678
+ def insert_agent_profile_knowledge_base_document(user_id, knowledge_base_document_request, opts = {})
3679
+ data, _status_code, _headers = insert_agent_profile_knowledge_base_document_with_http_info(user_id, knowledge_base_document_request, opts)
3680
+ data
3681
+ end
3682
+
3683
+ # Insert a knowledge base document
3684
+ # Insert a knowledge base document
3685
+ # @param user_id [Integer]
3686
+ # @param knowledge_base_document_request [ConversationInsertKnowledgeBaseDocumentRequest] Insert request
3687
+ # @param [Hash] opts the optional parameters
3688
+ # @return [Array<(ConversationInsertKnowledgeBaseDocumentResponse, Integer, Hash)>] ConversationInsertKnowledgeBaseDocumentResponse data, response status code and response headers
3689
+ def insert_agent_profile_knowledge_base_document_with_http_info(user_id, knowledge_base_document_request, opts = {})
3690
+ if @api_client.config.debugging
3691
+ @api_client.config.logger.debug 'Calling API: ConversationApi.insert_agent_profile_knowledge_base_document ...'
3692
+ end
3693
+ # verify the required parameter 'user_id' is set
3694
+ if @api_client.config.client_side_validation && user_id.nil?
3695
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling ConversationApi.insert_agent_profile_knowledge_base_document"
3696
+ end
3697
+ # verify the required parameter 'knowledge_base_document_request' is set
3698
+ if @api_client.config.client_side_validation && knowledge_base_document_request.nil?
3699
+ fail ArgumentError, "Missing the required parameter 'knowledge_base_document_request' when calling ConversationApi.insert_agent_profile_knowledge_base_document"
3700
+ end
3701
+ # resource path
3702
+ local_var_path = '/conversation/agent/profiles/{user_id}/knowledge_base'.sub('{' + 'user_id' + '}', CGI.escape(user_id.to_s))
3703
+
3704
+ # query parameters
3705
+ query_params = opts[:query_params] || {}
3706
+
3707
+ # header parameters
3708
+ header_params = opts[:header_params] || {}
3709
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
3710
+ # HTTP header 'Accept' (if needed)
3711
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3712
+ # HTTP header 'Content-Type'
3713
+ content_type = @api_client.select_header_content_type(['application/json'])
3714
+ if !content_type.nil?
3715
+ header_params['Content-Type'] = content_type
3716
+ end
3717
+
3718
+ # form parameters
3719
+ form_params = opts[:form_params] || {}
3720
+
3721
+ # http body (model)
3722
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(knowledge_base_document_request)
3723
+
3724
+ # return_type
3725
+ return_type = opts[:debug_return_type] || 'ConversationInsertKnowledgeBaseDocumentResponse'
3726
+
3727
+ # auth_names
3728
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
3729
+
3730
+ new_options = opts.merge(
3731
+ :operation => :"ConversationApi.insert_agent_profile_knowledge_base_document",
3732
+ :header_params => header_params,
3733
+ :query_params => query_params,
3734
+ :form_params => form_params,
3735
+ :body => post_body,
3736
+ :auth_names => auth_names,
3737
+ :return_type => return_type
3738
+ )
3739
+
3740
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3741
+ if @api_client.config.debugging
3742
+ @api_client.config.logger.debug "API called: ConversationApi#insert_agent_profile_knowledge_base_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3743
+ end
3744
+ return data, status_code, headers
3745
+ end
3746
+
3468
3747
  # Insert a canned message
3469
3748
  # Insert a canned message
3470
3749
  # @param canned_message [ConversationCannedMessage] Canned message
@@ -251,10 +251,10 @@ module UltracartClient
251
251
  # @param customer_profile_oid [Integer] The customer oid for this wishlist.
252
252
  # @param customer_wishlist_item_oid [Integer] The wishlist oid for this wishlist item to delete.
253
253
  # @param [Hash] opts the optional parameters
254
- # @return [CustomerWishListItem]
254
+ # @return [nil]
255
255
  def delete_wish_list_item(customer_profile_oid, customer_wishlist_item_oid, opts = {})
256
- data, _status_code, _headers = delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts)
257
- data
256
+ delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts)
257
+ nil
258
258
  end
259
259
 
260
260
  # Delete a customer wishlist item
@@ -262,7 +262,7 @@ module UltracartClient
262
262
  # @param customer_profile_oid [Integer] The customer oid for this wishlist.
263
263
  # @param customer_wishlist_item_oid [Integer] The wishlist oid for this wishlist item to delete.
264
264
  # @param [Hash] opts the optional parameters
265
- # @return [Array<(CustomerWishListItem, Integer, Hash)>] CustomerWishListItem data, response status code and response headers
265
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
266
266
  def delete_wish_list_item_with_http_info(customer_profile_oid, customer_wishlist_item_oid, opts = {})
267
267
  if @api_client.config.debugging
268
268
  @api_client.config.logger.debug 'Calling API: CustomerApi.delete_wish_list_item ...'
@@ -294,7 +294,7 @@ module UltracartClient
294
294
  post_body = opts[:debug_body]
295
295
 
296
296
  # return_type
297
- return_type = opts[:debug_return_type] || 'CustomerWishListItem'
297
+ return_type = opts[:debug_return_type]
298
298
 
299
299
  # auth_names
300
300
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ConversationDeleteKnowledgeBaseDocumentResponse
18
+ attr_accessor :document_id
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :metadata
23
+
24
+ # Indicates if API call was successful
25
+ attr_accessor :success
26
+
27
+ attr_accessor :warning
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'document_id' => :'document_id',
33
+ :'error' => :'error',
34
+ :'metadata' => :'metadata',
35
+ :'success' => :'success',
36
+ :'warning' => :'warning'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'document_id' => :'String',
49
+ :'error' => :'Error',
50
+ :'metadata' => :'ResponseMetadata',
51
+ :'success' => :'Boolean',
52
+ :'warning' => :'Warning'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationDeleteKnowledgeBaseDocumentResponse` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationDeleteKnowledgeBaseDocumentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'document_id')
78
+ self.document_id = attributes[:'document_id']
79
+ end
80
+
81
+ if attributes.key?(:'error')
82
+ self.error = attributes[:'error']
83
+ end
84
+
85
+ if attributes.key?(:'metadata')
86
+ self.metadata = attributes[:'metadata']
87
+ end
88
+
89
+ if attributes.key?(:'success')
90
+ self.success = attributes[:'success']
91
+ end
92
+
93
+ if attributes.key?(:'warning')
94
+ self.warning = attributes[:'warning']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ document_id == o.document_id &&
117
+ error == o.error &&
118
+ metadata == o.metadata &&
119
+ success == o.success &&
120
+ warning == o.warning
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [document_id, error, metadata, success, warning].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = UltracartClient.const_get(type)
204
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end