Class: NewDemoApiClient::AsyncBenchmarkClient

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::AsyncBenchmarkClient

Parameters:



517
518
519
# File 'lib/test_sdk/benchmark/client.rb', line 517

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientNewDemoApiClient::AsyncRequestClient (readonly)



513
514
515
# File 'lib/test_sdk/benchmark/client.rb', line 513

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:



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/test_sdk/benchmark/client.rb', line 533

def get_available_benchmark_categories(group_id:, request_options: nil)
  Async do
    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
    parsed_json = JSON.parse(response.body)
    parsed_json
  end
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:



737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/test_sdk/benchmark/client.rb', line 737

def get_available_company_categories(group_id:, deal_id:, request_options: nil)
  Async do
    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
    parsed_json = JSON.parse(response.body)
    parsed_json
  end
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:



654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/test_sdk/benchmark/client.rb', line 654

def get_available_models(group_id:, request_options: nil)
  Async do
    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
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:



1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
# File 'lib/test_sdk/benchmark/client.rb', line 1009

def (request_options: nil)
  Async do
    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
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:



939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/test_sdk/benchmark/client.rb', line 939

def (request_options: nil)
  Async do
    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
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:



779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
# File 'lib/test_sdk/benchmark/client.rb', line 779

def get_combined_time_series(user_type:, group_id:, deal_id:, column: nil, request_options: nil)
  Async do
    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
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:



861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# File 'lib/test_sdk/benchmark/client.rb', line 861

def get_deal_benchmark_quantiles(group_id:, deal_id:, category:, column: nil, request_options: nil)
  Async do
    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
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:



904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
# File 'lib/test_sdk/benchmark/client.rb', line 904

def get_deal_benchmark_tradeoff_at_scale(group_id:, deal_id:, category:, model: nil, request_options: nil)
  Async do
    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
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:



972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/test_sdk/benchmark/client.rb', line 972

def (request_options: nil)
  Async do
    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
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:



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/test_sdk/benchmark/client.rb', line 576

def get_quantiles(group_id:, category:, revenue:, column: nil, request_options: nil)
  Async do
    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
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:



618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# File 'lib/test_sdk/benchmark/client.rb', line 618

def get_scaling(group_id:, category:, model: nil, request_options: nil)
  Async do
    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
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:



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
# File 'lib/test_sdk/benchmark/client.rb', line 822

def get_time_series_endpoint(user_type:, group_id:, deal_id:, column: nil, request_options: nil)
  Async do
    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
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:



695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
# File 'lib/test_sdk/benchmark/client.rb', line 695

def get_tradeoff_at_scale(group_id:, category:, revenue:, model: nil, request_options: nil)
  Async do
    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
end