ultracart_api 4.0.141 → 4.0.142

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