ultracart_api 3.10.126 → 3.10.127
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/docs/Experiment.md +5 -0
- data/docs/ReportWebsocketEvent.md +1 -1
- data/lib/ultracart_api/models/experiment.rb +63 -1
- data/lib/ultracart_api/models/report_websocket_event.rb +1 -1
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +0 -1
- metadata +2 -4
- data/docs/ReportDataSetSummary.md +0 -14
- data/lib/ultracart_api/models/report_data_set_summary.rb +0 -281
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b048b7cad8d5f9d279f49945dccba5a4762f613c54ff7d94370b5a2b57ca539
|
4
|
+
data.tar.gz: b4705f7af0715909dd869a33e5ad622974911da00f6b5fc92b0fbde87b2b6428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f59f8a93970d4b69e8cf590626c951f48c127e6184cb4fae108157c49dfd856770e3fe48b719349aea5e0c6bfa229b2246bebe4143532aaafec039405242eb42
|
7
|
+
data.tar.gz: bf13639adb5ae4f3c5e68360a5a155044978c9761f20636a253412f109ccc344ca9358fb8d8400982c289d5e1d6f58b1805230fb3063d95df012b9bc6d9a7cd4
|
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.
|
10
|
+
- Package version: 3.10.127
|
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.
|
27
|
+
gem install ./ultracart_api-3.10.127.gem
|
28
28
|
```
|
29
|
-
(for development, run `gem install --dev ./ultracart_api-3.10.
|
29
|
+
(for development, run `gem install --dev ./ultracart_api-3.10.127.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.
|
35
|
+
gem 'ultracart_api', '~> 3.10.127'
|
36
36
|
|
37
37
|
### Install from Git
|
38
38
|
|
@@ -1138,7 +1138,6 @@ Class | Method | HTTP request | Description
|
|
1138
1138
|
- [UltracartClient::ReportDataSetResponse](docs/ReportDataSetResponse.md)
|
1139
1139
|
- [UltracartClient::ReportDataSetRow](docs/ReportDataSetRow.md)
|
1140
1140
|
- [UltracartClient::ReportDataSetSchema](docs/ReportDataSetSchema.md)
|
1141
|
-
- [UltracartClient::ReportDataSetSummary](docs/ReportDataSetSummary.md)
|
1142
1141
|
- [UltracartClient::ReportDataSource](docs/ReportDataSource.md)
|
1143
1142
|
- [UltracartClient::ReportDataSourceSchema](docs/ReportDataSourceSchema.md)
|
1144
1143
|
- [UltracartClient::ReportExecuteQueriesRequest](docs/ReportExecuteQueriesRequest.md)
|
@@ -1340,6 +1339,7 @@ Not every change is committed to every SDK.
|
|
1340
1339
|
|
1341
1340
|
| Version | Date | Comments |
|
1342
1341
|
| --: | :-: | --- |
|
1342
|
+
| 3.10.127 | 03/29/2023 | internal development |
|
1343
1343
|
| 3.10.126 | 03/22/2023 | data warehouse internal dev |
|
1344
1344
|
| 3.10.125 | 03/22/2023 | dw initial framework |
|
1345
1345
|
| 3.10.124 | 03/22/2023 | order api - refundable response added manual_because_multiple_charges boolean field |
|
data/docs/Experiment.md
CHANGED
@@ -13,7 +13,12 @@ Name | Type | Description | Notes
|
|
13
13
|
**notes** | **String** | Notes about the experiment | [optional]
|
14
14
|
**objective** | **String** | Objective that is being optimized | [optional]
|
15
15
|
**objective_parameter** | **String** | Objective parameter (such as event name) that is being optimized | [optional]
|
16
|
+
**openai_current_iteration** | **Integer** | The current iteration of the OpenAI related experiment | [optional]
|
17
|
+
**openai_element_type** | **String** | The type of OpenAI element being experimented on | [optional]
|
18
|
+
**openai_model** | **String** | The type of OpenAI model used | [optional]
|
19
|
+
**openai_total_iterations** | **Integer** | The total number of iterations to perform on the experiment | [optional]
|
16
20
|
**optimization_type** | **String** | Type of optimization | [optional]
|
21
|
+
**p_value** | **Float** | Statistics p-value for the experiment | [optional]
|
17
22
|
**session_count** | **Integer** | Total number of sessions in the experiment | [optional]
|
18
23
|
**start_dts** | **String** | Start date/time | [optional]
|
19
24
|
**status** | **String** | Status of the experiment | [optional]
|
@@ -4,6 +4,6 @@
|
|
4
4
|
Name | Type | Description | Notes
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**event_type** | **String** | Event type | [optional]
|
7
|
-
**query_completion** | [**
|
7
|
+
**query_completion** | [**ReportDataSet**](ReportDataSet.md) | | [optional]
|
8
8
|
|
9
9
|
|
@@ -44,9 +44,24 @@ module UltracartClient
|
|
44
44
|
# Objective parameter (such as event name) that is being optimized
|
45
45
|
attr_accessor :objective_parameter
|
46
46
|
|
47
|
+
# The current iteration of the OpenAI related experiment
|
48
|
+
attr_accessor :openai_current_iteration
|
49
|
+
|
50
|
+
# The type of OpenAI element being experimented on
|
51
|
+
attr_accessor :openai_element_type
|
52
|
+
|
53
|
+
# The type of OpenAI model used
|
54
|
+
attr_accessor :openai_model
|
55
|
+
|
56
|
+
# The total number of iterations to perform on the experiment
|
57
|
+
attr_accessor :openai_total_iterations
|
58
|
+
|
47
59
|
# Type of optimization
|
48
60
|
attr_accessor :optimization_type
|
49
61
|
|
62
|
+
# Statistics p-value for the experiment
|
63
|
+
attr_accessor :p_value
|
64
|
+
|
50
65
|
# Total number of sessions in the experiment
|
51
66
|
attr_accessor :session_count
|
52
67
|
|
@@ -103,7 +118,12 @@ module UltracartClient
|
|
103
118
|
:'notes' => :'notes',
|
104
119
|
:'objective' => :'objective',
|
105
120
|
:'objective_parameter' => :'objective_parameter',
|
121
|
+
:'openai_current_iteration' => :'openai_current_iteration',
|
122
|
+
:'openai_element_type' => :'openai_element_type',
|
123
|
+
:'openai_model' => :'openai_model',
|
124
|
+
:'openai_total_iterations' => :'openai_total_iterations',
|
106
125
|
:'optimization_type' => :'optimization_type',
|
126
|
+
:'p_value' => :'p_value',
|
107
127
|
:'session_count' => :'session_count',
|
108
128
|
:'start_dts' => :'start_dts',
|
109
129
|
:'status' => :'status',
|
@@ -127,7 +147,12 @@ module UltracartClient
|
|
127
147
|
:'notes' => :'String',
|
128
148
|
:'objective' => :'String',
|
129
149
|
:'objective_parameter' => :'String',
|
150
|
+
:'openai_current_iteration' => :'Integer',
|
151
|
+
:'openai_element_type' => :'String',
|
152
|
+
:'openai_model' => :'String',
|
153
|
+
:'openai_total_iterations' => :'Integer',
|
130
154
|
:'optimization_type' => :'String',
|
155
|
+
:'p_value' => :'Float',
|
131
156
|
:'session_count' => :'Integer',
|
132
157
|
:'start_dts' => :'String',
|
133
158
|
:'status' => :'String',
|
@@ -186,10 +211,30 @@ module UltracartClient
|
|
186
211
|
self.objective_parameter = attributes[:'objective_parameter']
|
187
212
|
end
|
188
213
|
|
214
|
+
if attributes.has_key?(:'openai_current_iteration')
|
215
|
+
self.openai_current_iteration = attributes[:'openai_current_iteration']
|
216
|
+
end
|
217
|
+
|
218
|
+
if attributes.has_key?(:'openai_element_type')
|
219
|
+
self.openai_element_type = attributes[:'openai_element_type']
|
220
|
+
end
|
221
|
+
|
222
|
+
if attributes.has_key?(:'openai_model')
|
223
|
+
self.openai_model = attributes[:'openai_model']
|
224
|
+
end
|
225
|
+
|
226
|
+
if attributes.has_key?(:'openai_total_iterations')
|
227
|
+
self.openai_total_iterations = attributes[:'openai_total_iterations']
|
228
|
+
end
|
229
|
+
|
189
230
|
if attributes.has_key?(:'optimization_type')
|
190
231
|
self.optimization_type = attributes[:'optimization_type']
|
191
232
|
end
|
192
233
|
|
234
|
+
if attributes.has_key?(:'p_value')
|
235
|
+
self.p_value = attributes[:'p_value']
|
236
|
+
end
|
237
|
+
|
193
238
|
if attributes.has_key?(:'session_count')
|
194
239
|
self.session_count = attributes[:'session_count']
|
195
240
|
end
|
@@ -231,11 +276,23 @@ module UltracartClient
|
|
231
276
|
# Check to see if the all the properties in the model are valid
|
232
277
|
# @return true if the model is valid
|
233
278
|
def valid?
|
279
|
+
openai_element_type_validator = EnumAttributeValidator.new('String', ['headline', 'text', 'textblock'])
|
280
|
+
return false unless openai_element_type_validator.valid?(@openai_element_type)
|
234
281
|
status_validator = EnumAttributeValidator.new('String', ['Running', 'Ended', 'Deleted'])
|
235
282
|
return false unless status_validator.valid?(@status)
|
236
283
|
true
|
237
284
|
end
|
238
285
|
|
286
|
+
# Custom attribute writer method checking allowed values (enum).
|
287
|
+
# @param [Object] openai_element_type Object to be assigned
|
288
|
+
def openai_element_type=(openai_element_type)
|
289
|
+
validator = EnumAttributeValidator.new('String', ['headline', 'text', 'textblock'])
|
290
|
+
unless validator.valid?(openai_element_type)
|
291
|
+
fail ArgumentError, 'invalid value for "openai_element_type", must be one of #{validator.allowable_values}.'
|
292
|
+
end
|
293
|
+
@openai_element_type = openai_element_type
|
294
|
+
end
|
295
|
+
|
239
296
|
# Custom attribute writer method checking allowed values (enum).
|
240
297
|
# @param [Object] status Object to be assigned
|
241
298
|
def status=(status)
|
@@ -261,7 +318,12 @@ module UltracartClient
|
|
261
318
|
notes == o.notes &&
|
262
319
|
objective == o.objective &&
|
263
320
|
objective_parameter == o.objective_parameter &&
|
321
|
+
openai_current_iteration == o.openai_current_iteration &&
|
322
|
+
openai_element_type == o.openai_element_type &&
|
323
|
+
openai_model == o.openai_model &&
|
324
|
+
openai_total_iterations == o.openai_total_iterations &&
|
264
325
|
optimization_type == o.optimization_type &&
|
326
|
+
p_value == o.p_value &&
|
265
327
|
session_count == o.session_count &&
|
266
328
|
start_dts == o.start_dts &&
|
267
329
|
status == o.status &&
|
@@ -280,7 +342,7 @@ module UltracartClient
|
|
280
342
|
# Calculates hash code according to all attributes.
|
281
343
|
# @return [Fixnum] Hash code
|
282
344
|
def hash
|
283
|
-
[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
|
345
|
+
[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
|
284
346
|
end
|
285
347
|
|
286
348
|
# Builds the object from hash
|
data/lib/ultracart_api.rb
CHANGED
@@ -652,7 +652,6 @@ require 'ultracart_api/models/report_data_set_query'
|
|
652
652
|
require 'ultracart_api/models/report_data_set_response'
|
653
653
|
require 'ultracart_api/models/report_data_set_row'
|
654
654
|
require 'ultracart_api/models/report_data_set_schema'
|
655
|
-
require 'ultracart_api/models/report_data_set_summary'
|
656
655
|
require 'ultracart_api/models/report_data_source'
|
657
656
|
require 'ultracart_api/models/report_data_source_schema'
|
658
657
|
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: 3.10.
|
4
|
+
version: 3.10.127
|
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-
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -871,7 +871,6 @@ files:
|
|
871
871
|
- docs/ReportDataSetResponse.md
|
872
872
|
- docs/ReportDataSetRow.md
|
873
873
|
- docs/ReportDataSetSchema.md
|
874
|
-
- docs/ReportDataSetSummary.md
|
875
874
|
- docs/ReportDataSource.md
|
876
875
|
- docs/ReportDataSourceSchema.md
|
877
876
|
- docs/ReportExecuteQueriesRequest.md
|
@@ -1668,7 +1667,6 @@ files:
|
|
1668
1667
|
- lib/ultracart_api/models/report_data_set_response.rb
|
1669
1668
|
- lib/ultracart_api/models/report_data_set_row.rb
|
1670
1669
|
- lib/ultracart_api/models/report_data_set_schema.rb
|
1671
|
-
- lib/ultracart_api/models/report_data_set_summary.rb
|
1672
1670
|
- lib/ultracart_api/models/report_data_source.rb
|
1673
1671
|
- lib/ultracart_api/models/report_data_source_schema.rb
|
1674
1672
|
- lib/ultracart_api/models/report_execute_queries_request.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# UltracartClient::ReportDataSetSummary
|
2
|
-
|
3
|
-
## Properties
|
4
|
-
Name | Type | Description | Notes
|
5
|
-
------------ | ------------- | ------------- | -------------
|
6
|
-
**data_set_uuid** | **String** | A unique identifier assigned to the data set that is returned. | [optional]
|
7
|
-
**error_message** | **String** | Error message if the query failed. | [optional]
|
8
|
-
**for_object_id** | **String** | An identifier that can be used to help match up the returned data set | [optional]
|
9
|
-
**for_object_type** | **String** | The type of object this data set is for | [optional]
|
10
|
-
**max_results** | **Integer** | The total number of results | [optional]
|
11
|
-
**schema** | [**Array<ReportDataSetSchema>**](ReportDataSetSchema.md) | The schema associated with the data set. | [optional]
|
12
|
-
**user_data** | **String** | Any other data that needs to be returned with the response to help the UI | [optional]
|
13
|
-
|
14
|
-
|
@@ -1,281 +0,0 @@
|
|
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 ReportDataSetSummary
|
17
|
-
# A unique identifier assigned to the data set that is returned.
|
18
|
-
attr_accessor :data_set_uuid
|
19
|
-
|
20
|
-
# Error message if the query failed.
|
21
|
-
attr_accessor :error_message
|
22
|
-
|
23
|
-
# An identifier that can be used to help match up the returned data set
|
24
|
-
attr_accessor :for_object_id
|
25
|
-
|
26
|
-
# The type of object this data set is for
|
27
|
-
attr_accessor :for_object_type
|
28
|
-
|
29
|
-
# The total number of results
|
30
|
-
attr_accessor :max_results
|
31
|
-
|
32
|
-
# The schema associated with the data set.
|
33
|
-
attr_accessor :schema
|
34
|
-
|
35
|
-
# Any other data that needs to be returned with the response to help the UI
|
36
|
-
attr_accessor :user_data
|
37
|
-
|
38
|
-
class EnumAttributeValidator
|
39
|
-
attr_reader :datatype
|
40
|
-
attr_reader :allowable_values
|
41
|
-
|
42
|
-
def initialize(datatype, allowable_values)
|
43
|
-
@allowable_values = allowable_values.map do |value|
|
44
|
-
case datatype.to_s
|
45
|
-
when /Integer/i
|
46
|
-
value.to_i
|
47
|
-
when /Float/i
|
48
|
-
value.to_f
|
49
|
-
else
|
50
|
-
value
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def valid?(value)
|
56
|
-
!value || allowable_values.include?(value)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
61
|
-
def self.attribute_map
|
62
|
-
{
|
63
|
-
:'data_set_uuid' => :'data_set_uuid',
|
64
|
-
:'error_message' => :'error_message',
|
65
|
-
:'for_object_id' => :'for_object_id',
|
66
|
-
:'for_object_type' => :'for_object_type',
|
67
|
-
:'max_results' => :'max_results',
|
68
|
-
:'schema' => :'schema',
|
69
|
-
:'user_data' => :'user_data'
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
# Attribute type mapping.
|
74
|
-
def self.swagger_types
|
75
|
-
{
|
76
|
-
:'data_set_uuid' => :'String',
|
77
|
-
:'error_message' => :'String',
|
78
|
-
:'for_object_id' => :'String',
|
79
|
-
:'for_object_type' => :'String',
|
80
|
-
:'max_results' => :'Integer',
|
81
|
-
:'schema' => :'Array<ReportDataSetSchema>',
|
82
|
-
:'user_data' => :'String'
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
# Initializes the object
|
87
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
88
|
-
def initialize(attributes = {})
|
89
|
-
return unless attributes.is_a?(Hash)
|
90
|
-
|
91
|
-
# convert string to symbol for hash key
|
92
|
-
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
93
|
-
|
94
|
-
if attributes.has_key?(:'data_set_uuid')
|
95
|
-
self.data_set_uuid = attributes[:'data_set_uuid']
|
96
|
-
end
|
97
|
-
|
98
|
-
if attributes.has_key?(:'error_message')
|
99
|
-
self.error_message = attributes[:'error_message']
|
100
|
-
end
|
101
|
-
|
102
|
-
if attributes.has_key?(:'for_object_id')
|
103
|
-
self.for_object_id = attributes[:'for_object_id']
|
104
|
-
end
|
105
|
-
|
106
|
-
if attributes.has_key?(:'for_object_type')
|
107
|
-
self.for_object_type = attributes[:'for_object_type']
|
108
|
-
end
|
109
|
-
|
110
|
-
if attributes.has_key?(:'max_results')
|
111
|
-
self.max_results = attributes[:'max_results']
|
112
|
-
end
|
113
|
-
|
114
|
-
if attributes.has_key?(:'schema')
|
115
|
-
if (value = attributes[:'schema']).is_a?(Array)
|
116
|
-
self.schema = value
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
if attributes.has_key?(:'user_data')
|
121
|
-
self.user_data = attributes[:'user_data']
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
126
|
-
# @return Array for valid properties with the reasons
|
127
|
-
def list_invalid_properties
|
128
|
-
invalid_properties = Array.new
|
129
|
-
invalid_properties
|
130
|
-
end
|
131
|
-
|
132
|
-
# Check to see if the all the properties in the model are valid
|
133
|
-
# @return true if the model is valid
|
134
|
-
def valid?
|
135
|
-
for_object_type_validator = EnumAttributeValidator.new('String', ['schema', 'filter', 'visualization'])
|
136
|
-
return false unless for_object_type_validator.valid?(@for_object_type)
|
137
|
-
true
|
138
|
-
end
|
139
|
-
|
140
|
-
# Custom attribute writer method checking allowed values (enum).
|
141
|
-
# @param [Object] for_object_type Object to be assigned
|
142
|
-
def for_object_type=(for_object_type)
|
143
|
-
validator = EnumAttributeValidator.new('String', ['schema', 'filter', 'visualization'])
|
144
|
-
unless validator.valid?(for_object_type)
|
145
|
-
fail ArgumentError, 'invalid value for "for_object_type", must be one of #{validator.allowable_values}.'
|
146
|
-
end
|
147
|
-
@for_object_type = for_object_type
|
148
|
-
end
|
149
|
-
|
150
|
-
# Checks equality by comparing each attribute.
|
151
|
-
# @param [Object] Object to be compared
|
152
|
-
def ==(o)
|
153
|
-
return true if self.equal?(o)
|
154
|
-
self.class == o.class &&
|
155
|
-
data_set_uuid == o.data_set_uuid &&
|
156
|
-
error_message == o.error_message &&
|
157
|
-
for_object_id == o.for_object_id &&
|
158
|
-
for_object_type == o.for_object_type &&
|
159
|
-
max_results == o.max_results &&
|
160
|
-
schema == o.schema &&
|
161
|
-
user_data == o.user_data
|
162
|
-
end
|
163
|
-
|
164
|
-
# @see the `==` method
|
165
|
-
# @param [Object] Object to be compared
|
166
|
-
def eql?(o)
|
167
|
-
self == o
|
168
|
-
end
|
169
|
-
|
170
|
-
# Calculates hash code according to all attributes.
|
171
|
-
# @return [Fixnum] Hash code
|
172
|
-
def hash
|
173
|
-
[data_set_uuid, error_message, for_object_id, for_object_type, max_results, schema, user_data].hash
|
174
|
-
end
|
175
|
-
|
176
|
-
# Builds the object from hash
|
177
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
178
|
-
# @return [Object] Returns the model itself
|
179
|
-
def build_from_hash(attributes)
|
180
|
-
return nil unless attributes.is_a?(Hash)
|
181
|
-
self.class.swagger_types.each_pair do |key, type|
|
182
|
-
if type =~ /\AArray<(.*)>/i
|
183
|
-
# check to ensure the input is an array given that the attribute
|
184
|
-
# is documented as an array but the input is not
|
185
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
186
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
187
|
-
end
|
188
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
189
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
190
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
191
|
-
end
|
192
|
-
|
193
|
-
self
|
194
|
-
end
|
195
|
-
|
196
|
-
# Deserializes the data based on type
|
197
|
-
# @param string type Data type
|
198
|
-
# @param string value Value to be deserialized
|
199
|
-
# @return [Object] Deserialized data
|
200
|
-
def _deserialize(type, value)
|
201
|
-
case type.to_sym
|
202
|
-
when :DateTime
|
203
|
-
DateTime.parse(value)
|
204
|
-
when :Date
|
205
|
-
Date.parse(value)
|
206
|
-
when :String
|
207
|
-
value.to_s
|
208
|
-
when :Integer
|
209
|
-
value.to_i
|
210
|
-
when :Float
|
211
|
-
value.to_f
|
212
|
-
when :BOOLEAN
|
213
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
214
|
-
true
|
215
|
-
else
|
216
|
-
false
|
217
|
-
end
|
218
|
-
when :Object
|
219
|
-
# generic object (usually a Hash), return directly
|
220
|
-
value
|
221
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
222
|
-
inner_type = Regexp.last_match[:inner_type]
|
223
|
-
value.map { |v| _deserialize(inner_type, v) }
|
224
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
225
|
-
k_type = Regexp.last_match[:k_type]
|
226
|
-
v_type = Regexp.last_match[:v_type]
|
227
|
-
{}.tap do |hash|
|
228
|
-
value.each do |k, v|
|
229
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
else # model
|
233
|
-
temp_model = UltracartClient.const_get(type).new
|
234
|
-
temp_model.build_from_hash(value)
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
# Returns the string representation of the object
|
239
|
-
# @return [String] String presentation of the object
|
240
|
-
def to_s
|
241
|
-
to_hash.to_s
|
242
|
-
end
|
243
|
-
|
244
|
-
# to_body is an alias to to_hash (backward compatibility)
|
245
|
-
# @return [Hash] Returns the object in the form of hash
|
246
|
-
def to_body
|
247
|
-
to_hash
|
248
|
-
end
|
249
|
-
|
250
|
-
# Returns the object in the form of hash
|
251
|
-
# @return [Hash] Returns the object in the form of hash
|
252
|
-
def to_hash
|
253
|
-
hash = {}
|
254
|
-
self.class.attribute_map.each_pair do |attr, param|
|
255
|
-
value = self.send(attr)
|
256
|
-
next if value.nil?
|
257
|
-
hash[param] = _to_hash(value)
|
258
|
-
end
|
259
|
-
hash
|
260
|
-
end
|
261
|
-
|
262
|
-
# Outputs non-array value in the form of hash
|
263
|
-
# For object, use to_hash. Otherwise, just return the value
|
264
|
-
# @param [Object] value Any valid value
|
265
|
-
# @return [Hash] Returns the value in the form of hash
|
266
|
-
def _to_hash(value)
|
267
|
-
if value.is_a?(Array)
|
268
|
-
value.compact.map { |v| _to_hash(v) }
|
269
|
-
elsif value.is_a?(Hash)
|
270
|
-
{}.tap do |hash|
|
271
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
272
|
-
end
|
273
|
-
elsif value.respond_to? :to_hash
|
274
|
-
value.to_hash
|
275
|
-
else
|
276
|
-
value
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
end
|
281
|
-
end
|