ultracart_api 3.10.124 → 3.10.126

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