cbox_billing 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cbox_billing/api/checkout_portal_api.rb +214 -0
- data/lib/cbox_billing/api/coupons_api.rb +55 -55
- data/lib/cbox_billing/api/experiments_api.rb +526 -0
- data/lib/cbox_billing/api/organizations_api.rb +554 -0
- data/lib/cbox_billing/api/pricing_tables_api.rb +519 -0
- data/lib/cbox_billing/api/retention_api.rb +884 -0
- data/lib/cbox_billing/api/sellers_api.rb +590 -0
- data/lib/cbox_billing/models/checkout_link.rb +283 -0
- data/lib/cbox_billing/models/conclude_experiment_request.rb +161 -0
- data/lib/cbox_billing/models/create_checkout_link_request.rb +178 -0
- data/lib/cbox_billing/models/customer_lifecycle_refusal.rb +238 -0
- data/lib/cbox_billing/models/customer_lifecycle_state.rb +268 -0
- data/lib/cbox_billing/models/delete_experiment200_response.rb +227 -0
- data/lib/cbox_billing/models/delete_organization200_response.rb +227 -0
- data/lib/cbox_billing/models/experiment.rb +387 -0
- data/lib/cbox_billing/models/experiment_input.rb +410 -0
- data/lib/cbox_billing/models/experiment_input_variants_inner.rb +233 -0
- data/lib/cbox_billing/models/experiment_variant.rb +266 -0
- data/lib/cbox_billing/models/list_checkout_links200_response.rb +179 -0
- data/lib/cbox_billing/models/list_checkout_links200_response_data_inner.rb +223 -0
- data/lib/cbox_billing/models/list_experiments200_response.rb +179 -0
- data/lib/cbox_billing/models/list_pricing_tables200_response.rb +179 -0
- data/lib/cbox_billing/models/list_retention_offers200_response.rb +179 -0
- data/lib/cbox_billing/models/list_retention_reasons200_response.rb +179 -0
- data/lib/cbox_billing/models/list_sellers200_response.rb +179 -0
- data/lib/cbox_billing/models/merge_organization_request.rb +221 -0
- data/lib/cbox_billing/models/merge_organization_request_fields.rb +279 -0
- data/lib/cbox_billing/models/preview_organization_merge200_response.rb +343 -0
- data/lib/cbox_billing/models/preview_organization_merge_request.rb +177 -0
- data/lib/cbox_billing/models/pricing_table.rb +426 -0
- data/lib/cbox_billing/models/pricing_table_column.rb +248 -0
- data/lib/cbox_billing/models/pricing_table_input.rb +388 -0
- data/lib/cbox_billing/models/retention_offer.rb +389 -0
- data/lib/cbox_billing/models/retention_offer_input.rb +447 -0
- data/lib/cbox_billing/models/retention_reason.rb +282 -0
- data/lib/cbox_billing/models/retention_reason_input.rb +195 -0
- data/lib/cbox_billing/models/revoke_checkout_link200_response.rb +227 -0
- data/lib/cbox_billing/models/seller.rb +551 -0
- data/lib/cbox_billing/models/seller_address.rb +201 -0
- data/lib/cbox_billing/models/seller_bank.rb +191 -0
- data/lib/cbox_billing/models/seller_input.rb +633 -0
- data/lib/cbox_billing/models/seller_input_registrations_inner.rb +188 -0
- data/lib/cbox_billing/models/seller_registrations_inner.rb +189 -0
- data/lib/cbox_billing/models/suspend_organization_request.rb +179 -0
- data/lib/cbox_billing/version.rb +1 -1
- data/lib/cbox_billing.rb +41 -0
- metadata +42 -1
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Cbox Billing API
|
|
3
|
+
|
|
4
|
+
#The HTTP API of Cbox Billing. Reference: https://github.com/cboxdk/cbox-billing/tree/main/docs/api
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module CboxBilling
|
|
16
|
+
class ExperimentsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Conclude a pricing experiment
|
|
23
|
+
# Stops the split. With `winner`, a variant id, the base table's page serves that variant's table from now on; without it, the page reverts to its base table. Only a running experiment concludes (409). Operator token only.
|
|
24
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
27
|
+
# @option opts [ConcludeExperimentRequest] :conclude_experiment_request
|
|
28
|
+
# @return [Experiment]
|
|
29
|
+
def conclude_experiment(id, opts = {})
|
|
30
|
+
data, _status_code, _headers = conclude_experiment_with_http_info(id, opts)
|
|
31
|
+
data
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Conclude a pricing experiment
|
|
35
|
+
# Stops the split. With `winner`, a variant id, the base table's page serves that variant's table from now on; without it, the page reverts to its base table. Only a running experiment concludes (409). Operator token only.
|
|
36
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
37
|
+
# @param [Hash] opts the optional parameters
|
|
38
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
39
|
+
# @option opts [ConcludeExperimentRequest] :conclude_experiment_request
|
|
40
|
+
# @return [Array<(Experiment, Integer, Hash)>] Experiment data, response status code and response headers
|
|
41
|
+
def conclude_experiment_with_http_info(id, opts = {})
|
|
42
|
+
if @api_client.config.debugging
|
|
43
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.conclude_experiment ...'
|
|
44
|
+
end
|
|
45
|
+
# verify the required parameter 'id' is set
|
|
46
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
47
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.conclude_experiment"
|
|
48
|
+
end
|
|
49
|
+
pattern = Regexp.new(/^exp_[A-Za-z0-9]+$/)
|
|
50
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
51
|
+
fail ArgumentError, "invalid value for 'id' when calling ExperimentsApi.conclude_experiment, must conform to the pattern #{pattern}."
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# resource path
|
|
55
|
+
local_var_path = '/experiments/{id}/conclude'.sub('{id}', CGI.escape(id.to_s))
|
|
56
|
+
|
|
57
|
+
# query parameters
|
|
58
|
+
query_params = opts[:query_params] || {}
|
|
59
|
+
|
|
60
|
+
# header parameters
|
|
61
|
+
header_params = opts[:header_params] || {}
|
|
62
|
+
# HTTP header 'Accept' (if needed)
|
|
63
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
64
|
+
# HTTP header 'Content-Type'
|
|
65
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
66
|
+
if !content_type.nil?
|
|
67
|
+
header_params['Content-Type'] = content_type
|
|
68
|
+
end
|
|
69
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
70
|
+
|
|
71
|
+
# form parameters
|
|
72
|
+
form_params = opts[:form_params] || {}
|
|
73
|
+
|
|
74
|
+
# http body (model)
|
|
75
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'conclude_experiment_request'])
|
|
76
|
+
|
|
77
|
+
# return_type
|
|
78
|
+
return_type = opts[:debug_return_type] || 'Experiment'
|
|
79
|
+
|
|
80
|
+
# auth_names
|
|
81
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
82
|
+
|
|
83
|
+
new_options = opts.merge(
|
|
84
|
+
:operation => :"ExperimentsApi.conclude_experiment",
|
|
85
|
+
:header_params => header_params,
|
|
86
|
+
:query_params => query_params,
|
|
87
|
+
:form_params => form_params,
|
|
88
|
+
:body => post_body,
|
|
89
|
+
:auth_names => auth_names,
|
|
90
|
+
:return_type => return_type
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
94
|
+
if @api_client.config.debugging
|
|
95
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#conclude_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
96
|
+
end
|
|
97
|
+
return data, status_code, headers
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Create a pricing experiment
|
|
101
|
+
# A draft A/B test on a pricing table: the base table's visitors are split by weight between a control and challengers, each serving a pricing table, and measured on the primary metric. The same fields and rules as Catalog → Experiments: one control, at least one challenger, weights above zero and a unique key (409). Nothing is served until it is started. Operator token only.
|
|
102
|
+
# @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
|
|
103
|
+
# @param experiment_input [ExperimentInput]
|
|
104
|
+
# @param [Hash] opts the optional parameters
|
|
105
|
+
# @return [Experiment]
|
|
106
|
+
def create_experiment(idempotency_key, experiment_input, opts = {})
|
|
107
|
+
data, _status_code, _headers = create_experiment_with_http_info(idempotency_key, experiment_input, opts)
|
|
108
|
+
data
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Create a pricing experiment
|
|
112
|
+
# A draft A/B test on a pricing table: the base table's visitors are split by weight between a control and challengers, each serving a pricing table, and measured on the primary metric. The same fields and rules as Catalog → Experiments: one control, at least one challenger, weights above zero and a unique key (409). Nothing is served until it is started. Operator token only.
|
|
113
|
+
# @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is `400 idempotency_key_required`. A retry with the same key replays the first response; reusing it with a different body is `409`.
|
|
114
|
+
# @param experiment_input [ExperimentInput]
|
|
115
|
+
# @param [Hash] opts the optional parameters
|
|
116
|
+
# @return [Array<(Experiment, Integer, Hash)>] Experiment data, response status code and response headers
|
|
117
|
+
def create_experiment_with_http_info(idempotency_key, experiment_input, opts = {})
|
|
118
|
+
if @api_client.config.debugging
|
|
119
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.create_experiment ...'
|
|
120
|
+
end
|
|
121
|
+
# verify the required parameter 'idempotency_key' is set
|
|
122
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
123
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling ExperimentsApi.create_experiment"
|
|
124
|
+
end
|
|
125
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
|
|
126
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling ExperimentsApi.create_experiment, the character length must be smaller than or equal to 100.'
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# verify the required parameter 'experiment_input' is set
|
|
130
|
+
if @api_client.config.client_side_validation && experiment_input.nil?
|
|
131
|
+
fail ArgumentError, "Missing the required parameter 'experiment_input' when calling ExperimentsApi.create_experiment"
|
|
132
|
+
end
|
|
133
|
+
# resource path
|
|
134
|
+
local_var_path = '/experiments'
|
|
135
|
+
|
|
136
|
+
# query parameters
|
|
137
|
+
query_params = opts[:query_params] || {}
|
|
138
|
+
|
|
139
|
+
# header parameters
|
|
140
|
+
header_params = opts[:header_params] || {}
|
|
141
|
+
# HTTP header 'Accept' (if needed)
|
|
142
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
143
|
+
# HTTP header 'Content-Type'
|
|
144
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
145
|
+
if !content_type.nil?
|
|
146
|
+
header_params['Content-Type'] = content_type
|
|
147
|
+
end
|
|
148
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
149
|
+
|
|
150
|
+
# form parameters
|
|
151
|
+
form_params = opts[:form_params] || {}
|
|
152
|
+
|
|
153
|
+
# http body (model)
|
|
154
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(experiment_input)
|
|
155
|
+
|
|
156
|
+
# return_type
|
|
157
|
+
return_type = opts[:debug_return_type] || 'Experiment'
|
|
158
|
+
|
|
159
|
+
# auth_names
|
|
160
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
161
|
+
|
|
162
|
+
new_options = opts.merge(
|
|
163
|
+
:operation => :"ExperimentsApi.create_experiment",
|
|
164
|
+
:header_params => header_params,
|
|
165
|
+
:query_params => query_params,
|
|
166
|
+
:form_params => form_params,
|
|
167
|
+
:body => post_body,
|
|
168
|
+
:auth_names => auth_names,
|
|
169
|
+
:return_type => return_type
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
173
|
+
if @api_client.config.debugging
|
|
174
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#create_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
175
|
+
end
|
|
176
|
+
return data, status_code, headers
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Delete a pricing experiment
|
|
180
|
+
# Its variants and recorded results are deleted with it. A running experiment is concluded first (409). Operator token only.
|
|
181
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
182
|
+
# @param [Hash] opts the optional parameters
|
|
183
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
184
|
+
# @return [DeleteExperiment200Response]
|
|
185
|
+
def delete_experiment(id, opts = {})
|
|
186
|
+
data, _status_code, _headers = delete_experiment_with_http_info(id, opts)
|
|
187
|
+
data
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Delete a pricing experiment
|
|
191
|
+
# Its variants and recorded results are deleted with it. A running experiment is concluded first (409). Operator token only.
|
|
192
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
193
|
+
# @param [Hash] opts the optional parameters
|
|
194
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
195
|
+
# @return [Array<(DeleteExperiment200Response, Integer, Hash)>] DeleteExperiment200Response data, response status code and response headers
|
|
196
|
+
def delete_experiment_with_http_info(id, opts = {})
|
|
197
|
+
if @api_client.config.debugging
|
|
198
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.delete_experiment ...'
|
|
199
|
+
end
|
|
200
|
+
# verify the required parameter 'id' is set
|
|
201
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
202
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.delete_experiment"
|
|
203
|
+
end
|
|
204
|
+
pattern = Regexp.new(/^exp_[A-Za-z0-9]+$/)
|
|
205
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
206
|
+
fail ArgumentError, "invalid value for 'id' when calling ExperimentsApi.delete_experiment, must conform to the pattern #{pattern}."
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# resource path
|
|
210
|
+
local_var_path = '/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
211
|
+
|
|
212
|
+
# query parameters
|
|
213
|
+
query_params = opts[:query_params] || {}
|
|
214
|
+
|
|
215
|
+
# header parameters
|
|
216
|
+
header_params = opts[:header_params] || {}
|
|
217
|
+
# HTTP header 'Accept' (if needed)
|
|
218
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
219
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
220
|
+
|
|
221
|
+
# form parameters
|
|
222
|
+
form_params = opts[:form_params] || {}
|
|
223
|
+
|
|
224
|
+
# http body (model)
|
|
225
|
+
post_body = opts[:debug_body]
|
|
226
|
+
|
|
227
|
+
# return_type
|
|
228
|
+
return_type = opts[:debug_return_type] || 'DeleteExperiment200Response'
|
|
229
|
+
|
|
230
|
+
# auth_names
|
|
231
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
232
|
+
|
|
233
|
+
new_options = opts.merge(
|
|
234
|
+
:operation => :"ExperimentsApi.delete_experiment",
|
|
235
|
+
:header_params => header_params,
|
|
236
|
+
:query_params => query_params,
|
|
237
|
+
:form_params => form_params,
|
|
238
|
+
:body => post_body,
|
|
239
|
+
:auth_names => auth_names,
|
|
240
|
+
:return_type => return_type
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
244
|
+
if @api_client.config.debugging
|
|
245
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#delete_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
246
|
+
end
|
|
247
|
+
return data, status_code, headers
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Read a pricing experiment
|
|
251
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
252
|
+
# @param [Hash] opts the optional parameters
|
|
253
|
+
# @return [Experiment]
|
|
254
|
+
def get_experiment(id, opts = {})
|
|
255
|
+
data, _status_code, _headers = get_experiment_with_http_info(id, opts)
|
|
256
|
+
data
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Read a pricing experiment
|
|
260
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
261
|
+
# @param [Hash] opts the optional parameters
|
|
262
|
+
# @return [Array<(Experiment, Integer, Hash)>] Experiment data, response status code and response headers
|
|
263
|
+
def get_experiment_with_http_info(id, opts = {})
|
|
264
|
+
if @api_client.config.debugging
|
|
265
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.get_experiment ...'
|
|
266
|
+
end
|
|
267
|
+
# verify the required parameter 'id' is set
|
|
268
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
269
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.get_experiment"
|
|
270
|
+
end
|
|
271
|
+
pattern = Regexp.new(/^exp_[A-Za-z0-9]+$/)
|
|
272
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
273
|
+
fail ArgumentError, "invalid value for 'id' when calling ExperimentsApi.get_experiment, must conform to the pattern #{pattern}."
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
# resource path
|
|
277
|
+
local_var_path = '/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
278
|
+
|
|
279
|
+
# query parameters
|
|
280
|
+
query_params = opts[:query_params] || {}
|
|
281
|
+
|
|
282
|
+
# header parameters
|
|
283
|
+
header_params = opts[:header_params] || {}
|
|
284
|
+
# HTTP header 'Accept' (if needed)
|
|
285
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
286
|
+
|
|
287
|
+
# form parameters
|
|
288
|
+
form_params = opts[:form_params] || {}
|
|
289
|
+
|
|
290
|
+
# http body (model)
|
|
291
|
+
post_body = opts[:debug_body]
|
|
292
|
+
|
|
293
|
+
# return_type
|
|
294
|
+
return_type = opts[:debug_return_type] || 'Experiment'
|
|
295
|
+
|
|
296
|
+
# auth_names
|
|
297
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
298
|
+
|
|
299
|
+
new_options = opts.merge(
|
|
300
|
+
:operation => :"ExperimentsApi.get_experiment",
|
|
301
|
+
:header_params => header_params,
|
|
302
|
+
:query_params => query_params,
|
|
303
|
+
:form_params => form_params,
|
|
304
|
+
:body => post_body,
|
|
305
|
+
:auth_names => auth_names,
|
|
306
|
+
:return_type => return_type
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
310
|
+
if @api_client.config.debugging
|
|
311
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#get_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
312
|
+
end
|
|
313
|
+
return data, status_code, headers
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# List the pricing experiments
|
|
317
|
+
# Every pricing experiment of the environment, the newest first. Operator token only.
|
|
318
|
+
# @param [Hash] opts the optional parameters
|
|
319
|
+
# @return [ListExperiments200Response]
|
|
320
|
+
def list_experiments(opts = {})
|
|
321
|
+
data, _status_code, _headers = list_experiments_with_http_info(opts)
|
|
322
|
+
data
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# List the pricing experiments
|
|
326
|
+
# Every pricing experiment of the environment, the newest first. Operator token only.
|
|
327
|
+
# @param [Hash] opts the optional parameters
|
|
328
|
+
# @return [Array<(ListExperiments200Response, Integer, Hash)>] ListExperiments200Response data, response status code and response headers
|
|
329
|
+
def list_experiments_with_http_info(opts = {})
|
|
330
|
+
if @api_client.config.debugging
|
|
331
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.list_experiments ...'
|
|
332
|
+
end
|
|
333
|
+
# resource path
|
|
334
|
+
local_var_path = '/experiments'
|
|
335
|
+
|
|
336
|
+
# query parameters
|
|
337
|
+
query_params = opts[:query_params] || {}
|
|
338
|
+
|
|
339
|
+
# header parameters
|
|
340
|
+
header_params = opts[:header_params] || {}
|
|
341
|
+
# HTTP header 'Accept' (if needed)
|
|
342
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
343
|
+
|
|
344
|
+
# form parameters
|
|
345
|
+
form_params = opts[:form_params] || {}
|
|
346
|
+
|
|
347
|
+
# http body (model)
|
|
348
|
+
post_body = opts[:debug_body]
|
|
349
|
+
|
|
350
|
+
# return_type
|
|
351
|
+
return_type = opts[:debug_return_type] || 'ListExperiments200Response'
|
|
352
|
+
|
|
353
|
+
# auth_names
|
|
354
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
355
|
+
|
|
356
|
+
new_options = opts.merge(
|
|
357
|
+
:operation => :"ExperimentsApi.list_experiments",
|
|
358
|
+
:header_params => header_params,
|
|
359
|
+
:query_params => query_params,
|
|
360
|
+
:form_params => form_params,
|
|
361
|
+
:body => post_body,
|
|
362
|
+
:auth_names => auth_names,
|
|
363
|
+
:return_type => return_type
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
367
|
+
if @api_client.config.debugging
|
|
368
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#list_experiments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
369
|
+
end
|
|
370
|
+
return data, status_code, headers
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
# Start a pricing experiment
|
|
374
|
+
# The storefront starts splitting the base table's visitors between the variants. Only a draft starts (409). Operator token only.
|
|
375
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
376
|
+
# @param [Hash] opts the optional parameters
|
|
377
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
378
|
+
# @return [Experiment]
|
|
379
|
+
def start_experiment(id, opts = {})
|
|
380
|
+
data, _status_code, _headers = start_experiment_with_http_info(id, opts)
|
|
381
|
+
data
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
# Start a pricing experiment
|
|
385
|
+
# The storefront starts splitting the base table's visitors between the variants. Only a draft starts (409). Operator token only.
|
|
386
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
387
|
+
# @param [Hash] opts the optional parameters
|
|
388
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
389
|
+
# @return [Array<(Experiment, Integer, Hash)>] Experiment data, response status code and response headers
|
|
390
|
+
def start_experiment_with_http_info(id, opts = {})
|
|
391
|
+
if @api_client.config.debugging
|
|
392
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.start_experiment ...'
|
|
393
|
+
end
|
|
394
|
+
# verify the required parameter 'id' is set
|
|
395
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
396
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.start_experiment"
|
|
397
|
+
end
|
|
398
|
+
pattern = Regexp.new(/^exp_[A-Za-z0-9]+$/)
|
|
399
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
400
|
+
fail ArgumentError, "invalid value for 'id' when calling ExperimentsApi.start_experiment, must conform to the pattern #{pattern}."
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# resource path
|
|
404
|
+
local_var_path = '/experiments/{id}/start'.sub('{id}', CGI.escape(id.to_s))
|
|
405
|
+
|
|
406
|
+
# query parameters
|
|
407
|
+
query_params = opts[:query_params] || {}
|
|
408
|
+
|
|
409
|
+
# header parameters
|
|
410
|
+
header_params = opts[:header_params] || {}
|
|
411
|
+
# HTTP header 'Accept' (if needed)
|
|
412
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
413
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
414
|
+
|
|
415
|
+
# form parameters
|
|
416
|
+
form_params = opts[:form_params] || {}
|
|
417
|
+
|
|
418
|
+
# http body (model)
|
|
419
|
+
post_body = opts[:debug_body]
|
|
420
|
+
|
|
421
|
+
# return_type
|
|
422
|
+
return_type = opts[:debug_return_type] || 'Experiment'
|
|
423
|
+
|
|
424
|
+
# auth_names
|
|
425
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
426
|
+
|
|
427
|
+
new_options = opts.merge(
|
|
428
|
+
:operation => :"ExperimentsApi.start_experiment",
|
|
429
|
+
:header_params => header_params,
|
|
430
|
+
:query_params => query_params,
|
|
431
|
+
:form_params => form_params,
|
|
432
|
+
:body => post_body,
|
|
433
|
+
:auth_names => auth_names,
|
|
434
|
+
:return_type => return_type
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
438
|
+
if @api_client.config.debugging
|
|
439
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#start_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
440
|
+
end
|
|
441
|
+
return data, status_code, headers
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
# Change a pricing experiment
|
|
445
|
+
# The whole experiment, as the console's form sends it: the variants are replaced. Operator token only.
|
|
446
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
447
|
+
# @param experiment_input [ExperimentInput]
|
|
448
|
+
# @param [Hash] opts the optional parameters
|
|
449
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
450
|
+
# @return [Experiment]
|
|
451
|
+
def update_experiment(id, experiment_input, opts = {})
|
|
452
|
+
data, _status_code, _headers = update_experiment_with_http_info(id, experiment_input, opts)
|
|
453
|
+
data
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
# Change a pricing experiment
|
|
457
|
+
# The whole experiment, as the console's form sends it: the variants are replaced. Operator token only.
|
|
458
|
+
# @param id [String] The experiment's id, such as `exp_4Rt9pW`.
|
|
459
|
+
# @param experiment_input [ExperimentInput]
|
|
460
|
+
# @param [Hash] opts the optional parameters
|
|
461
|
+
# @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
|
|
462
|
+
# @return [Array<(Experiment, Integer, Hash)>] Experiment data, response status code and response headers
|
|
463
|
+
def update_experiment_with_http_info(id, experiment_input, opts = {})
|
|
464
|
+
if @api_client.config.debugging
|
|
465
|
+
@api_client.config.logger.debug 'Calling API: ExperimentsApi.update_experiment ...'
|
|
466
|
+
end
|
|
467
|
+
# verify the required parameter 'id' is set
|
|
468
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
469
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.update_experiment"
|
|
470
|
+
end
|
|
471
|
+
pattern = Regexp.new(/^exp_[A-Za-z0-9]+$/)
|
|
472
|
+
if @api_client.config.client_side_validation && id !~ pattern
|
|
473
|
+
fail ArgumentError, "invalid value for 'id' when calling ExperimentsApi.update_experiment, must conform to the pattern #{pattern}."
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
# verify the required parameter 'experiment_input' is set
|
|
477
|
+
if @api_client.config.client_side_validation && experiment_input.nil?
|
|
478
|
+
fail ArgumentError, "Missing the required parameter 'experiment_input' when calling ExperimentsApi.update_experiment"
|
|
479
|
+
end
|
|
480
|
+
# resource path
|
|
481
|
+
local_var_path = '/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
482
|
+
|
|
483
|
+
# query parameters
|
|
484
|
+
query_params = opts[:query_params] || {}
|
|
485
|
+
|
|
486
|
+
# header parameters
|
|
487
|
+
header_params = opts[:header_params] || {}
|
|
488
|
+
# HTTP header 'Accept' (if needed)
|
|
489
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
490
|
+
# HTTP header 'Content-Type'
|
|
491
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
492
|
+
if !content_type.nil?
|
|
493
|
+
header_params['Content-Type'] = content_type
|
|
494
|
+
end
|
|
495
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
496
|
+
|
|
497
|
+
# form parameters
|
|
498
|
+
form_params = opts[:form_params] || {}
|
|
499
|
+
|
|
500
|
+
# http body (model)
|
|
501
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(experiment_input)
|
|
502
|
+
|
|
503
|
+
# return_type
|
|
504
|
+
return_type = opts[:debug_return_type] || 'Experiment'
|
|
505
|
+
|
|
506
|
+
# auth_names
|
|
507
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
508
|
+
|
|
509
|
+
new_options = opts.merge(
|
|
510
|
+
:operation => :"ExperimentsApi.update_experiment",
|
|
511
|
+
:header_params => header_params,
|
|
512
|
+
:query_params => query_params,
|
|
513
|
+
:form_params => form_params,
|
|
514
|
+
:body => post_body,
|
|
515
|
+
:auth_names => auth_names,
|
|
516
|
+
:return_type => return_type
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
520
|
+
if @api_client.config.debugging
|
|
521
|
+
@api_client.config.logger.debug "API called: ExperimentsApi#update_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
522
|
+
end
|
|
523
|
+
return data, status_code, headers
|
|
524
|
+
end
|
|
525
|
+
end
|
|
526
|
+
end
|