Class: NewDemoApiClient::BenchmarkClient

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/benchmark/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ NewDemoApiClient::BenchmarkClient

Parameters:



24
25
26
# File 'lib/test_sdk/benchmark/client.rb', line 24

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientNewDemoApiClient::RequestClient (readonly)



20
21
22
# File 'lib/test_sdk/benchmark/client.rb', line 20

def request_client
  @request_client
end

Instance Method Details

#get_available_benchmark_categories(group_id:, request_options: nil) ⇒ NewDemoApiClient::AVAILABLE_CATEGORIES_RESPONSE

Get the list of categories with benchmark models available for the account.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_available_benchmark_categories(group_id: 1)

Parameters:

Returns:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/test_sdk/benchmark/client.rb', line 40

def get_available_benchmark_categories(group_id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/data/benchmark/available-benchmark-categories"
  end
  JSON.parse(response.body)
end

#get_available_company_categories(group_id:, deal_id:, request_options: nil) ⇒ NewDemoApiClient::AVAILABLE_CATEGORIES_RESPONSE

Get the categories with benchmark models available for the company associated

with the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_available_company_categories(group_id: 1, deal_id: 1)

Parameters:

Returns:



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/test_sdk/benchmark/client.rb', line 233

def get_available_company_categories(group_id:, deal_id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/benchmark/available-categories"
  end
  JSON.parse(response.body)
end

#get_available_models(group_id:, request_options: nil) ⇒ NewDemoApiClient::AvailableModelsResponse

Get the list of available scaling and tradeoff models for the account.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_available_models(group_id: 1)

Parameters:

Returns:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/test_sdk/benchmark/client.rb', line 154

def get_available_models(group_id:, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/data/benchmark/available-models"
  end
  NewDemoApiClient::AvailableModelsResponse.from_json(json_object: response.body)
end

#get_categories_metadata(request_options: nil) ⇒ NewDemoApiClient::CategoriesMetadataResponse

Get the categories metadata.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.

Parameters:

Returns:



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
# File 'lib/test_sdk/benchmark/client.rb', line 490

def (request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/data/benchmark/metadata/categories"
  end
  NewDemoApiClient::CategoriesMetadataResponse.from_json(json_object: response.body)
end

#get_columns_metadata(request_options: nil) ⇒ NewDemoApiClient::ColumnsMetadataResponse

Get the columns metadata.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.

Parameters:

Returns:



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
# File 'lib/test_sdk/benchmark/client.rb', line 424

def (request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/data/benchmark/metadata/columns"
  end
  NewDemoApiClient::ColumnsMetadataResponse.from_json(json_object: response.body)
end

#get_combined_time_series(user_type:, group_id:, deal_id:, column: nil, request_options: nil) ⇒ Array<NewDemoApiClient::DealCombinedMetricsResponse>

Get the combined time series data for the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_combined_time_series(
  user_type: BUSINESS,
  group_id: 1,
  deal_id: 1
)

Parameters:

Returns:



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/test_sdk/benchmark/client.rb', line 272

def get_combined_time_series(user_type:, group_id:, deal_id:, column: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = { **(request_options&.additional_query_parameters || {}), "column": column }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{user_type}/deal/#{group_id}/data/benchmark/combined-time-series/#{deal_id}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    NewDemoApiClient::DealCombinedMetricsResponse.from_json(json_object: item)
  end
end

#get_deal_benchmark_quantiles(group_id:, deal_id:, category:, column: nil, request_options: nil) ⇒ Array<NewDemoApiClient::BenchmarkQuantile>

Get the benchmark quantiles for a given category.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_deal_benchmark_quantiles(
  group_id: 1,
  deal_id: 1,
  category: "category"
)

Parameters:

  • group_id (Integer)
  • deal_id (Integer)
  • category (String)
  • column (String) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/test_sdk/benchmark/client.rb', line 350

def get_deal_benchmark_quantiles(group_id:, deal_id:, category:, column: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = { **(request_options&.additional_query_parameters || {}), "column": column }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/benchmark/quantiles/#{category}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    NewDemoApiClient::BenchmarkQuantile.from_json(json_object: item)
  end
end

#get_deal_benchmark_tradeoff_at_scale(group_id:, deal_id:, category:, model: nil, request_options: nil) ⇒ NewDemoApiClient::TRADEOFF_MODELS_RESPONSE

Get the tradeoff models for a given category.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_deal_benchmark_tradeoff_at_scale(
  group_id: 1,
  deal_id: 1,
  category: "category"
)

Parameters:

  • group_id (Integer)
  • deal_id (Integer)
  • category (String)
  • model (String) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/test_sdk/benchmark/client.rb', line 391

def get_deal_benchmark_tradeoff_at_scale(group_id:, deal_id:, category:, model: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = { **(request_options&.additional_query_parameters || {}), "model": model }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/benchmark/tradeoff-at-scale/#{category}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.transform_values do |value|
    value = value.to_json
    NewDemoApiClient::TradeoffModel.from_json(json_object: value)
  end
end

#get_models_metadata(request_options: nil) ⇒ Array<NewDemoApiClient::ModelsMetadataResponse>

Get the models metadata.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.

Parameters:

Returns:



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/test_sdk/benchmark/client.rb', line 455

def (request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    unless request_options.nil? || request_options&.additional_query_parameters.nil?
      req.params = { **(request_options&.additional_query_parameters || {}) }.compact
    end
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/data/benchmark/metadata/models"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    NewDemoApiClient::ModelsMetadataResponse.from_json(json_object: item)
  end
end

#get_quantiles(group_id:, category:, revenue:, column: nil, request_options: nil) ⇒ Array<NewDemoApiClient::BenchmarkQuantile>

Get the benchmark quantiles for a given category at a specified revenue scale.

If columns are specified, only those columns will be returned.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_quantiles(
  group_id: 1,
  category: "category",
  revenue: 1.1
)

Parameters:

  • group_id (Integer)
  • category (String)
  • revenue (Float)

    Annualized revenue scale for which to obtain benchmarks

  • column (String) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/test_sdk/benchmark/client.rb', line 80

def get_quantiles(group_id:, category:, revenue:, column: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "revenue": revenue,
      "column": column
    }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/data/benchmark/quantiles/#{category}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.map do |item|
    item = item.to_json
    NewDemoApiClient::BenchmarkQuantile.from_json(json_object: item)
  end
end

#get_scaling(group_id:, category:, model: nil, request_options: nil) ⇒ NewDemoApiClient::SCALE_MODELS_RESPONSE

Get the scaling models for a given category. Multiple models can be specified.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_scaling(group_id: 1, category: "category")

Parameters:

Returns:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/test_sdk/benchmark/client.rb', line 120

def get_scaling(group_id:, category:, model: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = { **(request_options&.additional_query_parameters || {}), "model": model }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/data/benchmark/scaling/#{category}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.transform_values do |value|
    value = value.to_json
    NewDemoApiClient::ScaleModel.from_json(json_object: value)
  end
end

#get_time_series_endpoint(user_type:, group_id:, deal_id:, column: nil, request_options: nil) ⇒ NewDemoApiClient::DealCombinedMetricsResponse

Get the time series data endpoint for the deal.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_time_series_endpoint(
  user_type: BUSINESS,
  group_id: 1,
  deal_id: 1
)

Parameters:

Returns:



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/test_sdk/benchmark/client.rb', line 313

def get_time_series_endpoint(user_type:, group_id:, deal_id:, column: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = { **(request_options&.additional_query_parameters || {}), "column": column }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{user_type}/deal/#{group_id}/data/benchmark/time-series-endpoint/#{deal_id}"
  end
  NewDemoApiClient::DealCombinedMetricsResponse.from_json(json_object: response.body)
end

#get_tradeoff_at_scale(group_id:, category:, revenue:, model: nil, request_options: nil) ⇒ NewDemoApiClient::TRADEOFF_MODELS_RESPONSE

Get the tradeoff at scale model for a given category.

Examples:

api = NewDemoApiClient::Client.new(
  base_url: "https://api.example.com",
  environment: NewDemoApiClient::Environment::DEFAULT,
  token: "YOUR_AUTH_TOKEN"
)
api.benchmark.get_tradeoff_at_scale(
  group_id: 1,
  category: "category",
  revenue: 1.1
)

Parameters:

  • group_id (Integer)
  • category (String)
  • revenue (Float)

    Annualized revenue scale for which to obtain benchmarks

  • model (String) (defaults to: nil)
  • request_options (NewDemoApiClient::RequestOptions) (defaults to: nil)

Returns:



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/test_sdk/benchmark/client.rb', line 193

def get_tradeoff_at_scale(group_id:, category:, revenue:, model: nil, request_options: nil)
  response = @request_client.conn.get do |req|
    req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
    req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
    req.headers = {
  **(req.headers || {}),
  **@request_client.get_headers,
  **(request_options&.additional_headers || {})
    }.compact
    req.params = {
      **(request_options&.additional_query_parameters || {}),
      "revenue": revenue,
      "model": model
    }.compact
    unless request_options.nil? || request_options&.additional_body_parameters.nil?
      req.body = { **(request_options&.additional_body_parameters || {}) }.compact
    end
    req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/data/benchmark/tradeoff-at-scale/#{category}"
  end
  parsed_json = JSON.parse(response.body)
  parsed_json&.transform_values do |value|
    value = value.to_json
    NewDemoApiClient::TradeoffModel.from_json(json_object: value)
  end
end