ultracart_api 3.10.123 → 3.10.125
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -4
- data/docs/DatawarehouseApi.md +461 -0
- data/docs/OrderRefundableResponse.md +1 -0
- data/docs/Report.md +17 -0
- data/docs/ReportAuth.md +11 -0
- data/docs/ReportAuthResponse.md +12 -0
- data/docs/ReportDataSet.md +22 -0
- data/docs/ReportDataSetColumn.md +8 -0
- data/docs/ReportDataSetPage.md +17 -0
- data/docs/ReportDataSetPageResponse.md +12 -0
- data/docs/ReportDataSetQuery.md +19 -0
- data/docs/ReportDataSetResponse.md +12 -0
- data/docs/ReportDataSetRow.md +8 -0
- data/docs/ReportDataSetSchema.md +9 -0
- data/docs/ReportDataSource.md +13 -0
- data/docs/ReportDataSourceSchema.md +10 -0
- data/docs/ReportExecuteQueriesRequest.md +14 -0
- data/docs/ReportFilter.md +13 -0
- data/docs/ReportFilterConnection.md +9 -0
- data/docs/ReportPage.md +11 -0
- data/docs/ReportPageVisualization.md +16 -0
- data/docs/ReportPageVisualizationDimension.md +14 -0
- data/docs/ReportPageVisualizationMetric.md +11 -0
- data/docs/ReportResponse.md +12 -0
- data/docs/ReportsResponse.md +12 -0
- data/lib/ultracart_api/api/datawarehouse_api.rb +529 -0
- data/lib/ultracart_api/models/order_refundable_response.rb +11 -1
- data/lib/ultracart_api/models/report.rb +307 -0
- data/lib/ultracart_api/models/report_auth.rb +212 -0
- data/lib/ultracart_api/models/report_auth_response.rb +221 -0
- data/lib/ultracart_api/models/report_data_set.rb +362 -0
- data/lib/ultracart_api/models/report_data_set_column.rb +184 -0
- data/lib/ultracart_api/models/report_data_set_page.rb +273 -0
- data/lib/ultracart_api/models/report_data_set_page_response.rb +221 -0
- data/lib/ultracart_api/models/report_data_set_query.rb +330 -0
- data/lib/ultracart_api/models/report_data_set_response.rb +221 -0
- data/lib/ultracart_api/models/report_data_set_row.rb +186 -0
- data/lib/ultracart_api/models/report_data_set_schema.rb +228 -0
- data/lib/ultracart_api/models/report_data_source.rb +232 -0
- data/lib/ultracart_api/models/report_data_source_schema.rb +238 -0
- data/lib/ultracart_api/models/report_execute_queries_request.rb +278 -0
- data/lib/ultracart_api/models/report_filter.rb +272 -0
- data/lib/ultracart_api/models/report_filter_connection.rb +193 -0
- data/lib/ultracart_api/models/report_page.rb +216 -0
- data/lib/ultracart_api/models/report_page_visualization.rb +299 -0
- data/lib/ultracart_api/models/report_page_visualization_dimension.rb +244 -0
- data/lib/ultracart_api/models/report_page_visualization_metric.rb +248 -0
- data/lib/ultracart_api/models/report_response.rb +221 -0
- data/lib/ultracart_api/models/reports_response.rb +223 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +23 -0
- metadata +48 -2
@@ -0,0 +1,299 @@
|
|
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 ReportPageVisualization
|
17
|
+
# A JSON representation of the configuration for this visualization
|
18
|
+
attr_accessor :config
|
19
|
+
|
20
|
+
attr_accessor :data_source_name
|
21
|
+
|
22
|
+
attr_accessor :dimensions
|
23
|
+
|
24
|
+
attr_accessor :metrics
|
25
|
+
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# True if the visualization should show a comparison based upon the date range
|
29
|
+
attr_accessor :show_comparison
|
30
|
+
|
31
|
+
# A JSON representation of the style configuration for this visualization
|
32
|
+
attr_accessor :styles
|
33
|
+
|
34
|
+
# Type of visualization
|
35
|
+
attr_accessor :type
|
36
|
+
|
37
|
+
# A UUID for the visualization
|
38
|
+
attr_accessor :visualization_uuid
|
39
|
+
|
40
|
+
class EnumAttributeValidator
|
41
|
+
attr_reader :datatype
|
42
|
+
attr_reader :allowable_values
|
43
|
+
|
44
|
+
def initialize(datatype, allowable_values)
|
45
|
+
@allowable_values = allowable_values.map do |value|
|
46
|
+
case datatype.to_s
|
47
|
+
when /Integer/i
|
48
|
+
value.to_i
|
49
|
+
when /Float/i
|
50
|
+
value.to_f
|
51
|
+
else
|
52
|
+
value
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def valid?(value)
|
58
|
+
!value || allowable_values.include?(value)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
63
|
+
def self.attribute_map
|
64
|
+
{
|
65
|
+
:'config' => :'config',
|
66
|
+
:'data_source_name' => :'data_source_name',
|
67
|
+
:'dimensions' => :'dimensions',
|
68
|
+
:'metrics' => :'metrics',
|
69
|
+
:'name' => :'name',
|
70
|
+
:'show_comparison' => :'show_comparison',
|
71
|
+
:'styles' => :'styles',
|
72
|
+
:'type' => :'type',
|
73
|
+
:'visualization_uuid' => :'visualization_uuid'
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
# Attribute type mapping.
|
78
|
+
def self.swagger_types
|
79
|
+
{
|
80
|
+
:'config' => :'String',
|
81
|
+
:'data_source_name' => :'String',
|
82
|
+
:'dimensions' => :'Array<ReportPageVisualizationDimension>',
|
83
|
+
:'metrics' => :'Array<ReportPageVisualizationMetric>',
|
84
|
+
:'name' => :'String',
|
85
|
+
:'show_comparison' => :'BOOLEAN',
|
86
|
+
:'styles' => :'String',
|
87
|
+
:'type' => :'String',
|
88
|
+
:'visualization_uuid' => :'String'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
return unless attributes.is_a?(Hash)
|
96
|
+
|
97
|
+
# convert string to symbol for hash key
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
99
|
+
|
100
|
+
if attributes.has_key?(:'config')
|
101
|
+
self.config = attributes[:'config']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'data_source_name')
|
105
|
+
self.data_source_name = attributes[:'data_source_name']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:'dimensions')
|
109
|
+
if (value = attributes[:'dimensions']).is_a?(Array)
|
110
|
+
self.dimensions = value
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'metrics')
|
115
|
+
if (value = attributes[:'metrics']).is_a?(Array)
|
116
|
+
self.metrics = value
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'name')
|
121
|
+
self.name = attributes[:'name']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'show_comparison')
|
125
|
+
self.show_comparison = attributes[:'show_comparison']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'styles')
|
129
|
+
self.styles = attributes[:'styles']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'type')
|
133
|
+
self.type = attributes[:'type']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'visualization_uuid')
|
137
|
+
self.visualization_uuid = attributes[:'visualization_uuid']
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
142
|
+
# @return Array for valid properties with the reasons
|
143
|
+
def list_invalid_properties
|
144
|
+
invalid_properties = Array.new
|
145
|
+
invalid_properties
|
146
|
+
end
|
147
|
+
|
148
|
+
# Check to see if the all the properties in the model are valid
|
149
|
+
# @return true if the model is valid
|
150
|
+
def valid?
|
151
|
+
type_validator = EnumAttributeValidator.new('String', ['score card', 'line chart', 'bar chart', 'text', 'table'])
|
152
|
+
return false unless type_validator.valid?(@type)
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
# Custom attribute writer method checking allowed values (enum).
|
157
|
+
# @param [Object] type Object to be assigned
|
158
|
+
def type=(type)
|
159
|
+
validator = EnumAttributeValidator.new('String', ['score card', 'line chart', 'bar chart', 'text', 'table'])
|
160
|
+
unless validator.valid?(type)
|
161
|
+
fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
|
162
|
+
end
|
163
|
+
@type = type
|
164
|
+
end
|
165
|
+
|
166
|
+
# Checks equality by comparing each attribute.
|
167
|
+
# @param [Object] Object to be compared
|
168
|
+
def ==(o)
|
169
|
+
return true if self.equal?(o)
|
170
|
+
self.class == o.class &&
|
171
|
+
config == o.config &&
|
172
|
+
data_source_name == o.data_source_name &&
|
173
|
+
dimensions == o.dimensions &&
|
174
|
+
metrics == o.metrics &&
|
175
|
+
name == o.name &&
|
176
|
+
show_comparison == o.show_comparison &&
|
177
|
+
styles == o.styles &&
|
178
|
+
type == o.type &&
|
179
|
+
visualization_uuid == o.visualization_uuid
|
180
|
+
end
|
181
|
+
|
182
|
+
# @see the `==` method
|
183
|
+
# @param [Object] Object to be compared
|
184
|
+
def eql?(o)
|
185
|
+
self == o
|
186
|
+
end
|
187
|
+
|
188
|
+
# Calculates hash code according to all attributes.
|
189
|
+
# @return [Fixnum] Hash code
|
190
|
+
def hash
|
191
|
+
[config, data_source_name, dimensions, metrics, name, show_comparison, styles, type, visualization_uuid].hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Builds the object from hash
|
195
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
196
|
+
# @return [Object] Returns the model itself
|
197
|
+
def build_from_hash(attributes)
|
198
|
+
return nil unless attributes.is_a?(Hash)
|
199
|
+
self.class.swagger_types.each_pair do |key, type|
|
200
|
+
if type =~ /\AArray<(.*)>/i
|
201
|
+
# check to ensure the input is an array given that the attribute
|
202
|
+
# is documented as an array but the input is not
|
203
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
204
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
205
|
+
end
|
206
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
207
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
208
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
209
|
+
end
|
210
|
+
|
211
|
+
self
|
212
|
+
end
|
213
|
+
|
214
|
+
# Deserializes the data based on type
|
215
|
+
# @param string type Data type
|
216
|
+
# @param string value Value to be deserialized
|
217
|
+
# @return [Object] Deserialized data
|
218
|
+
def _deserialize(type, value)
|
219
|
+
case type.to_sym
|
220
|
+
when :DateTime
|
221
|
+
DateTime.parse(value)
|
222
|
+
when :Date
|
223
|
+
Date.parse(value)
|
224
|
+
when :String
|
225
|
+
value.to_s
|
226
|
+
when :Integer
|
227
|
+
value.to_i
|
228
|
+
when :Float
|
229
|
+
value.to_f
|
230
|
+
when :BOOLEAN
|
231
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
232
|
+
true
|
233
|
+
else
|
234
|
+
false
|
235
|
+
end
|
236
|
+
when :Object
|
237
|
+
# generic object (usually a Hash), return directly
|
238
|
+
value
|
239
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
240
|
+
inner_type = Regexp.last_match[:inner_type]
|
241
|
+
value.map { |v| _deserialize(inner_type, v) }
|
242
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
243
|
+
k_type = Regexp.last_match[:k_type]
|
244
|
+
v_type = Regexp.last_match[:v_type]
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each do |k, v|
|
247
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
else # model
|
251
|
+
temp_model = UltracartClient.const_get(type).new
|
252
|
+
temp_model.build_from_hash(value)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the string representation of the object
|
257
|
+
# @return [String] String presentation of the object
|
258
|
+
def to_s
|
259
|
+
to_hash.to_s
|
260
|
+
end
|
261
|
+
|
262
|
+
# to_body is an alias to to_hash (backward compatibility)
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
264
|
+
def to_body
|
265
|
+
to_hash
|
266
|
+
end
|
267
|
+
|
268
|
+
# Returns the object in the form of hash
|
269
|
+
# @return [Hash] Returns the object in the form of hash
|
270
|
+
def to_hash
|
271
|
+
hash = {}
|
272
|
+
self.class.attribute_map.each_pair do |attr, param|
|
273
|
+
value = self.send(attr)
|
274
|
+
next if value.nil?
|
275
|
+
hash[param] = _to_hash(value)
|
276
|
+
end
|
277
|
+
hash
|
278
|
+
end
|
279
|
+
|
280
|
+
# Outputs non-array value in the form of hash
|
281
|
+
# For object, use to_hash. Otherwise, just return the value
|
282
|
+
# @param [Object] value Any valid value
|
283
|
+
# @return [Hash] Returns the value in the form of hash
|
284
|
+
def _to_hash(value)
|
285
|
+
if value.is_a?(Array)
|
286
|
+
value.compact.map { |v| _to_hash(v) }
|
287
|
+
elsif value.is_a?(Hash)
|
288
|
+
{}.tap do |hash|
|
289
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
290
|
+
end
|
291
|
+
elsif value.respond_to? :to_hash
|
292
|
+
value.to_hash
|
293
|
+
else
|
294
|
+
value
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
end
|
@@ -0,0 +1,244 @@
|
|
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 ReportPageVisualizationDimension
|
17
|
+
# Return the column as a different name
|
18
|
+
attr_accessor :as
|
19
|
+
|
20
|
+
# Cast the column to a different data type such as DATETIME -> DATE
|
21
|
+
attr_accessor :cast
|
22
|
+
|
23
|
+
attr_accessor :column
|
24
|
+
|
25
|
+
# The timezone to shift the date to
|
26
|
+
attr_accessor :datetime_timezone
|
27
|
+
|
28
|
+
# The type of truncation to perform on the date, DAY, WEEK(MONDAY), etc.
|
29
|
+
attr_accessor :datetime_trunc
|
30
|
+
|
31
|
+
# Part of a datetime to extract
|
32
|
+
attr_accessor :extract
|
33
|
+
|
34
|
+
# The function to perform around the column such as DATE_TRUNC(@column, day)
|
35
|
+
attr_accessor :function
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
+
def self.attribute_map
|
39
|
+
{
|
40
|
+
:'as' => :'as',
|
41
|
+
:'cast' => :'cast',
|
42
|
+
:'column' => :'column',
|
43
|
+
:'datetime_timezone' => :'datetime_timezone',
|
44
|
+
:'datetime_trunc' => :'datetime_trunc',
|
45
|
+
:'extract' => :'extract',
|
46
|
+
:'function' => :'function'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute type mapping.
|
51
|
+
def self.swagger_types
|
52
|
+
{
|
53
|
+
:'as' => :'String',
|
54
|
+
:'cast' => :'String',
|
55
|
+
:'column' => :'String',
|
56
|
+
:'datetime_timezone' => :'String',
|
57
|
+
:'datetime_trunc' => :'String',
|
58
|
+
:'extract' => :'String',
|
59
|
+
:'function' => :'String'
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
# Initializes the object
|
64
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
65
|
+
def initialize(attributes = {})
|
66
|
+
return unless attributes.is_a?(Hash)
|
67
|
+
|
68
|
+
# convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
70
|
+
|
71
|
+
if attributes.has_key?(:'as')
|
72
|
+
self.as = attributes[:'as']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.has_key?(:'cast')
|
76
|
+
self.cast = attributes[:'cast']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.has_key?(:'column')
|
80
|
+
self.column = attributes[:'column']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.has_key?(:'datetime_timezone')
|
84
|
+
self.datetime_timezone = attributes[:'datetime_timezone']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.has_key?(:'datetime_trunc')
|
88
|
+
self.datetime_trunc = attributes[:'datetime_trunc']
|
89
|
+
end
|
90
|
+
|
91
|
+
if attributes.has_key?(:'extract')
|
92
|
+
self.extract = attributes[:'extract']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.has_key?(:'function')
|
96
|
+
self.function = attributes[:'function']
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
101
|
+
# @return Array for valid properties with the reasons
|
102
|
+
def list_invalid_properties
|
103
|
+
invalid_properties = Array.new
|
104
|
+
invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
true
|
111
|
+
end
|
112
|
+
|
113
|
+
# Checks equality by comparing each attribute.
|
114
|
+
# @param [Object] Object to be compared
|
115
|
+
def ==(o)
|
116
|
+
return true if self.equal?(o)
|
117
|
+
self.class == o.class &&
|
118
|
+
as == o.as &&
|
119
|
+
cast == o.cast &&
|
120
|
+
column == o.column &&
|
121
|
+
datetime_timezone == o.datetime_timezone &&
|
122
|
+
datetime_trunc == o.datetime_trunc &&
|
123
|
+
extract == o.extract &&
|
124
|
+
function == o.function
|
125
|
+
end
|
126
|
+
|
127
|
+
# @see the `==` method
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def eql?(o)
|
130
|
+
self == o
|
131
|
+
end
|
132
|
+
|
133
|
+
# Calculates hash code according to all attributes.
|
134
|
+
# @return [Fixnum] Hash code
|
135
|
+
def hash
|
136
|
+
[as, cast, column, datetime_timezone, datetime_trunc, extract, function].hash
|
137
|
+
end
|
138
|
+
|
139
|
+
# Builds the object from hash
|
140
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
141
|
+
# @return [Object] Returns the model itself
|
142
|
+
def build_from_hash(attributes)
|
143
|
+
return nil unless attributes.is_a?(Hash)
|
144
|
+
self.class.swagger_types.each_pair do |key, type|
|
145
|
+
if type =~ /\AArray<(.*)>/i
|
146
|
+
# check to ensure the input is an array given that the attribute
|
147
|
+
# is documented as an array but the input is not
|
148
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
149
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
150
|
+
end
|
151
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
152
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
153
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
154
|
+
end
|
155
|
+
|
156
|
+
self
|
157
|
+
end
|
158
|
+
|
159
|
+
# Deserializes the data based on type
|
160
|
+
# @param string type Data type
|
161
|
+
# @param string value Value to be deserialized
|
162
|
+
# @return [Object] Deserialized data
|
163
|
+
def _deserialize(type, value)
|
164
|
+
case type.to_sym
|
165
|
+
when :DateTime
|
166
|
+
DateTime.parse(value)
|
167
|
+
when :Date
|
168
|
+
Date.parse(value)
|
169
|
+
when :String
|
170
|
+
value.to_s
|
171
|
+
when :Integer
|
172
|
+
value.to_i
|
173
|
+
when :Float
|
174
|
+
value.to_f
|
175
|
+
when :BOOLEAN
|
176
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
177
|
+
true
|
178
|
+
else
|
179
|
+
false
|
180
|
+
end
|
181
|
+
when :Object
|
182
|
+
# generic object (usually a Hash), return directly
|
183
|
+
value
|
184
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
185
|
+
inner_type = Regexp.last_match[:inner_type]
|
186
|
+
value.map { |v| _deserialize(inner_type, v) }
|
187
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
188
|
+
k_type = Regexp.last_match[:k_type]
|
189
|
+
v_type = Regexp.last_match[:v_type]
|
190
|
+
{}.tap do |hash|
|
191
|
+
value.each do |k, v|
|
192
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
else # model
|
196
|
+
temp_model = UltracartClient.const_get(type).new
|
197
|
+
temp_model.build_from_hash(value)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Returns the string representation of the object
|
202
|
+
# @return [String] String presentation of the object
|
203
|
+
def to_s
|
204
|
+
to_hash.to_s
|
205
|
+
end
|
206
|
+
|
207
|
+
# to_body is an alias to to_hash (backward compatibility)
|
208
|
+
# @return [Hash] Returns the object in the form of hash
|
209
|
+
def to_body
|
210
|
+
to_hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the object in the form of hash
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_hash
|
216
|
+
hash = {}
|
217
|
+
self.class.attribute_map.each_pair do |attr, param|
|
218
|
+
value = self.send(attr)
|
219
|
+
next if value.nil?
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Outputs non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
# @param [Object] value Any valid value
|
228
|
+
# @return [Hash] Returns the value in the form of hash
|
229
|
+
def _to_hash(value)
|
230
|
+
if value.is_a?(Array)
|
231
|
+
value.compact.map { |v| _to_hash(v) }
|
232
|
+
elsif value.is_a?(Hash)
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
235
|
+
end
|
236
|
+
elsif value.respond_to? :to_hash
|
237
|
+
value.to_hash
|
238
|
+
else
|
239
|
+
value
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
end
|
244
|
+
end
|