postfinancecheckout-ruby-sdk 3.1.4 → 3.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/lib/postfinancecheckout-ruby-sdk/api/analytics_query_service_api.rb +381 -0
  4. data/lib/postfinancecheckout-ruby-sdk/models/analytics_query.rb +272 -0
  5. data/lib/postfinancecheckout-ruby-sdk/models/analytics_query_execution.rb +293 -0
  6. data/lib/postfinancecheckout-ruby-sdk/models/analytics_query_execution_state.rb +37 -0
  7. data/lib/postfinancecheckout-ruby-sdk/models/analytics_query_result_batch.rb +225 -0
  8. data/lib/postfinancecheckout-ruby-sdk/models/analytics_schema_column.rb +263 -0
  9. data/lib/postfinancecheckout-ruby-sdk/models/analytics_schema_table.rb +215 -0
  10. data/lib/postfinancecheckout-ruby-sdk/models/rendered_document.rb +17 -5
  11. data/lib/postfinancecheckout-ruby-sdk/models/rendered_terminal_receipt.rb +17 -5
  12. data/lib/postfinancecheckout-ruby-sdk/models/rendered_terminal_transaction_summary.rb +17 -5
  13. data/lib/postfinancecheckout-ruby-sdk/version.rb +1 -1
  14. data/lib/postfinancecheckout-ruby-sdk.rb +7 -0
  15. data/vendor/bundle/ruby/2.4.0/cache/addressable-2.8.1.gem +0 -0
  16. data/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/ffi-1.15.5/gem_make.out +2 -2
  17. data/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/json-2.6.2/gem_make.out +1 -1
  18. data/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0/json-2.6.2/mkmf.log +1 -1
  19. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/CHANGELOG.md +16 -0
  20. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/Gemfile +4 -2
  21. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/LICENSE.txt +0 -0
  22. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/README.md +0 -0
  23. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/Rakefile +0 -0
  24. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/data/unicode.data +0 -0
  25. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/idna/native.rb +0 -1
  26. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/idna/pure.rb +0 -1
  27. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/idna.rb +0 -1
  28. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/template.rb +3 -4
  29. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/uri.rb +57 -53
  30. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable/version.rb +1 -2
  31. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/lib/addressable.rb +0 -0
  32. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/addressable/idna_spec.rb +0 -1
  33. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/addressable/net_http_compat_spec.rb +0 -1
  34. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/addressable/security_spec.rb +0 -1
  35. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/addressable/template_spec.rb +9 -1
  36. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/addressable/uri_spec.rb +81 -1
  37. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/spec/spec_helper.rb +0 -0
  38. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/clobber.rake +0 -0
  39. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/gem.rake +5 -2
  40. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/git.rake +0 -0
  41. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/metrics.rake +0 -0
  42. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/profile.rake +0 -0
  43. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/rspec.rake +0 -0
  44. data/vendor/bundle/ruby/2.4.0/gems/{addressable-2.8.0 → addressable-2.8.1}/tasks/yard.rake +0 -0
  45. data/vendor/bundle/ruby/2.4.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +3 -3
  46. data/vendor/bundle/ruby/2.4.0/gems/json-2.6.2/ext/json/Makefile +2 -2
  47. data/vendor/bundle/ruby/2.4.0/gems/json-2.6.2/ext/json/ext/generator/Makefile +2 -2
  48. data/vendor/bundle/ruby/2.4.0/gems/json-2.6.2/ext/json/ext/parser/Makefile +2 -2
  49. data/vendor/bundle/ruby/2.4.0/specifications/{addressable-2.8.0.gemspec → addressable-2.8.1.gemspec} +8 -7
  50. metadata +37 -31
  51. data/vendor/bundle/ruby/2.4.0/cache/addressable-2.8.0.gem +0 -0
  52. data/vendor/bundle/ruby/2.4.0/gems/addressable-2.8.0/addressable.gemspec +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50b4017d8354bbbb5950cfd5904f01d5ae4a6fc2
4
- data.tar.gz: 81a95ec22f1f361c5a2a001114dac00c77a0acf3
3
+ metadata.gz: ce058a5c6ddfdfc656822dede786073211a0b7a9
4
+ data.tar.gz: a4b0ab764fca6ebcbfc4e21496884e5c69b30d5c
5
5
  SHA512:
6
- metadata.gz: 73753905830f923a2322cccada648bf36b932f79d52f323ab0b1fe32ff296cbad307b0c0636b8fc05a160eb8b41b32c434f604132ad1523a3edcfade8e8fa0ce
7
- data.tar.gz: 22735830e6de0ce1dcc5dc1486959f6c2f43751f442ac14640469edbd23f30714823b3f22f61f2e6373e6a11e4a08753f0896bbd858dff464562eb680099e1d3
6
+ metadata.gz: 279f8f01b37d57ddffd60ebec243c23c96591927ccd7009a32aae090dfc86c5cea1f45f8e66906ec0bddbb73128a33a96b7f989cd6959248902eca8127b51838
7
+ data.tar.gz: 7f9a4bbd8a33349a81aa606cf7841952d39839ebcab3fbd1519fc8e8a8e5850e4991f93a8bdfc1c606692bc470a6e0498dcd431747352a04dcbac0817d8116fd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- postfinancecheckout-ruby-sdk (3.1.4)
4
+ postfinancecheckout-ruby-sdk (3.1.5)
5
5
  addressable (~> 2.3, >= 2.3.0)
6
6
  json (~> 2.3, >= 2.3.0)
7
7
  typhoeus (~> 1.0, >= 1.0.1)
@@ -9,8 +9,8 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.8.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ addressable (2.8.1)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
14
  ethon (0.15.0)
15
15
  ffi (>= 1.15.0)
16
16
  ffi (1.15.5)
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  test-unit (~> 3.2.5)
33
33
 
34
34
  BUNDLED WITH
35
- 2.3.19
35
+ 2.3.22
@@ -0,0 +1,381 @@
1
+ =begin
2
+ The PostFinance Checkout API allows an easy interaction with the PostFinance Checkout web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require "uri"
19
+
20
+ module PostFinanceCheckout
21
+ class AnalyticsQueryService
22
+ attr_accessor :api_client
23
+
24
+ def initialize(api_client = ApiClient.default)
25
+ @api_client = api_client
26
+ end
27
+
28
+ # Cancel Execution
29
+ # Cancels the specified query execution.
30
+ # @param id The ID of the query execution to cancel.
31
+ # @param [Hash] opts the optional parameters
32
+ # @return [nil]
33
+ def cancel_execution(id, opts = {})
34
+ cancel_execution_with_http_info(id, opts)
35
+ return nil
36
+ end
37
+
38
+ # Cancel Execution
39
+ # Cancels the specified query execution.
40
+ # @param id The ID of the query execution to cancel.
41
+ # @param [Hash] opts the optional parameters
42
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
43
+ def cancel_execution_with_http_info(id, opts = {})
44
+ if @api_client.config.debugging
45
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.cancel_execution ..."
46
+ end
47
+ # verify the required parameter 'id' is set
48
+ fail ArgumentError, "Missing the required parameter 'id' when calling AnalyticsQueryService.cancel_execution" if id.nil?
49
+ # resource path
50
+ local_var_path = "/analytics-query/cancel-execution".sub('{format}','json')
51
+
52
+ # query parameters
53
+ query_params = {}
54
+ query_params[:'id'] = id
55
+
56
+ # header parameters
57
+ header_params = {}
58
+
59
+ # HTTP header 'Accept' (if needed)
60
+ local_header_accept = ['application/json;charset=utf-8']
61
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
62
+
63
+ # HTTP header 'Content-Type'
64
+ local_header_content_type = ['*/*']
65
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
66
+
67
+ # form parameters
68
+ form_params = {}
69
+
70
+ # http body (model)
71
+ post_body = nil
72
+ auth_names = []
73
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
74
+ :header_params => header_params,
75
+ :query_params => query_params,
76
+ :form_params => form_params,
77
+ :body => post_body,
78
+ :auth_names => auth_names)
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#cancel_execution\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+
85
+ # Fetch Result
86
+ # Fetches one batch of the result of a query execution.
87
+ # @param id The ID of the query execution for which to fetch the result.
88
+ # @param [Hash] opts the optional parameters
89
+ # @option opts [Integer] :timeout The maximal time in seconds to wait for the result if it is not yet available. Use 0 (the default) to return immediately without waiting.
90
+ # @option opts [Integer] :max_rows The maximum number of rows to return per batch. (Between 1 and 999. The default is 999.)
91
+ # @option opts [String] :next_token The next-token of the preceding batch to get the next result batch or null to get the first result batch.
92
+ # @return [AnalyticsQueryResultBatch]
93
+ def fetch_result(id, opts = {})
94
+ data, _status_code, _headers = fetch_result_with_http_info(id, opts)
95
+ return data
96
+ end
97
+
98
+ # Fetch Result
99
+ # Fetches one batch of the result of a query execution.
100
+ # @param id The ID of the query execution for which to fetch the result.
101
+ # @param [Hash] opts the optional parameters
102
+ # @option opts [Integer] :timeout The maximal time in seconds to wait for the result if it is not yet available. Use 0 (the default) to return immediately without waiting.
103
+ # @option opts [Integer] :max_rows The maximum number of rows to return per batch. (Between 1 and 999. The default is 999.)
104
+ # @option opts [String] :next_token The next-token of the preceding batch to get the next result batch or null to get the first result batch.
105
+ # @return [Array<(AnalyticsQueryResultBatch, Fixnum, Hash)>] AnalyticsQueryResultBatch data, response status code and response headers
106
+ def fetch_result_with_http_info(id, opts = {})
107
+ if @api_client.config.debugging
108
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.fetch_result ..."
109
+ end
110
+ # verify the required parameter 'id' is set
111
+ fail ArgumentError, "Missing the required parameter 'id' when calling AnalyticsQueryService.fetch_result" if id.nil?
112
+ # resource path
113
+ local_var_path = "/analytics-query/fetch-result".sub('{format}','json')
114
+
115
+ # query parameters
116
+ query_params = {}
117
+ query_params[:'id'] = id
118
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
119
+ query_params[:'maxRows'] = opts[:'max_rows'] if !opts[:'max_rows'].nil?
120
+ query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
121
+
122
+ # header parameters
123
+ header_params = {}
124
+
125
+ # HTTP header 'Accept' (if needed)
126
+ local_header_accept = ['application/json;charset=utf-8']
127
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
128
+
129
+ # HTTP header 'Content-Type'
130
+ local_header_content_type = ['*/*']
131
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
132
+
133
+ # form parameters
134
+ form_params = {}
135
+
136
+ # http body (model)
137
+ post_body = nil
138
+ auth_names = []
139
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
140
+ :header_params => header_params,
141
+ :query_params => query_params,
142
+ :form_params => form_params,
143
+ :body => post_body,
144
+ :auth_names => auth_names,
145
+ :return_type => 'AnalyticsQueryResultBatch')
146
+ if @api_client.config.debugging
147
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#fetch_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
148
+ end
149
+ return data, status_code, headers
150
+ end
151
+
152
+ # Generate Download URL
153
+ # Generate a URL from which the results of a query execution can be downloaded in CSV format.
154
+ # @param id The ID of the query execution for which to generate the download URL.
155
+ # @param [Hash] opts the optional parameters
156
+ # @option opts [Integer] :timeout The maximal time in seconds to wait for the result if it is not yet available. Use 0 (the default) to return immediately without waiting.
157
+ # @return [String]
158
+ def generate_download_url(id, opts = {})
159
+ data, _status_code, _headers = generate_download_url_with_http_info(id, opts)
160
+ return data
161
+ end
162
+
163
+ # Generate Download URL
164
+ # Generate a URL from which the results of a query execution can be downloaded in CSV format.
165
+ # @param id The ID of the query execution for which to generate the download URL.
166
+ # @param [Hash] opts the optional parameters
167
+ # @option opts [Integer] :timeout The maximal time in seconds to wait for the result if it is not yet available. Use 0 (the default) to return immediately without waiting.
168
+ # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
169
+ def generate_download_url_with_http_info(id, opts = {})
170
+ if @api_client.config.debugging
171
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.generate_download_url ..."
172
+ end
173
+ # verify the required parameter 'id' is set
174
+ fail ArgumentError, "Missing the required parameter 'id' when calling AnalyticsQueryService.generate_download_url" if id.nil?
175
+ # resource path
176
+ local_var_path = "/analytics-query/generate-download-url".sub('{format}','json')
177
+
178
+ # query parameters
179
+ query_params = {}
180
+ query_params[:'id'] = id
181
+ query_params[:'timeout'] = opts[:'timeout'] if !opts[:'timeout'].nil?
182
+
183
+ # header parameters
184
+ header_params = {}
185
+
186
+ # HTTP header 'Accept' (if needed)
187
+ local_header_accept = ['text/plain']
188
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
189
+
190
+ # HTTP header 'Content-Type'
191
+ local_header_content_type = ['*/*']
192
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
193
+
194
+ # form parameters
195
+ form_params = {}
196
+
197
+ # http body (model)
198
+ post_body = nil
199
+ auth_names = []
200
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
201
+ :header_params => header_params,
202
+ :query_params => query_params,
203
+ :form_params => form_params,
204
+ :body => post_body,
205
+ :auth_names => auth_names,
206
+ :return_type => 'String')
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#generate_download_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
209
+ end
210
+ return data, status_code, headers
211
+ end
212
+
213
+ # Get Schemas
214
+ # Get the schemas describing the available tables and their columns.
215
+ # @param [Hash] opts the optional parameters
216
+ # @return [Array<AnalyticsSchemaTable>]
217
+ def schema(opts = {})
218
+ data, _status_code, _headers = schema_with_http_info(opts)
219
+ return data
220
+ end
221
+
222
+ # Get Schemas
223
+ # Get the schemas describing the available tables and their columns.
224
+ # @param [Hash] opts the optional parameters
225
+ # @return [Array<(Array<AnalyticsSchemaTable>, Fixnum, Hash)>] Array<AnalyticsSchemaTable> data, response status code and response headers
226
+ def schema_with_http_info(opts = {})
227
+ if @api_client.config.debugging
228
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.schema ..."
229
+ end
230
+ # resource path
231
+ local_var_path = "/analytics-query/schema".sub('{format}','json')
232
+
233
+ # query parameters
234
+ query_params = {}
235
+
236
+ # header parameters
237
+ header_params = {}
238
+
239
+ # HTTP header 'Accept' (if needed)
240
+ local_header_accept = ['application/json;charset=utf-8']
241
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
242
+
243
+ # HTTP header 'Content-Type'
244
+ local_header_content_type = ['*/*']
245
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
246
+
247
+ # form parameters
248
+ form_params = {}
249
+
250
+ # http body (model)
251
+ post_body = nil
252
+ auth_names = []
253
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
254
+ :header_params => header_params,
255
+ :query_params => query_params,
256
+ :form_params => form_params,
257
+ :body => post_body,
258
+ :auth_names => auth_names,
259
+ :return_type => 'Array<AnalyticsSchemaTable>')
260
+ if @api_client.config.debugging
261
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
262
+ end
263
+ return data, status_code, headers
264
+ end
265
+
266
+ # Execution Status
267
+ # Returns the current status of a query execution.
268
+ # @param id The ID of the query execution for which to get the status.
269
+ # @param [Hash] opts the optional parameters
270
+ # @return [AnalyticsQueryExecution]
271
+ def status(id, opts = {})
272
+ data, _status_code, _headers = status_with_http_info(id, opts)
273
+ return data
274
+ end
275
+
276
+ # Execution Status
277
+ # Returns the current status of a query execution.
278
+ # @param id The ID of the query execution for which to get the status.
279
+ # @param [Hash] opts the optional parameters
280
+ # @return [Array<(AnalyticsQueryExecution, Fixnum, Hash)>] AnalyticsQueryExecution data, response status code and response headers
281
+ def status_with_http_info(id, opts = {})
282
+ if @api_client.config.debugging
283
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.status ..."
284
+ end
285
+ # verify the required parameter 'id' is set
286
+ fail ArgumentError, "Missing the required parameter 'id' when calling AnalyticsQueryService.status" if id.nil?
287
+ # resource path
288
+ local_var_path = "/analytics-query/status".sub('{format}','json')
289
+
290
+ # query parameters
291
+ query_params = {}
292
+ query_params[:'id'] = id
293
+
294
+ # header parameters
295
+ header_params = {}
296
+
297
+ # HTTP header 'Accept' (if needed)
298
+ local_header_accept = ['application/json;charset=utf-8']
299
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
300
+
301
+ # HTTP header 'Content-Type'
302
+ local_header_content_type = ['*/*']
303
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
304
+
305
+ # form parameters
306
+ form_params = {}
307
+
308
+ # http body (model)
309
+ post_body = nil
310
+ auth_names = []
311
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
312
+ :header_params => header_params,
313
+ :query_params => query_params,
314
+ :form_params => form_params,
315
+ :body => post_body,
316
+ :auth_names => auth_names,
317
+ :return_type => 'AnalyticsQueryExecution')
318
+ if @api_client.config.debugging
319
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
320
+ end
321
+ return data, status_code, headers
322
+ end
323
+
324
+ # Submit Query
325
+ # Submits a query for execution.
326
+ # @param query The query to submit.
327
+ # @param [Hash] opts the optional parameters
328
+ # @return [AnalyticsQueryExecution]
329
+ def submit_query(query, opts = {})
330
+ data, _status_code, _headers = submit_query_with_http_info(query, opts)
331
+ return data
332
+ end
333
+
334
+ # Submit Query
335
+ # Submits a query for execution.
336
+ # @param query The query to submit.
337
+ # @param [Hash] opts the optional parameters
338
+ # @return [Array<(AnalyticsQueryExecution, Fixnum, Hash)>] AnalyticsQueryExecution data, response status code and response headers
339
+ def submit_query_with_http_info(query, opts = {})
340
+ if @api_client.config.debugging
341
+ @api_client.config.logger.debug "Calling API: AnalyticsQueryService.submit_query ..."
342
+ end
343
+ # verify the required parameter 'query' is set
344
+ fail ArgumentError, "Missing the required parameter 'query' when calling AnalyticsQueryService.submit_query" if query.nil?
345
+ # resource path
346
+ local_var_path = "/analytics-query/submit-query".sub('{format}','json')
347
+
348
+ # query parameters
349
+ query_params = {}
350
+
351
+ # header parameters
352
+ header_params = {}
353
+
354
+ # HTTP header 'Accept' (if needed)
355
+ local_header_accept = ['application/json;charset=utf-8']
356
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
357
+
358
+ # HTTP header 'Content-Type'
359
+ local_header_content_type = ['application/json;charset=utf-8']
360
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
361
+
362
+ # form parameters
363
+ form_params = {}
364
+
365
+ # http body (model)
366
+ post_body = @api_client.object_to_http_body(query)
367
+ auth_names = []
368
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
369
+ :header_params => header_params,
370
+ :query_params => query_params,
371
+ :form_params => form_params,
372
+ :body => post_body,
373
+ :auth_names => auth_names,
374
+ :return_type => 'AnalyticsQueryExecution')
375
+ if @api_client.config.debugging
376
+ @api_client.config.logger.debug "API called: AnalyticsQueryService#submit_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
377
+ end
378
+ return data, status_code, headers
379
+ end
380
+ end
381
+ end
@@ -0,0 +1,272 @@
1
+ =begin
2
+ The PostFinance Checkout API allows an easy interaction with the PostFinance Checkout web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module PostFinanceCheckout
21
+ # Represents a query to be submitted for execution in Analytics.
22
+ class AnalyticsQuery
23
+ # The mandatory ID of an account in which the query shall be executed. Must be a valid account ID greater than 0.
24
+ attr_accessor :account_id
25
+
26
+ # A client generated nonce which uniquely identifies the query to be executed. Subsequent submissions with the same external ID will not re-execute the query but instead return the existing execution with that ID. Either the External ID or a Maximal Cache Age greater than 0 must be specified. If both are specified the External ID will have precedence and the Maximal Cache Age will be ignored.
27
+ attr_accessor :external_id
28
+
29
+ # The maximal age in minutes of cached query executions to return. If an equivalent query execution with the same Query String, Account ID and Spaces parameters not older than the specified age is already available that execution will be returned instead of a newly started execution. Set to 0 or null (and set a unique, previously unused External ID) to force a new query execution irrespective of previous executions. Either the External ID or a Cache Duration greater than 0 must be specified. If both are specified, the External ID will be preferred (and the Maximal Cache Age ignored).
30
+ attr_accessor :max_cache_age
31
+
32
+ # The SQL statement which is being submitted for execution. Must be a valid PrestoDB/Athena SQL statement.
33
+ attr_accessor :query_string
34
+
35
+ # The maximal amount of scanned data that this query is allowed to scan. After this limit is reached query will be canceled by the system.
36
+ attr_accessor :scanned_data_limit
37
+
38
+ # The IDs of the spaces in which the query shall be executed. At most 5 space IDs may be specified. All specified spaces must be owned by the account specified by the accountId property. The spaces property may be missing or empty to query all spaces of the specified account.
39
+ attr_accessor :space_ids
40
+
41
+ # Attribute mapping from ruby-style variable name to JSON key.
42
+ def self.attribute_map
43
+ {
44
+ :'account_id' => :'accountId',
45
+ :'external_id' => :'externalId',
46
+ :'max_cache_age' => :'maxCacheAge',
47
+ :'query_string' => :'queryString',
48
+ :'scanned_data_limit' => :'scannedDataLimit',
49
+ :'space_ids' => :'spaceIds'
50
+ }
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.swagger_types
55
+ {
56
+ :'account_id' => :'Integer',
57
+ :'external_id' => :'String',
58
+ :'max_cache_age' => :'Integer',
59
+ :'query_string' => :'String',
60
+ :'scanned_data_limit' => :'Float',
61
+ :'space_ids' => :'Array<Integer>'
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?(:'accountId')
74
+ self.account_id = attributes[:'accountId']
75
+ end
76
+
77
+ if attributes.has_key?(:'externalId')
78
+ self.external_id = attributes[:'externalId']
79
+ end
80
+
81
+ if attributes.has_key?(:'maxCacheAge')
82
+ self.max_cache_age = attributes[:'maxCacheAge']
83
+ end
84
+
85
+ if attributes.has_key?(:'queryString')
86
+ self.query_string = attributes[:'queryString']
87
+ end
88
+
89
+ if attributes.has_key?(:'scannedDataLimit')
90
+ self.scanned_data_limit = attributes[:'scannedDataLimit']
91
+ end
92
+
93
+ if attributes.has_key?(:'spaceIds')
94
+ if (value = attributes[:'spaceIds']).is_a?(Array)
95
+ self.space_ids = value
96
+ end
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ if @account_id.nil?
105
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
106
+ end
107
+
108
+ if !@query_string.nil? && @query_string.to_s.length > 4096
109
+ invalid_properties.push('invalid value for "query_string", the character length must be smaller than or equal to 4096.')
110
+ end
111
+
112
+ if !@query_string.nil? && @query_string.to_s.length < 1
113
+ invalid_properties.push('invalid value for "query_string", the character length must be great than or equal to 1.')
114
+ end
115
+
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ return false if @account_id.nil?
123
+ return false if !@query_string.nil? && @query_string.to_s.length > 4096
124
+ return false if !@query_string.nil? && @query_string.to_s.length < 1
125
+ true
126
+ end
127
+
128
+ # Custom attribute writer method with validation
129
+ # @param [Object] query_string Value to be assigned
130
+ def query_string=(query_string)
131
+ if !query_string.nil? && query_string.to_s.length > 4096
132
+ fail ArgumentError, 'invalid value for "query_string", the character length must be smaller than or equal to 4096.'
133
+ end
134
+
135
+ if !query_string.nil? && query_string.to_s.length < 1
136
+ fail ArgumentError, 'invalid value for "query_string", the character length must be great than or equal to 1.'
137
+ end
138
+
139
+ @query_string = query_string
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
+ account_id == o.account_id &&
148
+ external_id == o.external_id &&
149
+ max_cache_age == o.max_cache_age &&
150
+ query_string == o.query_string &&
151
+ scanned_data_limit == o.scanned_data_limit &&
152
+ space_ids == o.space_ids
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
+ [account_id, external_id, max_cache_age, query_string, scanned_data_limit, space_ids].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 = PostFinanceCheckout.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