ultracart_api 3.10.124 → 3.10.125

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 +461 -0
  4. data/docs/Report.md +17 -0
  5. data/docs/ReportAuth.md +11 -0
  6. data/docs/ReportAuthResponse.md +12 -0
  7. data/docs/ReportDataSet.md +22 -0
  8. data/docs/ReportDataSetColumn.md +8 -0
  9. data/docs/ReportDataSetPage.md +17 -0
  10. data/docs/ReportDataSetPageResponse.md +12 -0
  11. data/docs/ReportDataSetQuery.md +19 -0
  12. data/docs/ReportDataSetResponse.md +12 -0
  13. data/docs/ReportDataSetRow.md +8 -0
  14. data/docs/ReportDataSetSchema.md +9 -0
  15. data/docs/ReportDataSource.md +13 -0
  16. data/docs/ReportDataSourceSchema.md +10 -0
  17. data/docs/ReportExecuteQueriesRequest.md +14 -0
  18. data/docs/ReportFilter.md +13 -0
  19. data/docs/ReportFilterConnection.md +9 -0
  20. data/docs/ReportPage.md +11 -0
  21. data/docs/ReportPageVisualization.md +16 -0
  22. data/docs/ReportPageVisualizationDimension.md +14 -0
  23. data/docs/ReportPageVisualizationMetric.md +11 -0
  24. data/docs/ReportResponse.md +12 -0
  25. data/docs/ReportsResponse.md +12 -0
  26. data/lib/ultracart_api/api/datawarehouse_api.rb +529 -0
  27. data/lib/ultracart_api/models/report.rb +307 -0
  28. data/lib/ultracart_api/models/report_auth.rb +212 -0
  29. data/lib/ultracart_api/models/report_auth_response.rb +221 -0
  30. data/lib/ultracart_api/models/report_data_set.rb +362 -0
  31. data/lib/ultracart_api/models/report_data_set_column.rb +184 -0
  32. data/lib/ultracart_api/models/report_data_set_page.rb +273 -0
  33. data/lib/ultracart_api/models/report_data_set_page_response.rb +221 -0
  34. data/lib/ultracart_api/models/report_data_set_query.rb +330 -0
  35. data/lib/ultracart_api/models/report_data_set_response.rb +221 -0
  36. data/lib/ultracart_api/models/report_data_set_row.rb +186 -0
  37. data/lib/ultracart_api/models/report_data_set_schema.rb +228 -0
  38. data/lib/ultracart_api/models/report_data_source.rb +232 -0
  39. data/lib/ultracart_api/models/report_data_source_schema.rb +238 -0
  40. data/lib/ultracart_api/models/report_execute_queries_request.rb +278 -0
  41. data/lib/ultracart_api/models/report_filter.rb +272 -0
  42. data/lib/ultracart_api/models/report_filter_connection.rb +193 -0
  43. data/lib/ultracart_api/models/report_page.rb +216 -0
  44. data/lib/ultracart_api/models/report_page_visualization.rb +299 -0
  45. data/lib/ultracart_api/models/report_page_visualization_dimension.rb +244 -0
  46. data/lib/ultracart_api/models/report_page_visualization_metric.rb +248 -0
  47. data/lib/ultracart_api/models/report_response.rb +221 -0
  48. data/lib/ultracart_api/models/reports_response.rb +223 -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,238 @@
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 ReportDataSourceSchema
17
+ # Whether or not this column can be used as a dimension within a visualization
18
+ attr_accessor :dimension
19
+
20
+ attr_accessor :name
21
+
22
+ # Type of the column. Only supporting the allowed values. Any other types will be ignored.
23
+ attr_accessor :type
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'dimension' => :'dimension',
51
+ :'name' => :'name',
52
+ :'type' => :'type'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'dimension' => :'BOOLEAN',
60
+ :'name' => :'String',
61
+ :'type' => :'String'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'dimension')
74
+ self.dimension = attributes[:'dimension']
75
+ end
76
+
77
+ if attributes.has_key?(:'name')
78
+ self.name = attributes[:'name']
79
+ end
80
+
81
+ if attributes.has_key?(:'type')
82
+ self.type = attributes[:'type']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ type_validator = EnumAttributeValidator.new('String', ['BIGNUMERIC', 'BOOL', 'DATE', 'DATETIME', 'FLOAT64', 'INT64', 'JSON', 'NUMERIC', 'STRING', 'TIME', 'TIMESTAMP'])
97
+ return false unless type_validator.valid?(@type)
98
+ true
99
+ end
100
+
101
+ # Custom attribute writer method checking allowed values (enum).
102
+ # @param [Object] type Object to be assigned
103
+ def type=(type)
104
+ validator = EnumAttributeValidator.new('String', ['BIGNUMERIC', 'BOOL', 'DATE', 'DATETIME', 'FLOAT64', 'INT64', 'JSON', 'NUMERIC', 'STRING', 'TIME', 'TIMESTAMP'])
105
+ unless validator.valid?(type)
106
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
107
+ end
108
+ @type = type
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ dimension == o.dimension &&
117
+ name == o.name &&
118
+ type == o.type
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Fixnum] Hash code
129
+ def hash
130
+ [dimension, name, type].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.swagger_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ temp_model = UltracartClient.const_get(type).new
191
+ temp_model.build_from_hash(value)
192
+ end
193
+ end
194
+
195
+ # Returns the string representation of the object
196
+ # @return [String] String presentation of the object
197
+ def to_s
198
+ to_hash.to_s
199
+ end
200
+
201
+ # to_body is an alias to to_hash (backward compatibility)
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_body
204
+ to_hash
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = self.send(attr)
213
+ next if value.nil?
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+ end
@@ -0,0 +1,278 @@
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 ReportExecuteQueriesRequest
17
+ # Unique UUID assigned to this client during the auth. This will be used to locate the websocket connect id.
18
+ attr_accessor :client_uuid
19
+
20
+ # The websocket connection id that should receive back notices of query completion.
21
+ attr_accessor :connection_id
22
+
23
+ attr_accessor :default_dataset_id
24
+
25
+ attr_accessor :default_project_id
26
+
27
+ attr_accessor :merchant_id
28
+
29
+ # An array of queries that we want the lambda function to execute.
30
+ attr_accessor :queries
31
+
32
+ # Security level to execute report under
33
+ attr_accessor :security_level
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
+ :'client_uuid' => :'client_uuid',
61
+ :'connection_id' => :'connection_id',
62
+ :'default_dataset_id' => :'default_dataset_id',
63
+ :'default_project_id' => :'default_project_id',
64
+ :'merchant_id' => :'merchant_id',
65
+ :'queries' => :'queries',
66
+ :'security_level' => :'security_level'
67
+ }
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.swagger_types
72
+ {
73
+ :'client_uuid' => :'String',
74
+ :'connection_id' => :'String',
75
+ :'default_dataset_id' => :'String',
76
+ :'default_project_id' => :'String',
77
+ :'merchant_id' => :'String',
78
+ :'queries' => :'Array<ReportDataSetQuery>',
79
+ :'security_level' => :'String'
80
+ }
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ return unless attributes.is_a?(Hash)
87
+
88
+ # convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
90
+
91
+ if attributes.has_key?(:'client_uuid')
92
+ self.client_uuid = attributes[:'client_uuid']
93
+ end
94
+
95
+ if attributes.has_key?(:'connection_id')
96
+ self.connection_id = attributes[:'connection_id']
97
+ end
98
+
99
+ if attributes.has_key?(:'default_dataset_id')
100
+ self.default_dataset_id = attributes[:'default_dataset_id']
101
+ end
102
+
103
+ if attributes.has_key?(:'default_project_id')
104
+ self.default_project_id = attributes[:'default_project_id']
105
+ end
106
+
107
+ if attributes.has_key?(:'merchant_id')
108
+ self.merchant_id = attributes[:'merchant_id']
109
+ end
110
+
111
+ if attributes.has_key?(:'queries')
112
+ if (value = attributes[:'queries']).is_a?(Array)
113
+ self.queries = value
114
+ end
115
+ end
116
+
117
+ if attributes.has_key?(:'security_level')
118
+ self.security_level = attributes[:'security_level']
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ invalid_properties = Array.new
126
+ invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ security_level_validator = EnumAttributeValidator.new('String', ['standard', 'low', 'medium', 'high'])
133
+ return false unless security_level_validator.valid?(@security_level)
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method checking allowed values (enum).
138
+ # @param [Object] security_level Object to be assigned
139
+ def security_level=(security_level)
140
+ validator = EnumAttributeValidator.new('String', ['standard', 'low', 'medium', 'high'])
141
+ unless validator.valid?(security_level)
142
+ fail ArgumentError, 'invalid value for "security_level", must be one of #{validator.allowable_values}.'
143
+ end
144
+ @security_level = security_level
145
+ end
146
+
147
+ # Checks equality by comparing each attribute.
148
+ # @param [Object] Object to be compared
149
+ def ==(o)
150
+ return true if self.equal?(o)
151
+ self.class == o.class &&
152
+ client_uuid == o.client_uuid &&
153
+ connection_id == o.connection_id &&
154
+ default_dataset_id == o.default_dataset_id &&
155
+ default_project_id == o.default_project_id &&
156
+ merchant_id == o.merchant_id &&
157
+ queries == o.queries &&
158
+ security_level == o.security_level
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Fixnum] Hash code
169
+ def hash
170
+ [client_uuid, connection_id, default_dataset_id, default_project_id, merchant_id, queries, security_level].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+ self.class.swagger_types.each_pair do |key, type|
179
+ if type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :DateTime
200
+ DateTime.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :BOOLEAN
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ temp_model = UltracartClient.const_get(type).new
231
+ temp_model.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
+ next if value.nil?
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
+ end