ultracart_api 4.0.143 → 4.0.144

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: 70a3a20e89bbd3ddaefed8abbcfe856321e4a59137f76e14fcbd0e54da9f28ee
4
- data.tar.gz: 3f01ed0057b15ec7aa051c281506b70d3176b1688071ddbb4e21537903c3ae60
3
+ metadata.gz: 68fb71fdebd9db9a11b4efdc375f11acfc252232ecb998c01e45dd3a210dc35a
4
+ data.tar.gz: f6959bceb05282bfd5d1af9f0021ef7d9d3072908665e62a7ca6461b15d1de91
5
5
  SHA512:
6
- metadata.gz: 25e6f5e8e0e1209b1972452f5bb64a0850b1699d30ae051b059588518547823fbe46905a71bf9892bdb6f452e2212f8cfee795d90de0e97936de1dd289a9e4e2
7
- data.tar.gz: d6ef73f40c9e4bd1ba4bd384527216ef55bbc563c3830cd09017c92fb77c5984c98b30e27aeae6e20e722b5547d9f65ff4af50cc37d0c44c422165c598ffe24f
6
+ metadata.gz: fb87b0de09a27b85b50783414b449c2c6a1d1d4330b6e33748e6a734af26d8226dd0e03b8a03be6e0e1a1f415aa0f64bed82d8400809ca66e4f0b2e9b0b88ebe
7
+ data.tar.gz: b8219a5ca433d0ddb1ecfb61e334bc23627e77cc9591bb7db72c230dc857714199ac8776e845af0940168c2caf602947a861cdae8e4db229ae9d13f306b97cc8
data/README.md CHANGED
@@ -7,7 +7,7 @@ UltraCart REST API Version 2
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 4.0.143
10
+ - Package version: 4.0.144
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [http://www.ultracart.com](http://www.ultracart.com)
13
13
 
@@ -24,16 +24,16 @@ gem build ultracart_api.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./ultracart_api-4.0.143.gem
27
+ gem install ./ultracart_api-4.0.144.gem
28
28
  ```
29
29
 
30
- (for development, run `gem install --dev ./ultracart_api-4.0.143.gem` to install the development dependencies)
30
+ (for development, run `gem install --dev ./ultracart_api-4.0.144.gem` to install the development dependencies)
31
31
 
32
32
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
33
 
34
34
  Finally add this to the Gemfile:
35
35
 
36
- gem 'ultracart_api', '~> 4.0.143'
36
+ gem 'ultracart_api', '~> 4.0.144'
37
37
 
38
38
  ### Install from Git
39
39
 
@@ -1143,7 +1143,6 @@ Class | Method | HTTP request | Description
1143
1143
  - [UltracartClient::ReportDataSetResponse](docs/ReportDataSetResponse.md)
1144
1144
  - [UltracartClient::ReportDataSetRow](docs/ReportDataSetRow.md)
1145
1145
  - [UltracartClient::ReportDataSetSchema](docs/ReportDataSetSchema.md)
1146
- - [UltracartClient::ReportDataSetSummary](docs/ReportDataSetSummary.md)
1147
1146
  - [UltracartClient::ReportDataSource](docs/ReportDataSource.md)
1148
1147
  - [UltracartClient::ReportDataSourceSchema](docs/ReportDataSourceSchema.md)
1149
1148
  - [UltracartClient::ReportExecuteQueriesRequest](docs/ReportExecuteQueriesRequest.md)
@@ -1348,6 +1347,7 @@ Not every change is committed to every SDK.
1348
1347
 
1349
1348
  | Version | Date | Comments |
1350
1349
  | --: | :-: | --- |
1350
+ | 4.0.144 | 03/29/2023 | internal development |
1351
1351
  | 4.0.143 | 03/22/2023 | data warehouse internal dev |
1352
1352
  | 4.0.142 | 03/22/2023 | dw initial framework |
1353
1353
  | 4.0.141 | 03/22/2023 | order api - refundable response added manual_because_multiple_charges boolean field |
data/docs/Experiment.md CHANGED
@@ -14,7 +14,12 @@
14
14
  | **notes** | **String** | Notes about the experiment | [optional] |
15
15
  | **objective** | **String** | Objective that is being optimized | [optional] |
16
16
  | **objective_parameter** | **String** | Objective parameter (such as event name) that is being optimized | [optional] |
17
+ | **openai_current_iteration** | **Integer** | The current iteration of the OpenAI related experiment | [optional] |
18
+ | **openai_element_type** | **String** | The type of OpenAI element being experimented on | [optional] |
19
+ | **openai_model** | **String** | The type of OpenAI model used | [optional] |
20
+ | **openai_total_iterations** | **Integer** | The total number of iterations to perform on the experiment | [optional] |
17
21
  | **optimization_type** | **String** | Type of optimization | [optional] |
22
+ | **p_value** | **Float** | Statistics p-value for the experiment | [optional] |
18
23
  | **session_count** | **Integer** | Total number of sessions in the experiment | [optional] |
19
24
  | **start_dts** | **String** | Start date/time | [optional] |
20
25
  | **status** | **String** | Status of the experiment | [optional] |
@@ -39,7 +44,12 @@ instance = UltracartClient::Experiment.new(
39
44
  notes: null,
40
45
  objective: null,
41
46
  objective_parameter: null,
47
+ openai_current_iteration: null,
48
+ openai_element_type: null,
49
+ openai_model: null,
50
+ openai_total_iterations: null,
42
51
  optimization_type: null,
52
+ p_value: null,
43
53
  session_count: null,
44
54
  start_dts: null,
45
55
  status: null,
@@ -5,7 +5,7 @@
5
5
  | Name | Type | Description | Notes |
6
6
  | ---- | ---- | ----------- | ----- |
7
7
  | **event_type** | **String** | Event type | [optional] |
8
- | **query_completion** | [**ReportDataSetSummary**](ReportDataSetSummary.md) | | [optional] |
8
+ | **query_completion** | [**ReportDataSet**](ReportDataSet.md) | | [optional] |
9
9
 
10
10
  ## Example
11
11
 
@@ -45,9 +45,24 @@ module UltracartClient
45
45
  # Objective parameter (such as event name) that is being optimized
46
46
  attr_accessor :objective_parameter
47
47
 
48
+ # The current iteration of the OpenAI related experiment
49
+ attr_accessor :openai_current_iteration
50
+
51
+ # The type of OpenAI element being experimented on
52
+ attr_accessor :openai_element_type
53
+
54
+ # The type of OpenAI model used
55
+ attr_accessor :openai_model
56
+
57
+ # The total number of iterations to perform on the experiment
58
+ attr_accessor :openai_total_iterations
59
+
48
60
  # Type of optimization
49
61
  attr_accessor :optimization_type
50
62
 
63
+ # Statistics p-value for the experiment
64
+ attr_accessor :p_value
65
+
51
66
  # Total number of sessions in the experiment
52
67
  attr_accessor :session_count
53
68
 
@@ -104,7 +119,12 @@ module UltracartClient
104
119
  :'notes' => :'notes',
105
120
  :'objective' => :'objective',
106
121
  :'objective_parameter' => :'objective_parameter',
122
+ :'openai_current_iteration' => :'openai_current_iteration',
123
+ :'openai_element_type' => :'openai_element_type',
124
+ :'openai_model' => :'openai_model',
125
+ :'openai_total_iterations' => :'openai_total_iterations',
107
126
  :'optimization_type' => :'optimization_type',
127
+ :'p_value' => :'p_value',
108
128
  :'session_count' => :'session_count',
109
129
  :'start_dts' => :'start_dts',
110
130
  :'status' => :'status',
@@ -133,7 +153,12 @@ module UltracartClient
133
153
  :'notes' => :'String',
134
154
  :'objective' => :'String',
135
155
  :'objective_parameter' => :'String',
156
+ :'openai_current_iteration' => :'Integer',
157
+ :'openai_element_type' => :'String',
158
+ :'openai_model' => :'String',
159
+ :'openai_total_iterations' => :'Integer',
136
160
  :'optimization_type' => :'String',
161
+ :'p_value' => :'Float',
137
162
  :'session_count' => :'Integer',
138
163
  :'start_dts' => :'String',
139
164
  :'status' => :'String',
@@ -205,10 +230,30 @@ module UltracartClient
205
230
  self.objective_parameter = attributes[:'objective_parameter']
206
231
  end
207
232
 
233
+ if attributes.key?(:'openai_current_iteration')
234
+ self.openai_current_iteration = attributes[:'openai_current_iteration']
235
+ end
236
+
237
+ if attributes.key?(:'openai_element_type')
238
+ self.openai_element_type = attributes[:'openai_element_type']
239
+ end
240
+
241
+ if attributes.key?(:'openai_model')
242
+ self.openai_model = attributes[:'openai_model']
243
+ end
244
+
245
+ if attributes.key?(:'openai_total_iterations')
246
+ self.openai_total_iterations = attributes[:'openai_total_iterations']
247
+ end
248
+
208
249
  if attributes.key?(:'optimization_type')
209
250
  self.optimization_type = attributes[:'optimization_type']
210
251
  end
211
252
 
253
+ if attributes.key?(:'p_value')
254
+ self.p_value = attributes[:'p_value']
255
+ end
256
+
212
257
  if attributes.key?(:'session_count')
213
258
  self.session_count = attributes[:'session_count']
214
259
  end
@@ -250,11 +295,23 @@ module UltracartClient
250
295
  # Check to see if the all the properties in the model are valid
251
296
  # @return true if the model is valid
252
297
  def valid?
298
+ openai_element_type_validator = EnumAttributeValidator.new('String', ["headline", "text", "textblock"])
299
+ return false unless openai_element_type_validator.valid?(@openai_element_type)
253
300
  status_validator = EnumAttributeValidator.new('String', ["Running", "Ended", "Deleted"])
254
301
  return false unless status_validator.valid?(@status)
255
302
  true
256
303
  end
257
304
 
305
+ # Custom attribute writer method checking allowed values (enum).
306
+ # @param [Object] openai_element_type Object to be assigned
307
+ def openai_element_type=(openai_element_type)
308
+ validator = EnumAttributeValidator.new('String', ["headline", "text", "textblock"])
309
+ unless validator.valid?(openai_element_type)
310
+ fail ArgumentError, "invalid value for \"openai_element_type\", must be one of #{validator.allowable_values}."
311
+ end
312
+ @openai_element_type = openai_element_type
313
+ end
314
+
258
315
  # Custom attribute writer method checking allowed values (enum).
259
316
  # @param [Object] status Object to be assigned
260
317
  def status=(status)
@@ -280,7 +337,12 @@ module UltracartClient
280
337
  notes == o.notes &&
281
338
  objective == o.objective &&
282
339
  objective_parameter == o.objective_parameter &&
340
+ openai_current_iteration == o.openai_current_iteration &&
341
+ openai_element_type == o.openai_element_type &&
342
+ openai_model == o.openai_model &&
343
+ openai_total_iterations == o.openai_total_iterations &&
283
344
  optimization_type == o.optimization_type &&
345
+ p_value == o.p_value &&
284
346
  session_count == o.session_count &&
285
347
  start_dts == o.start_dts &&
286
348
  status == o.status &&
@@ -299,7 +361,7 @@ module UltracartClient
299
361
  # Calculates hash code according to all attributes.
300
362
  # @return [Integer] Hash code
301
363
  def hash
302
- [container_id, duration_days, end_dts, equal_weighting, experiment_type, id, name, notes, objective, objective_parameter, optimization_type, session_count, start_dts, status, storefront_experiment_oid, storefront_oid, uri, variations].hash
364
+ [container_id, duration_days, end_dts, equal_weighting, experiment_type, id, name, notes, objective, objective_parameter, openai_current_iteration, openai_element_type, openai_model, openai_total_iterations, optimization_type, p_value, session_count, start_dts, status, storefront_experiment_oid, storefront_oid, uri, variations].hash
303
365
  end
304
366
 
305
367
  # Builds the object from hash
@@ -59,7 +59,7 @@ module UltracartClient
59
59
  def self.openapi_types
60
60
  {
61
61
  :'event_type' => :'String',
62
- :'query_completion' => :'ReportDataSetSummary'
62
+ :'query_completion' => :'ReportDataSet'
63
63
  }
64
64
  end
65
65
 
@@ -11,5 +11,5 @@ OpenAPI Generator version: 6.0.1-SNAPSHOT
11
11
  =end
12
12
 
13
13
  module UltracartClient
14
- VERSION = '4.0.143'
14
+ VERSION = '4.0.144'
15
15
  end
data/lib/ultracart_api.rb CHANGED
@@ -651,7 +651,6 @@ require 'ultracart_api/models/report_data_set_query'
651
651
  require 'ultracart_api/models/report_data_set_response'
652
652
  require 'ultracart_api/models/report_data_set_row'
653
653
  require 'ultracart_api/models/report_data_set_schema'
654
- require 'ultracart_api/models/report_data_set_summary'
655
654
  require 'ultracart_api/models/report_data_source'
656
655
  require 'ultracart_api/models/report_data_source_schema'
657
656
  require 'ultracart_api/models/report_execute_queries_request'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultracart_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.143
4
+ version: 4.0.144
5
5
  platform: ruby
6
6
  authors:
7
7
  - UltraCart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-22 00:00:00.000000000 Z
11
+ date: 2023-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -710,7 +710,6 @@ files:
710
710
  - docs/ReportDataSetResponse.md
711
711
  - docs/ReportDataSetRow.md
712
712
  - docs/ReportDataSetSchema.md
713
- - docs/ReportDataSetSummary.md
714
713
  - docs/ReportDataSource.md
715
714
  - docs/ReportDataSourceSchema.md
716
715
  - docs/ReportExecuteQueriesRequest.md
@@ -1506,7 +1505,6 @@ files:
1506
1505
  - lib/ultracart_api/models/report_data_set_response.rb
1507
1506
  - lib/ultracart_api/models/report_data_set_row.rb
1508
1507
  - lib/ultracart_api/models/report_data_set_schema.rb
1509
- - lib/ultracart_api/models/report_data_set_summary.rb
1510
1508
  - lib/ultracart_api/models/report_data_source.rb
1511
1509
  - lib/ultracart_api/models/report_data_source_schema.rb
1512
1510
  - lib/ultracart_api/models/report_execute_queries_request.rb
@@ -1,30 +0,0 @@
1
- # UltracartClient::ReportDataSetSummary
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **data_set_uuid** | **String** | A unique identifier assigned to the data set that is returned. | [optional] |
8
- | **error_message** | **String** | Error message if the query failed. | [optional] |
9
- | **for_object_id** | **String** | An identifier that can be used to help match up the returned data set | [optional] |
10
- | **for_object_type** | **String** | The type of object this data set is for | [optional] |
11
- | **max_results** | **Integer** | The total number of results | [optional] |
12
- | **schema** | [**Array<ReportDataSetSchema>**](ReportDataSetSchema.md) | The schema associated with the data set. | [optional] |
13
- | **user_data** | **String** | Any other data that needs to be returned with the response to help the UI | [optional] |
14
-
15
- ## Example
16
-
17
- ```ruby
18
- require 'ultracart_api'
19
-
20
- instance = UltracartClient::ReportDataSetSummary.new(
21
- data_set_uuid: null,
22
- error_message: null,
23
- for_object_id: null,
24
- for_object_type: null,
25
- max_results: null,
26
- schema: null,
27
- user_data: null
28
- )
29
- ```
30
-
@@ -1,316 +0,0 @@
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 ReportDataSetSummary
18
- # A unique identifier assigned to the data set that is returned.
19
- attr_accessor :data_set_uuid
20
-
21
- # Error message if the query failed.
22
- attr_accessor :error_message
23
-
24
- # An identifier that can be used to help match up the returned data set
25
- attr_accessor :for_object_id
26
-
27
- # The type of object this data set is for
28
- attr_accessor :for_object_type
29
-
30
- # The total number of results
31
- attr_accessor :max_results
32
-
33
- # The schema associated with the data set.
34
- attr_accessor :schema
35
-
36
- # Any other data that needs to be returned with the response to help the UI
37
- attr_accessor :user_data
38
-
39
- class EnumAttributeValidator
40
- attr_reader :datatype
41
- attr_reader :allowable_values
42
-
43
- def initialize(datatype, allowable_values)
44
- @allowable_values = allowable_values.map do |value|
45
- case datatype.to_s
46
- when /Integer/i
47
- value.to_i
48
- when /Float/i
49
- value.to_f
50
- else
51
- value
52
- end
53
- end
54
- end
55
-
56
- def valid?(value)
57
- !value || allowable_values.include?(value)
58
- end
59
- end
60
-
61
- # Attribute mapping from ruby-style variable name to JSON key.
62
- def self.attribute_map
63
- {
64
- :'data_set_uuid' => :'data_set_uuid',
65
- :'error_message' => :'error_message',
66
- :'for_object_id' => :'for_object_id',
67
- :'for_object_type' => :'for_object_type',
68
- :'max_results' => :'max_results',
69
- :'schema' => :'schema',
70
- :'user_data' => :'user_data'
71
- }
72
- end
73
-
74
- # Returns all the JSON keys this model knows about
75
- def self.acceptable_attributes
76
- attribute_map.values
77
- end
78
-
79
- # Attribute type mapping.
80
- def self.openapi_types
81
- {
82
- :'data_set_uuid' => :'String',
83
- :'error_message' => :'String',
84
- :'for_object_id' => :'String',
85
- :'for_object_type' => :'String',
86
- :'max_results' => :'Integer',
87
- :'schema' => :'Array<ReportDataSetSchema>',
88
- :'user_data' => :'String'
89
- }
90
- end
91
-
92
- # List of attributes with nullable: true
93
- def self.openapi_nullable
94
- Set.new([
95
- ])
96
- end
97
-
98
- # Initializes the object
99
- # @param [Hash] attributes Model attributes in the form of hash
100
- def initialize(attributes = {})
101
- if (!attributes.is_a?(Hash))
102
- fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportDataSetSummary` initialize method"
103
- end
104
-
105
- # check to see if the attribute exists and convert string to symbol for hash key
106
- attributes = attributes.each_with_object({}) { |(k, v), h|
107
- if (!self.class.attribute_map.key?(k.to_sym))
108
- fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportDataSetSummary`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
109
- end
110
- h[k.to_sym] = v
111
- }
112
-
113
- if attributes.key?(:'data_set_uuid')
114
- self.data_set_uuid = attributes[:'data_set_uuid']
115
- end
116
-
117
- if attributes.key?(:'error_message')
118
- self.error_message = attributes[:'error_message']
119
- end
120
-
121
- if attributes.key?(:'for_object_id')
122
- self.for_object_id = attributes[:'for_object_id']
123
- end
124
-
125
- if attributes.key?(:'for_object_type')
126
- self.for_object_type = attributes[:'for_object_type']
127
- end
128
-
129
- if attributes.key?(:'max_results')
130
- self.max_results = attributes[:'max_results']
131
- end
132
-
133
- if attributes.key?(:'schema')
134
- if (value = attributes[:'schema']).is_a?(Array)
135
- self.schema = value
136
- end
137
- end
138
-
139
- if attributes.key?(:'user_data')
140
- self.user_data = attributes[:'user_data']
141
- end
142
- end
143
-
144
- # Show invalid properties with the reasons. Usually used together with valid?
145
- # @return Array for valid properties with the reasons
146
- def list_invalid_properties
147
- invalid_properties = Array.new
148
- invalid_properties
149
- end
150
-
151
- # Check to see if the all the properties in the model are valid
152
- # @return true if the model is valid
153
- def valid?
154
- for_object_type_validator = EnumAttributeValidator.new('String', ["schema", "filter", "visualization"])
155
- return false unless for_object_type_validator.valid?(@for_object_type)
156
- true
157
- end
158
-
159
- # Custom attribute writer method checking allowed values (enum).
160
- # @param [Object] for_object_type Object to be assigned
161
- def for_object_type=(for_object_type)
162
- validator = EnumAttributeValidator.new('String', ["schema", "filter", "visualization"])
163
- unless validator.valid?(for_object_type)
164
- fail ArgumentError, "invalid value for \"for_object_type\", must be one of #{validator.allowable_values}."
165
- end
166
- @for_object_type = for_object_type
167
- end
168
-
169
- # Checks equality by comparing each attribute.
170
- # @param [Object] Object to be compared
171
- def ==(o)
172
- return true if self.equal?(o)
173
- self.class == o.class &&
174
- data_set_uuid == o.data_set_uuid &&
175
- error_message == o.error_message &&
176
- for_object_id == o.for_object_id &&
177
- for_object_type == o.for_object_type &&
178
- max_results == o.max_results &&
179
- schema == o.schema &&
180
- user_data == o.user_data
181
- end
182
-
183
- # @see the `==` method
184
- # @param [Object] Object to be compared
185
- def eql?(o)
186
- self == o
187
- end
188
-
189
- # Calculates hash code according to all attributes.
190
- # @return [Integer] Hash code
191
- def hash
192
- [data_set_uuid, error_message, for_object_id, for_object_type, max_results, schema, user_data].hash
193
- end
194
-
195
- # Builds the object from hash
196
- # @param [Hash] attributes Model attributes in the form of hash
197
- # @return [Object] Returns the model itself
198
- def self.build_from_hash(attributes)
199
- new.build_from_hash(attributes)
200
- end
201
-
202
- # Builds the object from hash
203
- # @param [Hash] attributes Model attributes in the form of hash
204
- # @return [Object] Returns the model itself
205
- def build_from_hash(attributes)
206
- return nil unless attributes.is_a?(Hash)
207
- attributes = attributes.transform_keys(&:to_sym)
208
- self.class.openapi_types.each_pair do |key, type|
209
- if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
210
- self.send("#{key}=", nil)
211
- elsif type =~ /\AArray<(.*)>/i
212
- # check to ensure the input is an array given that the attribute
213
- # is documented as an array but the input is not
214
- if attributes[self.class.attribute_map[key]].is_a?(Array)
215
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
- end
217
- elsif !attributes[self.class.attribute_map[key]].nil?
218
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
- end
220
- end
221
-
222
- self
223
- end
224
-
225
- # Deserializes the data based on type
226
- # @param string type Data type
227
- # @param string value Value to be deserialized
228
- # @return [Object] Deserialized data
229
- def _deserialize(type, value)
230
- case type.to_sym
231
- when :Time
232
- Time.parse(value)
233
- when :Date
234
- Date.parse(value)
235
- when :String
236
- value.to_s
237
- when :Integer
238
- value.to_i
239
- when :Float
240
- value.to_f
241
- when :Boolean
242
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
243
- true
244
- else
245
- false
246
- end
247
- when :Object
248
- # generic object (usually a Hash), return directly
249
- value
250
- when /\AArray<(?<inner_type>.+)>\z/
251
- inner_type = Regexp.last_match[:inner_type]
252
- value.map { |v| _deserialize(inner_type, v) }
253
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
254
- k_type = Regexp.last_match[:k_type]
255
- v_type = Regexp.last_match[:v_type]
256
- {}.tap do |hash|
257
- value.each do |k, v|
258
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
259
- end
260
- end
261
- else # model
262
- # models (e.g. Pet) or oneOf
263
- klass = UltracartClient.const_get(type)
264
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
265
- end
266
- end
267
-
268
- # Returns the string representation of the object
269
- # @return [String] String presentation of the object
270
- def to_s
271
- to_hash.to_s
272
- end
273
-
274
- # to_body is an alias to to_hash (backward compatibility)
275
- # @return [Hash] Returns the object in the form of hash
276
- def to_body
277
- to_hash
278
- end
279
-
280
- # Returns the object in the form of hash
281
- # @return [Hash] Returns the object in the form of hash
282
- def to_hash
283
- hash = {}
284
- self.class.attribute_map.each_pair do |attr, param|
285
- value = self.send(attr)
286
- if value.nil?
287
- is_nullable = self.class.openapi_nullable.include?(attr)
288
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
289
- end
290
-
291
- hash[param] = _to_hash(value)
292
- end
293
- hash
294
- end
295
-
296
- # Outputs non-array value in the form of hash
297
- # For object, use to_hash. Otherwise, just return the value
298
- # @param [Object] value Any valid value
299
- # @return [Hash] Returns the value in the form of hash
300
- def _to_hash(value)
301
- if value.is_a?(Array)
302
- value.compact.map { |v| _to_hash(v) }
303
- elsif value.is_a?(Hash)
304
- {}.tap do |hash|
305
- value.each { |k, v| hash[k] = _to_hash(v) }
306
- end
307
- elsif value.respond_to? :to_hash
308
- value.to_hash
309
- else
310
- value
311
- end
312
- end
313
-
314
- end
315
-
316
- end