ultracart_api 4.0.141 → 4.0.143
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -4
- data/docs/DatawarehouseApi.md +651 -0
- data/docs/Report.md +36 -0
- data/docs/ReportAuth.md +24 -0
- data/docs/ReportAuthResponse.md +26 -0
- data/docs/ReportDataSet.md +46 -0
- data/docs/ReportDataSetColumn.md +18 -0
- data/docs/ReportDataSetPage.md +36 -0
- data/docs/ReportDataSetPageResponse.md +26 -0
- data/docs/ReportDataSetQuery.md +40 -0
- data/docs/ReportDataSetResponse.md +26 -0
- data/docs/ReportDataSetRow.md +18 -0
- data/docs/ReportDataSetSchema.md +20 -0
- data/docs/ReportDataSetSummary.md +30 -0
- data/docs/ReportDataSource.md +28 -0
- data/docs/ReportDataSourceSchema.md +22 -0
- data/docs/ReportExecuteQueriesRequest.md +30 -0
- data/docs/ReportFilter.md +28 -0
- data/docs/ReportFilterConnection.md +20 -0
- data/docs/ReportPage.md +24 -0
- data/docs/ReportPageVisualization.md +34 -0
- data/docs/ReportPageVisualizationDimension.md +30 -0
- data/docs/ReportPageVisualizationMetric.md +24 -0
- data/docs/ReportResponse.md +26 -0
- data/docs/ReportWebsocketEvent.md +20 -0
- data/docs/ReportsResponse.md +26 -0
- data/lib/ultracart_api/api/datawarehouse_api.rb +626 -0
- data/lib/ultracart_api/models/report.rb +342 -0
- data/lib/ultracart_api/models/report_auth.rb +247 -0
- data/lib/ultracart_api/models/report_auth_response.rb +256 -0
- data/lib/ultracart_api/models/report_data_set.rb +397 -0
- data/lib/ultracart_api/models/report_data_set_column.rb +219 -0
- data/lib/ultracart_api/models/report_data_set_page.rb +308 -0
- data/lib/ultracart_api/models/report_data_set_page_response.rb +256 -0
- data/lib/ultracart_api/models/report_data_set_query.rb +365 -0
- data/lib/ultracart_api/models/report_data_set_response.rb +256 -0
- data/lib/ultracart_api/models/report_data_set_row.rb +221 -0
- data/lib/ultracart_api/models/report_data_set_schema.rb +263 -0
- data/lib/ultracart_api/models/report_data_set_summary.rb +316 -0
- data/lib/ultracart_api/models/report_data_source.rb +267 -0
- data/lib/ultracart_api/models/report_data_source_schema.rb +273 -0
- data/lib/ultracart_api/models/report_execute_queries_request.rb +313 -0
- data/lib/ultracart_api/models/report_filter.rb +307 -0
- data/lib/ultracart_api/models/report_filter_connection.rb +228 -0
- data/lib/ultracart_api/models/report_page.rb +251 -0
- data/lib/ultracart_api/models/report_page_visualization.rb +334 -0
- data/lib/ultracart_api/models/report_page_visualization_dimension.rb +279 -0
- data/lib/ultracart_api/models/report_page_visualization_metric.rb +283 -0
- data/lib/ultracart_api/models/report_response.rb +256 -0
- data/lib/ultracart_api/models/report_websocket_event.rb +263 -0
- data/lib/ultracart_api/models/reports_response.rb +258 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +25 -0
- metadata +51 -1
@@ -0,0 +1,313 @@
|
|
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 ReportExecuteQueriesRequest
|
18
|
+
# Unique UUID assigned to this client during the auth. This will be used to locate the websocket connect id.
|
19
|
+
attr_accessor :client_uuid
|
20
|
+
|
21
|
+
# The websocket connection id that should receive back notices of query completion.
|
22
|
+
attr_accessor :connection_id
|
23
|
+
|
24
|
+
attr_accessor :default_dataset_id
|
25
|
+
|
26
|
+
attr_accessor :default_project_id
|
27
|
+
|
28
|
+
attr_accessor :merchant_id
|
29
|
+
|
30
|
+
# An array of queries that we want the lambda function to execute.
|
31
|
+
attr_accessor :queries
|
32
|
+
|
33
|
+
# Security level to execute report under
|
34
|
+
attr_accessor :security_level
|
35
|
+
|
36
|
+
class EnumAttributeValidator
|
37
|
+
attr_reader :datatype
|
38
|
+
attr_reader :allowable_values
|
39
|
+
|
40
|
+
def initialize(datatype, allowable_values)
|
41
|
+
@allowable_values = allowable_values.map do |value|
|
42
|
+
case datatype.to_s
|
43
|
+
when /Integer/i
|
44
|
+
value.to_i
|
45
|
+
when /Float/i
|
46
|
+
value.to_f
|
47
|
+
else
|
48
|
+
value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def valid?(value)
|
54
|
+
!value || allowable_values.include?(value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
59
|
+
def self.attribute_map
|
60
|
+
{
|
61
|
+
:'client_uuid' => :'client_uuid',
|
62
|
+
:'connection_id' => :'connection_id',
|
63
|
+
:'default_dataset_id' => :'default_dataset_id',
|
64
|
+
:'default_project_id' => :'default_project_id',
|
65
|
+
:'merchant_id' => :'merchant_id',
|
66
|
+
:'queries' => :'queries',
|
67
|
+
:'security_level' => :'security_level'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns all the JSON keys this model knows about
|
72
|
+
def self.acceptable_attributes
|
73
|
+
attribute_map.values
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute type mapping.
|
77
|
+
def self.openapi_types
|
78
|
+
{
|
79
|
+
:'client_uuid' => :'String',
|
80
|
+
:'connection_id' => :'String',
|
81
|
+
:'default_dataset_id' => :'String',
|
82
|
+
:'default_project_id' => :'String',
|
83
|
+
:'merchant_id' => :'String',
|
84
|
+
:'queries' => :'Array<ReportDataSetQuery>',
|
85
|
+
:'security_level' => :'String'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# List of attributes with nullable: true
|
90
|
+
def self.openapi_nullable
|
91
|
+
Set.new([
|
92
|
+
])
|
93
|
+
end
|
94
|
+
|
95
|
+
# Initializes the object
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
def initialize(attributes = {})
|
98
|
+
if (!attributes.is_a?(Hash))
|
99
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportExecuteQueriesRequest` initialize method"
|
100
|
+
end
|
101
|
+
|
102
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
103
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
104
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
105
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportExecuteQueriesRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
106
|
+
end
|
107
|
+
h[k.to_sym] = v
|
108
|
+
}
|
109
|
+
|
110
|
+
if attributes.key?(:'client_uuid')
|
111
|
+
self.client_uuid = attributes[:'client_uuid']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'connection_id')
|
115
|
+
self.connection_id = attributes[:'connection_id']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'default_dataset_id')
|
119
|
+
self.default_dataset_id = attributes[:'default_dataset_id']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'default_project_id')
|
123
|
+
self.default_project_id = attributes[:'default_project_id']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.key?(:'merchant_id')
|
127
|
+
self.merchant_id = attributes[:'merchant_id']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.key?(:'queries')
|
131
|
+
if (value = attributes[:'queries']).is_a?(Array)
|
132
|
+
self.queries = value
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'security_level')
|
137
|
+
self.security_level = attributes[:'security_level']
|
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
|
+
security_level_validator = EnumAttributeValidator.new('String', ["standard", "low", "medium", "high"])
|
152
|
+
return false unless security_level_validator.valid?(@security_level)
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
# Custom attribute writer method checking allowed values (enum).
|
157
|
+
# @param [Object] security_level Object to be assigned
|
158
|
+
def security_level=(security_level)
|
159
|
+
validator = EnumAttributeValidator.new('String', ["standard", "low", "medium", "high"])
|
160
|
+
unless validator.valid?(security_level)
|
161
|
+
fail ArgumentError, "invalid value for \"security_level\", must be one of #{validator.allowable_values}."
|
162
|
+
end
|
163
|
+
@security_level = security_level
|
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
|
+
client_uuid == o.client_uuid &&
|
172
|
+
connection_id == o.connection_id &&
|
173
|
+
default_dataset_id == o.default_dataset_id &&
|
174
|
+
default_project_id == o.default_project_id &&
|
175
|
+
merchant_id == o.merchant_id &&
|
176
|
+
queries == o.queries &&
|
177
|
+
security_level == o.security_level
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def eql?(o)
|
183
|
+
self == o
|
184
|
+
end
|
185
|
+
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Integer] Hash code
|
188
|
+
def hash
|
189
|
+
[client_uuid, connection_id, default_dataset_id, default_project_id, merchant_id, queries, security_level].hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def self.build_from_hash(attributes)
|
196
|
+
new.build_from_hash(attributes)
|
197
|
+
end
|
198
|
+
|
199
|
+
# Builds the object from hash
|
200
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
201
|
+
# @return [Object] Returns the model itself
|
202
|
+
def build_from_hash(attributes)
|
203
|
+
return nil unless attributes.is_a?(Hash)
|
204
|
+
attributes = attributes.transform_keys(&:to_sym)
|
205
|
+
self.class.openapi_types.each_pair do |key, type|
|
206
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
207
|
+
self.send("#{key}=", nil)
|
208
|
+
elsif type =~ /\AArray<(.*)>/i
|
209
|
+
# check to ensure the input is an array given that the attribute
|
210
|
+
# is documented as an array but the input is not
|
211
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
212
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
213
|
+
end
|
214
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
215
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
self
|
220
|
+
end
|
221
|
+
|
222
|
+
# Deserializes the data based on type
|
223
|
+
# @param string type Data type
|
224
|
+
# @param string value Value to be deserialized
|
225
|
+
# @return [Object] Deserialized data
|
226
|
+
def _deserialize(type, value)
|
227
|
+
case type.to_sym
|
228
|
+
when :Time
|
229
|
+
Time.parse(value)
|
230
|
+
when :Date
|
231
|
+
Date.parse(value)
|
232
|
+
when :String
|
233
|
+
value.to_s
|
234
|
+
when :Integer
|
235
|
+
value.to_i
|
236
|
+
when :Float
|
237
|
+
value.to_f
|
238
|
+
when :Boolean
|
239
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
240
|
+
true
|
241
|
+
else
|
242
|
+
false
|
243
|
+
end
|
244
|
+
when :Object
|
245
|
+
# generic object (usually a Hash), return directly
|
246
|
+
value
|
247
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
248
|
+
inner_type = Regexp.last_match[:inner_type]
|
249
|
+
value.map { |v| _deserialize(inner_type, v) }
|
250
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
251
|
+
k_type = Regexp.last_match[:k_type]
|
252
|
+
v_type = Regexp.last_match[:v_type]
|
253
|
+
{}.tap do |hash|
|
254
|
+
value.each do |k, v|
|
255
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
else # model
|
259
|
+
# models (e.g. Pet) or oneOf
|
260
|
+
klass = UltracartClient.const_get(type)
|
261
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the string representation of the object
|
266
|
+
# @return [String] String presentation of the object
|
267
|
+
def to_s
|
268
|
+
to_hash.to_s
|
269
|
+
end
|
270
|
+
|
271
|
+
# to_body is an alias to to_hash (backward compatibility)
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
273
|
+
def to_body
|
274
|
+
to_hash
|
275
|
+
end
|
276
|
+
|
277
|
+
# Returns the object in the form of hash
|
278
|
+
# @return [Hash] Returns the object in the form of hash
|
279
|
+
def to_hash
|
280
|
+
hash = {}
|
281
|
+
self.class.attribute_map.each_pair do |attr, param|
|
282
|
+
value = self.send(attr)
|
283
|
+
if value.nil?
|
284
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
285
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
286
|
+
end
|
287
|
+
|
288
|
+
hash[param] = _to_hash(value)
|
289
|
+
end
|
290
|
+
hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Outputs non-array value in the form of hash
|
294
|
+
# For object, use to_hash. Otherwise, just return the value
|
295
|
+
# @param [Object] value Any valid value
|
296
|
+
# @return [Hash] Returns the value in the form of hash
|
297
|
+
def _to_hash(value)
|
298
|
+
if value.is_a?(Array)
|
299
|
+
value.compact.map { |v| _to_hash(v) }
|
300
|
+
elsif value.is_a?(Hash)
|
301
|
+
{}.tap do |hash|
|
302
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
303
|
+
end
|
304
|
+
elsif value.respond_to? :to_hash
|
305
|
+
value.to_hash
|
306
|
+
else
|
307
|
+
value
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
@@ -0,0 +1,307 @@
|
|
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 ReportFilter
|
18
|
+
# How this filter connects to the data sources and columns
|
19
|
+
attr_accessor :connections
|
20
|
+
|
21
|
+
attr_accessor :name
|
22
|
+
|
23
|
+
# The timezone that the date range is querying on.
|
24
|
+
attr_accessor :timezone
|
25
|
+
|
26
|
+
# Type of filter
|
27
|
+
attr_accessor :type
|
28
|
+
|
29
|
+
# Unique UUID assigned to the filter. Assists when returning values that the filter can use.
|
30
|
+
attr_accessor :uuid
|
31
|
+
|
32
|
+
# The selected values for the filter. When used, some type conversion will need to occur.
|
33
|
+
attr_accessor :values
|
34
|
+
|
35
|
+
class EnumAttributeValidator
|
36
|
+
attr_reader :datatype
|
37
|
+
attr_reader :allowable_values
|
38
|
+
|
39
|
+
def initialize(datatype, allowable_values)
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
41
|
+
case datatype.to_s
|
42
|
+
when /Integer/i
|
43
|
+
value.to_i
|
44
|
+
when /Float/i
|
45
|
+
value.to_f
|
46
|
+
else
|
47
|
+
value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def valid?(value)
|
53
|
+
!value || allowable_values.include?(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
58
|
+
def self.attribute_map
|
59
|
+
{
|
60
|
+
:'connections' => :'connections',
|
61
|
+
:'name' => :'name',
|
62
|
+
:'timezone' => :'timezone',
|
63
|
+
:'type' => :'type',
|
64
|
+
:'uuid' => :'uuid',
|
65
|
+
:'values' => :'values'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Returns all the JSON keys this model knows about
|
70
|
+
def self.acceptable_attributes
|
71
|
+
attribute_map.values
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attribute type mapping.
|
75
|
+
def self.openapi_types
|
76
|
+
{
|
77
|
+
:'connections' => :'Array<ReportFilterConnection>',
|
78
|
+
:'name' => :'String',
|
79
|
+
:'timezone' => :'String',
|
80
|
+
:'type' => :'String',
|
81
|
+
:'uuid' => :'String',
|
82
|
+
:'values' => :'Array<String>'
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# List of attributes with nullable: true
|
87
|
+
def self.openapi_nullable
|
88
|
+
Set.new([
|
89
|
+
])
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
if (!attributes.is_a?(Hash))
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportFilter` initialize method"
|
97
|
+
end
|
98
|
+
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
100
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
101
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
102
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportFilter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
103
|
+
end
|
104
|
+
h[k.to_sym] = v
|
105
|
+
}
|
106
|
+
|
107
|
+
if attributes.key?(:'connections')
|
108
|
+
if (value = attributes[:'connections']).is_a?(Array)
|
109
|
+
self.connections = value
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'name')
|
114
|
+
self.name = attributes[:'name']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'timezone')
|
118
|
+
self.timezone = attributes[:'timezone']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'type')
|
122
|
+
self.type = attributes[:'type']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'uuid')
|
126
|
+
self.uuid = attributes[:'uuid']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'values')
|
130
|
+
if (value = attributes[:'values']).is_a?(Array)
|
131
|
+
self.values = value
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
137
|
+
# @return Array for valid properties with the reasons
|
138
|
+
def list_invalid_properties
|
139
|
+
invalid_properties = Array.new
|
140
|
+
invalid_properties
|
141
|
+
end
|
142
|
+
|
143
|
+
# Check to see if the all the properties in the model are valid
|
144
|
+
# @return true if the model is valid
|
145
|
+
def valid?
|
146
|
+
type_validator = EnumAttributeValidator.new('String', ["date range", "date comparison", "single value", "multiple values"])
|
147
|
+
return false unless type_validator.valid?(@type)
|
148
|
+
true
|
149
|
+
end
|
150
|
+
|
151
|
+
# Custom attribute writer method checking allowed values (enum).
|
152
|
+
# @param [Object] type Object to be assigned
|
153
|
+
def type=(type)
|
154
|
+
validator = EnumAttributeValidator.new('String', ["date range", "date comparison", "single value", "multiple values"])
|
155
|
+
unless validator.valid?(type)
|
156
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
157
|
+
end
|
158
|
+
@type = type
|
159
|
+
end
|
160
|
+
|
161
|
+
# Checks equality by comparing each attribute.
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def ==(o)
|
164
|
+
return true if self.equal?(o)
|
165
|
+
self.class == o.class &&
|
166
|
+
connections == o.connections &&
|
167
|
+
name == o.name &&
|
168
|
+
timezone == o.timezone &&
|
169
|
+
type == o.type &&
|
170
|
+
uuid == o.uuid &&
|
171
|
+
values == o.values
|
172
|
+
end
|
173
|
+
|
174
|
+
# @see the `==` method
|
175
|
+
# @param [Object] Object to be compared
|
176
|
+
def eql?(o)
|
177
|
+
self == o
|
178
|
+
end
|
179
|
+
|
180
|
+
# Calculates hash code according to all attributes.
|
181
|
+
# @return [Integer] Hash code
|
182
|
+
def hash
|
183
|
+
[connections, name, timezone, type, uuid, values].hash
|
184
|
+
end
|
185
|
+
|
186
|
+
# Builds the object from hash
|
187
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
188
|
+
# @return [Object] Returns the model itself
|
189
|
+
def self.build_from_hash(attributes)
|
190
|
+
new.build_from_hash(attributes)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Builds the object from hash
|
194
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
195
|
+
# @return [Object] Returns the model itself
|
196
|
+
def build_from_hash(attributes)
|
197
|
+
return nil unless attributes.is_a?(Hash)
|
198
|
+
attributes = attributes.transform_keys(&:to_sym)
|
199
|
+
self.class.openapi_types.each_pair do |key, type|
|
200
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
201
|
+
self.send("#{key}=", nil)
|
202
|
+
elsif type =~ /\AArray<(.*)>/i
|
203
|
+
# check to ensure the input is an array given that the attribute
|
204
|
+
# is documented as an array but the input is not
|
205
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
206
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
207
|
+
end
|
208
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
209
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
self
|
214
|
+
end
|
215
|
+
|
216
|
+
# Deserializes the data based on type
|
217
|
+
# @param string type Data type
|
218
|
+
# @param string value Value to be deserialized
|
219
|
+
# @return [Object] Deserialized data
|
220
|
+
def _deserialize(type, value)
|
221
|
+
case type.to_sym
|
222
|
+
when :Time
|
223
|
+
Time.parse(value)
|
224
|
+
when :Date
|
225
|
+
Date.parse(value)
|
226
|
+
when :String
|
227
|
+
value.to_s
|
228
|
+
when :Integer
|
229
|
+
value.to_i
|
230
|
+
when :Float
|
231
|
+
value.to_f
|
232
|
+
when :Boolean
|
233
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
234
|
+
true
|
235
|
+
else
|
236
|
+
false
|
237
|
+
end
|
238
|
+
when :Object
|
239
|
+
# generic object (usually a Hash), return directly
|
240
|
+
value
|
241
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
242
|
+
inner_type = Regexp.last_match[:inner_type]
|
243
|
+
value.map { |v| _deserialize(inner_type, v) }
|
244
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
245
|
+
k_type = Regexp.last_match[:k_type]
|
246
|
+
v_type = Regexp.last_match[:v_type]
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each do |k, v|
|
249
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
else # model
|
253
|
+
# models (e.g. Pet) or oneOf
|
254
|
+
klass = UltracartClient.const_get(type)
|
255
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Returns the string representation of the object
|
260
|
+
# @return [String] String presentation of the object
|
261
|
+
def to_s
|
262
|
+
to_hash.to_s
|
263
|
+
end
|
264
|
+
|
265
|
+
# to_body is an alias to to_hash (backward compatibility)
|
266
|
+
# @return [Hash] Returns the object in the form of hash
|
267
|
+
def to_body
|
268
|
+
to_hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Returns the object in the form of hash
|
272
|
+
# @return [Hash] Returns the object in the form of hash
|
273
|
+
def to_hash
|
274
|
+
hash = {}
|
275
|
+
self.class.attribute_map.each_pair do |attr, param|
|
276
|
+
value = self.send(attr)
|
277
|
+
if value.nil?
|
278
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
279
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
280
|
+
end
|
281
|
+
|
282
|
+
hash[param] = _to_hash(value)
|
283
|
+
end
|
284
|
+
hash
|
285
|
+
end
|
286
|
+
|
287
|
+
# Outputs non-array value in the form of hash
|
288
|
+
# For object, use to_hash. Otherwise, just return the value
|
289
|
+
# @param [Object] value Any valid value
|
290
|
+
# @return [Hash] Returns the value in the form of hash
|
291
|
+
def _to_hash(value)
|
292
|
+
if value.is_a?(Array)
|
293
|
+
value.compact.map { |v| _to_hash(v) }
|
294
|
+
elsif value.is_a?(Hash)
|
295
|
+
{}.tap do |hash|
|
296
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
297
|
+
end
|
298
|
+
elsif value.respond_to? :to_hash
|
299
|
+
value.to_hash
|
300
|
+
else
|
301
|
+
value
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|