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,263 @@
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 ReportDataSetSchema
18
+ attr_accessor :name
19
+
20
+ # Type of the column.
21
+ attr_accessor :type
22
+
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'name' => :'name',
49
+ :'type' => :'type'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'name' => :'String',
62
+ :'type' => :'String'
63
+ }
64
+ end
65
+
66
+ # List of attributes with nullable: true
67
+ def self.openapi_nullable
68
+ Set.new([
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportDataSetSchema` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h|
81
+ if (!self.class.attribute_map.key?(k.to_sym))
82
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportDataSetSchema`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
83
+ end
84
+ h[k.to_sym] = v
85
+ }
86
+
87
+ if attributes.key?(:'name')
88
+ self.name = attributes[:'name']
89
+ end
90
+
91
+ if attributes.key?(:'type')
92
+ self.type = attributes[:'type']
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ invalid_properties = Array.new
100
+ invalid_properties
101
+ end
102
+
103
+ # Check to see if the all the properties in the model are valid
104
+ # @return true if the model is valid
105
+ def valid?
106
+ type_validator = EnumAttributeValidator.new('String', ["BIGNUMERIC", "BOOL", "DATE", "DATETIME", "FLOAT64", "INT64", "JSON", "NUMERIC", "STRING", "TIME", "TIMESTAMP"])
107
+ return false unless type_validator.valid?(@type)
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method checking allowed values (enum).
112
+ # @param [Object] type Object to be assigned
113
+ def type=(type)
114
+ validator = EnumAttributeValidator.new('String', ["BIGNUMERIC", "BOOL", "DATE", "DATETIME", "FLOAT64", "INT64", "JSON", "NUMERIC", "STRING", "TIME", "TIMESTAMP"])
115
+ unless validator.valid?(type)
116
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
117
+ end
118
+ @type = type
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ name == o.name &&
127
+ type == o.type
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [name, type].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ new.build_from_hash(attributes)
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def build_from_hash(attributes)
153
+ return nil unless attributes.is_a?(Hash)
154
+ attributes = attributes.transform_keys(&:to_sym)
155
+ self.class.openapi_types.each_pair do |key, type|
156
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
157
+ self.send("#{key}=", nil)
158
+ elsif type =~ /\AArray<(.*)>/i
159
+ # check to ensure the input is an array given that the attribute
160
+ # is documented as an array but the input is not
161
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
162
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ end
167
+ end
168
+
169
+ self
170
+ end
171
+
172
+ # Deserializes the data based on type
173
+ # @param string type Data type
174
+ # @param string value Value to be deserialized
175
+ # @return [Object] Deserialized data
176
+ def _deserialize(type, value)
177
+ case type.to_sym
178
+ when :Time
179
+ Time.parse(value)
180
+ when :Date
181
+ Date.parse(value)
182
+ when :String
183
+ value.to_s
184
+ when :Integer
185
+ value.to_i
186
+ when :Float
187
+ value.to_f
188
+ when :Boolean
189
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
+ true
191
+ else
192
+ false
193
+ end
194
+ when :Object
195
+ # generic object (usually a Hash), return directly
196
+ value
197
+ when /\AArray<(?<inner_type>.+)>\z/
198
+ inner_type = Regexp.last_match[:inner_type]
199
+ value.map { |v| _deserialize(inner_type, v) }
200
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
+ k_type = Regexp.last_match[:k_type]
202
+ v_type = Regexp.last_match[:v_type]
203
+ {}.tap do |hash|
204
+ value.each do |k, v|
205
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
+ end
207
+ end
208
+ else # model
209
+ # models (e.g. Pet) or oneOf
210
+ klass = UltracartClient.const_get(type)
211
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ if value.nil?
234
+ is_nullable = self.class.openapi_nullable.include?(attr)
235
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
+ end
237
+
238
+ hash[param] = _to_hash(value)
239
+ end
240
+ hash
241
+ end
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+
261
+ end
262
+
263
+ end
@@ -0,0 +1,267 @@
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 ReportDataSource
18
+ attr_accessor :name
19
+
20
+ attr_accessor :partition_date_column
21
+
22
+ attr_accessor :partition_date_safety_days
23
+
24
+ # The partition date strategy, defaults to weekly sunday
25
+ attr_accessor :partition_date_strategy
26
+
27
+ attr_accessor :schema
28
+
29
+ attr_accessor :sql
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'name' => :'name',
35
+ :'partition_date_column' => :'partition_date_column',
36
+ :'partition_date_safety_days' => :'partition_date_safety_days',
37
+ :'partition_date_strategy' => :'partition_date_strategy',
38
+ :'schema' => :'schema',
39
+ :'sql' => :'sql'
40
+ }
41
+ end
42
+
43
+ # Returns all the JSON keys this model knows about
44
+ def self.acceptable_attributes
45
+ attribute_map.values
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.openapi_types
50
+ {
51
+ :'name' => :'String',
52
+ :'partition_date_column' => :'String',
53
+ :'partition_date_safety_days' => :'Integer',
54
+ :'partition_date_strategy' => :'String',
55
+ :'schema' => :'Array<ReportDataSourceSchema>',
56
+ :'sql' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ReportDataSource` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ReportDataSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'name')
82
+ self.name = attributes[:'name']
83
+ end
84
+
85
+ if attributes.key?(:'partition_date_column')
86
+ self.partition_date_column = attributes[:'partition_date_column']
87
+ end
88
+
89
+ if attributes.key?(:'partition_date_safety_days')
90
+ self.partition_date_safety_days = attributes[:'partition_date_safety_days']
91
+ end
92
+
93
+ if attributes.key?(:'partition_date_strategy')
94
+ self.partition_date_strategy = attributes[:'partition_date_strategy']
95
+ end
96
+
97
+ if attributes.key?(:'schema')
98
+ if (value = attributes[:'schema']).is_a?(Array)
99
+ self.schema = value
100
+ end
101
+ end
102
+
103
+ if attributes.key?(:'sql')
104
+ self.sql = attributes[:'sql']
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ invalid_properties = Array.new
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ name == o.name &&
127
+ partition_date_column == o.partition_date_column &&
128
+ partition_date_safety_days == o.partition_date_safety_days &&
129
+ partition_date_strategy == o.partition_date_strategy &&
130
+ schema == o.schema &&
131
+ sql == o.sql
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [name, partition_date_column, partition_date_safety_days, partition_date_strategy, schema, sql].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ attributes = attributes.transform_keys(&:to_sym)
159
+ self.class.openapi_types.each_pair do |key, type|
160
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
161
+ self.send("#{key}=", nil)
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
166
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
167
+ end
168
+ elsif !attributes[self.class.attribute_map[key]].nil?
169
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
170
+ end
171
+ end
172
+
173
+ self
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def _deserialize(type, value)
181
+ case type.to_sym
182
+ when :Time
183
+ Time.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ # models (e.g. Pet) or oneOf
214
+ klass = UltracartClient.const_get(type)
215
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end