ultracart_api 3.10.80 → 3.10.82

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b6a4f696143d6c4b507ba947b4546b37a161906814a0907c6eebf351ff1f71d
4
- data.tar.gz: 19662799cfbf6a3850df1d3493a296d9ed11538d82e1dbb6e41d75c3980b6423
3
+ metadata.gz: ac41750d5917a3eb8e82104b1346deb324f4ce7c0ffa863be8761e857bdfc2de
4
+ data.tar.gz: be31bc969b93330a832818f48af3c52ad313d3780d33d93a532064195dd8920f
5
5
  SHA512:
6
- metadata.gz: 8a31b0c962791a1220f043729e5f0d70820118c1c8e142db6916604e5387bd0c0b113036686942959a7d17669e3c7424bf17bf5944a6283489f935c2a4cf694f
7
- data.tar.gz: 8421b0a573e868534462320dafda3dcaecb8bc9e3f6dad03c2e427e759be3b91de676c4bfb40460d3d51b29168300acda10ff9485d1b05d26a1a66e0f50a0f33
6
+ metadata.gz: '044318b54d553a9207d79741cc7013d047755db045944326132345366cb008f52606e8eac9bfddf8628b1fa64dbc5a7c304ae466095379b7258b7793bcd097fd'
7
+ data.tar.gz: 48f8711b008df4dcb1cc532bfc22dbc2964f777f5da344e83adb133658816e8a3d72ed3043a259d1a3a1b0e58a8693ebed71770b7b411116ef774bccb345bd3b
data/README.md CHANGED
@@ -7,7 +7,7 @@ UltraCart REST API Version 2
7
7
  This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 3.10.80
10
+ - Package version: 3.10.82
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [http://www.ultracart.com](http://www.ultracart.com)
13
13
 
@@ -24,15 +24,15 @@ gem build ultracart_api.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./ultracart_api-3.10.80.gem
27
+ gem install ./ultracart_api-3.10.82.gem
28
28
  ```
29
- (for development, run `gem install --dev ./ultracart_api-3.10.80.gem` to install the development dependencies)
29
+ (for development, run `gem install --dev ./ultracart_api-3.10.82.gem` to install the development dependencies)
30
30
 
31
31
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
32
32
 
33
33
  Finally add this to the Gemfile:
34
34
 
35
- gem 'ultracart_api', '~> 3.10.80'
35
+ gem 'ultracart_api', '~> 3.10.82'
36
36
 
37
37
  ### Install from Git
38
38
 
@@ -136,6 +136,8 @@ Class | Method | HTTP request | Description
136
136
  *UltracartClient::ConversationApi* | [**get_conversation_multimedia_upload_url**](docs/ConversationApi.md#get_conversation_multimedia_upload_url) | **GET** /conversation/upload_url/{extension} | Get a presigned conersation multimedia upload URL
137
137
  *UltracartClient::ConversationApi* | [**get_conversation_webchat_queue_statuses**](docs/ConversationApi.md#get_conversation_webchat_queue_statuses) | **GET** /conversation/conversations/queues/statuses | Retrieve a conversation webchat queue statuses
138
138
  *UltracartClient::ConversationApi* | [**get_conversations**](docs/ConversationApi.md#get_conversations) | **GET** /conversation/conversations | Retrieve a list of conversation summaries newest to oldest
139
+ *UltracartClient::ConversationApi* | [**get_conversations_autocomplete**](docs/ConversationApi.md#get_conversations_autocomplete) | **POST** /conversation/conversations/autocomplete | Retrieve a list of matching terms for a search field
140
+ *UltracartClient::ConversationApi* | [**get_conversations_search**](docs/ConversationApi.md#get_conversations_search) | **POST** /conversation/conversations/search | Search conversations
139
141
  *UltracartClient::ConversationApi* | [**insert_conversation_canned_message**](docs/ConversationApi.md#insert_conversation_canned_message) | **POST** /conversation/canned_messages | Insert a canned message
140
142
  *UltracartClient::ConversationApi* | [**insert_conversation_department**](docs/ConversationApi.md#insert_conversation_department) | **POST** /conversation/departments | Insert a department
141
143
  *UltracartClient::ConversationApi* | [**insert_conversation_engagement**](docs/ConversationApi.md#insert_conversation_engagement) | **POST** /conversation/engagements | Insert a engagement
@@ -595,6 +597,9 @@ Class | Method | HTTP request | Description
595
597
  - [UltracartClient::Conversation](docs/Conversation.md)
596
598
  - [UltracartClient::ConversationAgentAuth](docs/ConversationAgentAuth.md)
597
599
  - [UltracartClient::ConversationAgentAuthResponse](docs/ConversationAgentAuthResponse.md)
600
+ - [UltracartClient::ConversationAutocompleteRequest](docs/ConversationAutocompleteRequest.md)
601
+ - [UltracartClient::ConversationAutocompleteResponse](docs/ConversationAutocompleteResponse.md)
602
+ - [UltracartClient::ConversationAutocompleteValue](docs/ConversationAutocompleteValue.md)
598
603
  - [UltracartClient::ConversationCannedMessage](docs/ConversationCannedMessage.md)
599
604
  - [UltracartClient::ConversationCannedMessageResponse](docs/ConversationCannedMessageResponse.md)
600
605
  - [UltracartClient::ConversationCannedMessagesResponse](docs/ConversationCannedMessagesResponse.md)
@@ -623,6 +628,8 @@ Class | Method | HTTP request | Description
623
628
  - [UltracartClient::ConversationMultimediaUploadUrlResponse](docs/ConversationMultimediaUploadUrlResponse.md)
624
629
  - [UltracartClient::ConversationParticipant](docs/ConversationParticipant.md)
625
630
  - [UltracartClient::ConversationResponse](docs/ConversationResponse.md)
631
+ - [UltracartClient::ConversationSearchRequest](docs/ConversationSearchRequest.md)
632
+ - [UltracartClient::ConversationSearchResponse](docs/ConversationSearchResponse.md)
626
633
  - [UltracartClient::ConversationStartRequest](docs/ConversationStartRequest.md)
627
634
  - [UltracartClient::ConversationStartResponse](docs/ConversationStartResponse.md)
628
635
  - [UltracartClient::ConversationSummary](docs/ConversationSummary.md)
@@ -1251,6 +1258,8 @@ Not every change is committed to every SDK.
1251
1258
 
1252
1259
  | Version | Date | Comments |
1253
1260
  | --: | :-: | --- |
1261
+ | 3.10.82 | 12/15/2022 | conversation search - added start date filtering |
1262
+ | 3.10.81 | 12/15/2022 | conversation searching |
1254
1263
  | 3.10.80 | 12/13/2022 | conversations - add email and sms_phone to participant object |
1255
1264
  | 3.10.79 | 12/09/2022 | conversations - message translation |
1256
1265
  | 3.10.78 | 12/08/2022 | conversation canned messages |
@@ -15,6 +15,8 @@ Method | HTTP request | Description
15
15
  [**get_conversation_multimedia_upload_url**](ConversationApi.md#get_conversation_multimedia_upload_url) | **GET** /conversation/upload_url/{extension} | Get a presigned conersation multimedia upload URL
16
16
  [**get_conversation_webchat_queue_statuses**](ConversationApi.md#get_conversation_webchat_queue_statuses) | **GET** /conversation/conversations/queues/statuses | Retrieve a conversation webchat queue statuses
17
17
  [**get_conversations**](ConversationApi.md#get_conversations) | **GET** /conversation/conversations | Retrieve a list of conversation summaries newest to oldest
18
+ [**get_conversations_autocomplete**](ConversationApi.md#get_conversations_autocomplete) | **POST** /conversation/conversations/autocomplete | Retrieve a list of matching terms for a search field
19
+ [**get_conversations_search**](ConversationApi.md#get_conversations_search) | **POST** /conversation/conversations/search | Search conversations
18
20
  [**insert_conversation_canned_message**](ConversationApi.md#insert_conversation_canned_message) | **POST** /conversation/canned_messages | Insert a canned message
19
21
  [**insert_conversation_department**](ConversationApi.md#insert_conversation_department) | **POST** /conversation/departments | Insert a department
20
22
  [**insert_conversation_engagement**](ConversationApi.md#insert_conversation_engagement) | **POST** /conversation/engagements | Insert a engagement
@@ -566,6 +568,106 @@ Name | Type | Description | Notes
566
568
 
567
569
 
568
570
 
571
+ # **get_conversations_autocomplete**
572
+ > ConversationAutocompleteResponse get_conversations_autocomplete(autocomplete_request)
573
+
574
+ Retrieve a list of matching terms for a search field
575
+
576
+ Retrieve a list of matching terms for a search field
577
+
578
+ ### Example
579
+ ```ruby
580
+ # load the gem
581
+ require 'ultracart_api'
582
+
583
+ # Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
584
+ simple_key = '109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00'
585
+ api_instance = UltracartClient::ConversationApi.new_using_api_key(simple_key, false, false)
586
+
587
+
588
+ autocomplete_request = UltracartClient::ConversationAutocompleteRequest.new # ConversationAutocompleteRequest | Autocomplete Request
589
+
590
+
591
+ begin
592
+ #Retrieve a list of matching terms for a search field
593
+ result = api_instance.get_conversations_autocomplete(autocomplete_request)
594
+ p result
595
+ rescue UltracartClient::ApiError => e
596
+ puts "Exception when calling ConversationApi->get_conversations_autocomplete: #{e}"
597
+ end
598
+ ```
599
+
600
+ ### Parameters
601
+
602
+ Name | Type | Description | Notes
603
+ ------------- | ------------- | ------------- | -------------
604
+ **autocomplete_request** | [**ConversationAutocompleteRequest**](ConversationAutocompleteRequest.md)| Autocomplete Request |
605
+
606
+ ### Return type
607
+
608
+ [**ConversationAutocompleteResponse**](ConversationAutocompleteResponse.md)
609
+
610
+ ### Authorization
611
+
612
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
613
+
614
+ ### HTTP request headers
615
+
616
+ - **Content-Type**: application/json
617
+ - **Accept**: application/json
618
+
619
+
620
+
621
+ # **get_conversations_search**
622
+ > ConversationSearchResponse get_conversations_search(search_request)
623
+
624
+ Search conversations
625
+
626
+ Search conversations
627
+
628
+ ### Example
629
+ ```ruby
630
+ # load the gem
631
+ require 'ultracart_api'
632
+
633
+ # Create a Simple Key: https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key
634
+ simple_key = '109ee846ee69f50177018ab12f008a00748a25aa28dbdc0177018ab12f008a00'
635
+ api_instance = UltracartClient::ConversationApi.new_using_api_key(simple_key, false, false)
636
+
637
+
638
+ search_request = UltracartClient::ConversationSearchRequest.new # ConversationSearchRequest | Search Request
639
+
640
+
641
+ begin
642
+ #Search conversations
643
+ result = api_instance.get_conversations_search(search_request)
644
+ p result
645
+ rescue UltracartClient::ApiError => e
646
+ puts "Exception when calling ConversationApi->get_conversations_search: #{e}"
647
+ end
648
+ ```
649
+
650
+ ### Parameters
651
+
652
+ Name | Type | Description | Notes
653
+ ------------- | ------------- | ------------- | -------------
654
+ **search_request** | [**ConversationSearchRequest**](ConversationSearchRequest.md)| Search Request |
655
+
656
+ ### Return type
657
+
658
+ [**ConversationSearchResponse**](ConversationSearchResponse.md)
659
+
660
+ ### Authorization
661
+
662
+ [ultraCartOauth](../README.md#ultraCartOauth), [ultraCartSimpleApiKey](../README.md#ultraCartSimpleApiKey)
663
+
664
+ ### HTTP request headers
665
+
666
+ - **Content-Type**: application/json
667
+ - **Accept**: application/json
668
+
669
+
670
+
569
671
  # **insert_conversation_canned_message**
570
672
  > ConversationCannedMessageResponse insert_conversation_canned_message(canned_message)
571
673
 
@@ -0,0 +1,9 @@
1
+ # UltracartClient::ConversationAutocompleteRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **field** | **String** | | [optional]
7
+ **term** | **String** | | [optional]
8
+
9
+
@@ -0,0 +1,14 @@
1
+ # UltracartClient::ConversationAutocompleteResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **error** | [**Error**](Error.md) | | [optional]
7
+ **field** | **String** | | [optional]
8
+ **metadata** | [**ResponseMetadata**](ResponseMetadata.md) | | [optional]
9
+ **results** | [**Array<ConversationAutocompleteValue>**](ConversationAutocompleteValue.md) | | [optional]
10
+ **success** | **BOOLEAN** | Indicates if API call was successful | [optional]
11
+ **term** | **String** | | [optional]
12
+ **warning** | [**Warning**](Warning.md) | | [optional]
13
+
14
+
@@ -0,0 +1,9 @@
1
+ # UltracartClient::ConversationAutocompleteValue
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **description** | **String** | | [optional]
7
+ **value** | **String** | | [optional]
8
+
9
+
@@ -0,0 +1,19 @@
1
+ # UltracartClient::ConversationSearchRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **date_end** | **String** | End of the range | [optional]
7
+ **date_start** | **String** | Start of the range | [optional]
8
+ **email_filter** | **String** | | [optional]
9
+ **language_filter** | **String** | | [optional]
10
+ **medium_filter** | **String** | | [optional]
11
+ **order_by_newest** | **BOOLEAN** | | [optional]
12
+ **order_by_oldest** | **BOOLEAN** | | [optional]
13
+ **range_begin** | **Integer** | | [optional]
14
+ **range_end** | **Integer** | | [optional]
15
+ **sms_phone_number_filter** | **String** | | [optional]
16
+ **text_search** | **String** | | [optional]
17
+ **visible_filter** | **BOOLEAN** | | [optional]
18
+
19
+
@@ -0,0 +1,10 @@
1
+ # UltracartClient::ConversationSearchResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **range_begin** | **Integer** | | [optional]
7
+ **range_end** | **Integer** | | [optional]
8
+ **total** | **Integer** | | [optional]
9
+
10
+
@@ -618,6 +618,116 @@ module UltracartClient
618
618
  end
619
619
  return data, status_code, headers
620
620
  end
621
+ # Retrieve a list of matching terms for a search field
622
+ # Retrieve a list of matching terms for a search field
623
+ # @param autocomplete_request Autocomplete Request
624
+ # @param [Hash] opts the optional parameters
625
+ # @return [ConversationAutocompleteResponse]
626
+ def get_conversations_autocomplete(autocomplete_request, opts = {})
627
+ data, _status_code, _headers = get_conversations_autocomplete_with_http_info(autocomplete_request, opts)
628
+ data
629
+ end
630
+
631
+ # Retrieve a list of matching terms for a search field
632
+ # Retrieve a list of matching terms for a search field
633
+ # @param autocomplete_request Autocomplete Request
634
+ # @param [Hash] opts the optional parameters
635
+ # @return [Array<(ConversationAutocompleteResponse, Fixnum, Hash)>] ConversationAutocompleteResponse data, response status code and response headers
636
+ def get_conversations_autocomplete_with_http_info(autocomplete_request, opts = {})
637
+ if @api_client.config.debugging
638
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversations_autocomplete ...'
639
+ end
640
+ # verify the required parameter 'autocomplete_request' is set
641
+ if @api_client.config.client_side_validation && autocomplete_request.nil?
642
+ fail ArgumentError, "Missing the required parameter 'autocomplete_request' when calling ConversationApi.get_conversations_autocomplete"
643
+ end
644
+ # resource path
645
+ local_var_path = '/conversation/conversations/autocomplete'
646
+
647
+ # query parameters
648
+ query_params = {}
649
+
650
+ # header parameters
651
+ header_params = {}
652
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
653
+ # HTTP header 'Accept' (if needed)
654
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
655
+ # HTTP header 'Content-Type'
656
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
657
+
658
+ # form parameters
659
+ form_params = {}
660
+
661
+ # http body (model)
662
+ post_body = @api_client.object_to_http_body(autocomplete_request)
663
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
664
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
665
+ :header_params => header_params,
666
+ :query_params => query_params,
667
+ :form_params => form_params,
668
+ :body => post_body,
669
+ :auth_names => auth_names,
670
+ :return_type => 'ConversationAutocompleteResponse')
671
+ if @api_client.config.debugging
672
+ @api_client.config.logger.debug "API called: ConversationApi#get_conversations_autocomplete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
673
+ end
674
+ return data, status_code, headers
675
+ end
676
+ # Search conversations
677
+ # Search conversations
678
+ # @param search_request Search Request
679
+ # @param [Hash] opts the optional parameters
680
+ # @return [ConversationSearchResponse]
681
+ def get_conversations_search(search_request, opts = {})
682
+ data, _status_code, _headers = get_conversations_search_with_http_info(search_request, opts)
683
+ data
684
+ end
685
+
686
+ # Search conversations
687
+ # Search conversations
688
+ # @param search_request Search Request
689
+ # @param [Hash] opts the optional parameters
690
+ # @return [Array<(ConversationSearchResponse, Fixnum, Hash)>] ConversationSearchResponse data, response status code and response headers
691
+ def get_conversations_search_with_http_info(search_request, opts = {})
692
+ if @api_client.config.debugging
693
+ @api_client.config.logger.debug 'Calling API: ConversationApi.get_conversations_search ...'
694
+ end
695
+ # verify the required parameter 'search_request' is set
696
+ if @api_client.config.client_side_validation && search_request.nil?
697
+ fail ArgumentError, "Missing the required parameter 'search_request' when calling ConversationApi.get_conversations_search"
698
+ end
699
+ # resource path
700
+ local_var_path = '/conversation/conversations/search'
701
+
702
+ # query parameters
703
+ query_params = {}
704
+
705
+ # header parameters
706
+ header_params = {}
707
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
708
+ # HTTP header 'Accept' (if needed)
709
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
710
+ # HTTP header 'Content-Type'
711
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
712
+
713
+ # form parameters
714
+ form_params = {}
715
+
716
+ # http body (model)
717
+ post_body = @api_client.object_to_http_body(search_request)
718
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
719
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
720
+ :header_params => header_params,
721
+ :query_params => query_params,
722
+ :form_params => form_params,
723
+ :body => post_body,
724
+ :auth_names => auth_names,
725
+ :return_type => 'ConversationSearchResponse')
726
+ if @api_client.config.debugging
727
+ @api_client.config.logger.debug "API called: ConversationApi#get_conversations_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
728
+ end
729
+ return data, status_code, headers
730
+ end
621
731
  # Insert a canned message
622
732
  # Insert a canned message
623
733
  # @param canned_message Canned message
@@ -0,0 +1,193 @@
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 ConversationAutocompleteRequest
17
+ attr_accessor :field
18
+
19
+ attr_accessor :term
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'field' => :'field',
25
+ :'term' => :'term'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'field' => :'String',
33
+ :'term' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'field')
46
+ self.field = attributes[:'field']
47
+ end
48
+
49
+ if attributes.has_key?(:'term')
50
+ self.term = attributes[:'term']
51
+ end
52
+ end
53
+
54
+ # Show invalid properties with the reasons. Usually used together with valid?
55
+ # @return Array for valid properties with the reasons
56
+ def list_invalid_properties
57
+ invalid_properties = Array.new
58
+ invalid_properties
59
+ end
60
+
61
+ # Check to see if the all the properties in the model are valid
62
+ # @return true if the model is valid
63
+ def valid?
64
+ true
65
+ end
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] Object to be compared
69
+ def ==(o)
70
+ return true if self.equal?(o)
71
+ self.class == o.class &&
72
+ field == o.field &&
73
+ term == o.term
74
+ end
75
+
76
+ # @see the `==` method
77
+ # @param [Object] Object to be compared
78
+ def eql?(o)
79
+ self == o
80
+ end
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [field, term].hash
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.swagger_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :BOOLEAN
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ temp_model = UltracartClient.const_get(type).new
146
+ temp_model.build_from_hash(value)
147
+ end
148
+ end
149
+
150
+ # Returns the string representation of the object
151
+ # @return [String] String presentation of the object
152
+ def to_s
153
+ to_hash.to_s
154
+ end
155
+
156
+ # to_body is an alias to to_hash (backward compatibility)
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_body
159
+ to_hash
160
+ end
161
+
162
+ # Returns the object in the form of hash
163
+ # @return [Hash] Returns the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Outputs non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ # @param [Object] value Any valid value
177
+ # @return [Hash] Returns the value in the form of hash
178
+ def _to_hash(value)
179
+ if value.is_a?(Array)
180
+ value.compact.map { |v| _to_hash(v) }
181
+ elsif value.is_a?(Hash)
182
+ {}.tap do |hash|
183
+ value.each { |k, v| hash[k] = _to_hash(v) }
184
+ end
185
+ elsif value.respond_to? :to_hash
186
+ value.to_hash
187
+ else
188
+ value
189
+ end
190
+ end
191
+
192
+ end
193
+ end