test_sdk 0.0.4
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 +7 -0
- data/lib/core/file_utilities.rb +26 -0
- data/lib/environment.rb +7 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +166 -0
- data/lib/test_sdk/benchmark/client.rb +1031 -0
- data/lib/test_sdk/company/client.rb +474 -0
- data/lib/test_sdk/deal/client.rb +584 -0
- data/lib/test_sdk/file/client.rb +692 -0
- data/lib/test_sdk/financials/client.rb +97 -0
- data/lib/test_sdk/group/client.rb +737 -0
- data/lib/test_sdk/macro/client.rb +422 -0
- data/lib/test_sdk/metadata/client.rb +95 -0
- data/lib/test_sdk/product/client.rb +419 -0
- data/lib/test_sdk/talent/client.rb +266 -0
- data/lib/test_sdk/types/account_manager_response.rb +74 -0
- data/lib/test_sdk/types/all_data_metadata_response.rb +68 -0
- data/lib/test_sdk/types/area.rb +74 -0
- data/lib/test_sdk/types/authenticate_api_key_response.rb +55 -0
- data/lib/test_sdk/types/available_categories_response.rb +5 -0
- data/lib/test_sdk/types/available_models_response.rb +69 -0
- data/lib/test_sdk/types/band_response.rb +83 -0
- data/lib/test_sdk/types/benchmark_quantile.rb +465 -0
- data/lib/test_sdk/types/categories_metadata_response.rb +72 -0
- data/lib/test_sdk/types/category_growth_rates.rb +143 -0
- data/lib/test_sdk/types/category_metadata.rb +79 -0
- data/lib/test_sdk/types/category_metadata_default_user_type.rb +8 -0
- data/lib/test_sdk/types/cohorts_response.rb +132 -0
- data/lib/test_sdk/types/column_metadata.rb +110 -0
- data/lib/test_sdk/types/column_mini_metadata.rb +83 -0
- data/lib/test_sdk/types/columns_metadata_response.rb +72 -0
- data/lib/test_sdk/types/company_response.rb +120 -0
- data/lib/test_sdk/types/concentration_endpoint_cdf_detail.rb +96 -0
- data/lib/test_sdk/types/concentration_endpoint_top_users_detail.rb +72 -0
- data/lib/test_sdk/types/concentration_response.rb +103 -0
- data/lib/test_sdk/types/concentration_timeseries_detail.rb +159 -0
- data/lib/test_sdk/types/contribution_response.rb +135 -0
- data/lib/test_sdk/types/create_api_key_response.rb +55 -0
- data/lib/test_sdk/types/create_file_for_signed_url_response.rb +127 -0
- data/lib/test_sdk/types/create_file_response.rb +113 -0
- data/lib/test_sdk/types/deal_combined_metrics_response.rb +477 -0
- data/lib/test_sdk/types/deal_data_availablity_response.rb +109 -0
- data/lib/test_sdk/types/deal_with_files_response.rb +194 -0
- data/lib/test_sdk/types/endpoint_seniority_count.rb +66 -0
- data/lib/test_sdk/types/executive_profile.rb +91 -0
- data/lib/test_sdk/types/executive_profile_position.rb +97 -0
- data/lib/test_sdk/types/file_response.rb +113 -0
- data/lib/test_sdk/types/file_type.rb +14 -0
- data/lib/test_sdk/types/financial_metrics.rb +113 -0
- data/lib/test_sdk/types/financials_response.rb +102 -0
- data/lib/test_sdk/types/frequency.rb +9 -0
- data/lib/test_sdk/types/function_level_growth_accounting.rb +111 -0
- data/lib/test_sdk/types/gcs_signed_url_response.rb +81 -0
- data/lib/test_sdk/types/group_response.rb +158 -0
- data/lib/test_sdk/types/group_user.rb +124 -0
- data/lib/test_sdk/types/group_with_users_response.rb +170 -0
- data/lib/test_sdk/types/growth_accounting_response.rb +226 -0
- data/lib/test_sdk/types/healthz_response.rb +55 -0
- data/lib/test_sdk/types/http_validation_error.rb +61 -0
- data/lib/test_sdk/types/income_statement_entry.rb +81 -0
- data/lib/test_sdk/types/model_metadata.rb +76 -0
- data/lib/test_sdk/types/models_metadata_response.rb +76 -0
- data/lib/test_sdk/types/paginated_response_company_response.rb +83 -0
- data/lib/test_sdk/types/paginated_response_deal_with_files_response.rb +84 -0
- data/lib/test_sdk/types/paginated_response_file_response.rb +83 -0
- data/lib/test_sdk/types/paginated_response_group_user.rb +83 -0
- data/lib/test_sdk/types/permission_model.rb +65 -0
- data/lib/test_sdk/types/priority.rb +10 -0
- data/lib/test_sdk/types/product_info_response.rb +65 -0
- data/lib/test_sdk/types/role_response.rb +95 -0
- data/lib/test_sdk/types/scale.rb +72 -0
- data/lib/test_sdk/types/scale_model.rb +80 -0
- data/lib/test_sdk/types/scale_models_response.rb +5 -0
- data/lib/test_sdk/types/scaling.rb +10 -0
- data/lib/test_sdk/types/status.rb +12 -0
- data/lib/test_sdk/types/tradeoff_model.rb +95 -0
- data/lib/test_sdk/types/tradeoff_models_response.rb +5 -0
- data/lib/test_sdk/types/unit.rb +12 -0
- data/lib/test_sdk/types/unit_economics_info_response.rb +55 -0
- data/lib/test_sdk/types/user_accounting_response.rb +168 -0
- data/lib/test_sdk/types/user_role_response.rb +77 -0
- data/lib/test_sdk/types/user_type.rb +12 -0
- data/lib/test_sdk/types/user_with_groups_response.rb +140 -0
- data/lib/test_sdk/types/user_with_permissions_response.rb +153 -0
- data/lib/test_sdk/types/validation_error.rb +76 -0
- data/lib/test_sdk/types/validation_error_loc_item.rb +52 -0
- data/lib/test_sdk/types/weather_components.rb +123 -0
- data/lib/test_sdk/types/weather_gauge.rb +76 -0
- data/lib/test_sdk/types/weather_market_context.rb +109 -0
- data/lib/test_sdk/types/weather_metadata.rb +113 -0
- data/lib/test_sdk/unit_economics/client.rb +124 -0
- data/lib/test_sdk/user/client.rb +363 -0
- data/lib/test_sdk.rb +190 -0
- data/lib/types_export.rb +77 -0
- metadata +251 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module NewDemoApiClient
|
7
|
+
class WeatherGauge
|
8
|
+
# @return [String] The date of the data point
|
9
|
+
attr_reader :date
|
10
|
+
# @return [String] The label of the weather gauge
|
11
|
+
attr_reader :label
|
12
|
+
# @return [Float] The value of the combined weather gauge incorporating all stages at the given
|
13
|
+
# date
|
14
|
+
attr_reader :weather_gauge
|
15
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
attr_reader :additional_properties
|
17
|
+
# @return [Object]
|
18
|
+
attr_reader :_field_set
|
19
|
+
protected :_field_set
|
20
|
+
|
21
|
+
OMIT = Object.new
|
22
|
+
|
23
|
+
# @param date [String] The date of the data point
|
24
|
+
# @param label [String] The label of the weather gauge
|
25
|
+
# @param weather_gauge [Float] The value of the combined weather gauge incorporating all stages at the given
|
26
|
+
# date
|
27
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
# @return [NewDemoApiClient::WeatherGauge]
|
29
|
+
def initialize(date:, label:, weather_gauge: OMIT, additional_properties: nil)
|
30
|
+
@date = date
|
31
|
+
@label = label
|
32
|
+
@weather_gauge = weather_gauge if weather_gauge != OMIT
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
@_field_set = { "date": date, "label": label, "weather_gauge": weather_gauge }.reject do |_k, v|
|
35
|
+
v == OMIT
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of WeatherGauge
|
40
|
+
#
|
41
|
+
# @param json_object [String]
|
42
|
+
# @return [NewDemoApiClient::WeatherGauge]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
date = parsed_json["date"]
|
47
|
+
label = parsed_json["label"]
|
48
|
+
weather_gauge = parsed_json["weather_gauge"]
|
49
|
+
new(
|
50
|
+
date: date,
|
51
|
+
label: label,
|
52
|
+
weather_gauge: weather_gauge,
|
53
|
+
additional_properties: struct
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Serialize an instance of WeatherGauge to a JSON object
|
58
|
+
#
|
59
|
+
# @return [String]
|
60
|
+
def to_json(*_args)
|
61
|
+
@_field_set&.to_json
|
62
|
+
end
|
63
|
+
|
64
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
65
|
+
# hash and check each fields type against the current object's property
|
66
|
+
# definitions.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
|
72
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
73
|
+
obj.weather_gauge&.is_a?(Float) != false || raise("Passed value for field obj.weather_gauge is not the expected type, validation failed.")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module NewDemoApiClient
|
7
|
+
class WeatherMarketContext
|
8
|
+
# @return [String] The stage of the weather gauge
|
9
|
+
attr_reader :stage
|
10
|
+
# @return [String] The date of the data point
|
11
|
+
attr_reader :date
|
12
|
+
# @return [Float] A simple estimate of total amount of fundraising in the market at the stage in a
|
13
|
+
# rolling window
|
14
|
+
attr_reader :total_amount_raised_annualized
|
15
|
+
# @return [Float] A simple estimate of total count of rounds in the market at the stage in a
|
16
|
+
# rolling window
|
17
|
+
attr_reader :rounds_annualized
|
18
|
+
# @return [Float] The average number of years between raises in the market at the stage in a
|
19
|
+
# rolling window
|
20
|
+
attr_reader :average_raise_years
|
21
|
+
# @return [Float] The average amount raised in the market at the stage in a rolling window
|
22
|
+
attr_reader :average_amount_raised
|
23
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
attr_reader :additional_properties
|
25
|
+
# @return [Object]
|
26
|
+
attr_reader :_field_set
|
27
|
+
protected :_field_set
|
28
|
+
|
29
|
+
OMIT = Object.new
|
30
|
+
|
31
|
+
# @param stage [String] The stage of the weather gauge
|
32
|
+
# @param date [String] The date of the data point
|
33
|
+
# @param total_amount_raised_annualized [Float] A simple estimate of total amount of fundraising in the market at the stage in a
|
34
|
+
# rolling window
|
35
|
+
# @param rounds_annualized [Float] A simple estimate of total count of rounds in the market at the stage in a
|
36
|
+
# rolling window
|
37
|
+
# @param average_raise_years [Float] The average number of years between raises in the market at the stage in a
|
38
|
+
# rolling window
|
39
|
+
# @param average_amount_raised [Float] The average amount raised in the market at the stage in a rolling window
|
40
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
41
|
+
# @return [NewDemoApiClient::WeatherMarketContext]
|
42
|
+
def initialize(stage:, date:, total_amount_raised_annualized: OMIT, rounds_annualized: OMIT,
|
43
|
+
average_raise_years: OMIT, average_amount_raised: OMIT, additional_properties: nil)
|
44
|
+
@stage = stage
|
45
|
+
@date = date
|
46
|
+
@total_amount_raised_annualized = total_amount_raised_annualized if total_amount_raised_annualized != OMIT
|
47
|
+
@rounds_annualized = rounds_annualized if rounds_annualized != OMIT
|
48
|
+
@average_raise_years = average_raise_years if average_raise_years != OMIT
|
49
|
+
@average_amount_raised = average_amount_raised if average_amount_raised != OMIT
|
50
|
+
@additional_properties = additional_properties
|
51
|
+
@_field_set = {
|
52
|
+
"stage": stage,
|
53
|
+
"date": date,
|
54
|
+
"total_amount_raised_annualized": total_amount_raised_annualized,
|
55
|
+
"rounds_annualized": rounds_annualized,
|
56
|
+
"average_raise_years": average_raise_years,
|
57
|
+
"average_amount_raised": average_amount_raised
|
58
|
+
}.reject do |_k, v|
|
59
|
+
v == OMIT
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Deserialize a JSON object to an instance of WeatherMarketContext
|
64
|
+
#
|
65
|
+
# @param json_object [String]
|
66
|
+
# @return [NewDemoApiClient::WeatherMarketContext]
|
67
|
+
def self.from_json(json_object:)
|
68
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
69
|
+
parsed_json = JSON.parse(json_object)
|
70
|
+
stage = parsed_json["stage"]
|
71
|
+
date = parsed_json["date"]
|
72
|
+
total_amount_raised_annualized = parsed_json["total_amount_raised_annualized"]
|
73
|
+
rounds_annualized = parsed_json["rounds_annualized"]
|
74
|
+
average_raise_years = parsed_json["average_raise_years"]
|
75
|
+
average_amount_raised = parsed_json["average_amount_raised"]
|
76
|
+
new(
|
77
|
+
stage: stage,
|
78
|
+
date: date,
|
79
|
+
total_amount_raised_annualized: total_amount_raised_annualized,
|
80
|
+
rounds_annualized: rounds_annualized,
|
81
|
+
average_raise_years: average_raise_years,
|
82
|
+
average_amount_raised: average_amount_raised,
|
83
|
+
additional_properties: struct
|
84
|
+
)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Serialize an instance of WeatherMarketContext to a JSON object
|
88
|
+
#
|
89
|
+
# @return [String]
|
90
|
+
def to_json(*_args)
|
91
|
+
@_field_set&.to_json
|
92
|
+
end
|
93
|
+
|
94
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
95
|
+
# hash and check each fields type against the current object's property
|
96
|
+
# definitions.
|
97
|
+
#
|
98
|
+
# @param obj [Object]
|
99
|
+
# @return [Void]
|
100
|
+
def self.validate_raw(obj:)
|
101
|
+
obj.stage.is_a?(String) != false || raise("Passed value for field obj.stage is not the expected type, validation failed.")
|
102
|
+
obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
|
103
|
+
obj.total_amount_raised_annualized&.is_a?(Float) != false || raise("Passed value for field obj.total_amount_raised_annualized is not the expected type, validation failed.")
|
104
|
+
obj.rounds_annualized&.is_a?(Float) != false || raise("Passed value for field obj.rounds_annualized is not the expected type, validation failed.")
|
105
|
+
obj.average_raise_years&.is_a?(Float) != false || raise("Passed value for field obj.average_raise_years is not the expected type, validation failed.")
|
106
|
+
obj.average_amount_raised&.is_a?(Float) != false || raise("Passed value for field obj.average_amount_raised is not the expected type, validation failed.")
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ostruct"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module NewDemoApiClient
|
7
|
+
class WeatherMetadata
|
8
|
+
# @return [String] Slugified label for the weather indicator
|
9
|
+
attr_reader :slug
|
10
|
+
# @return [String] Label for the weather indicator
|
11
|
+
attr_reader :label
|
12
|
+
# @return [String] The segmentation type of the weather indicator
|
13
|
+
attr_reader :segmentation
|
14
|
+
# @return [String] The date of the full revision of the input data for the indicator
|
15
|
+
attr_reader :asof_date
|
16
|
+
# @return [String] The earliest date a data point in the indicator is considered valid
|
17
|
+
attr_reader :indicator_start_date
|
18
|
+
# @return [Array<String>]
|
19
|
+
attr_reader :countries
|
20
|
+
# @return [Array<String>] A list of categories the indicator covers - If null, the indicator includes all
|
21
|
+
# covered categories
|
22
|
+
attr_reader :categories
|
23
|
+
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
attr_reader :additional_properties
|
25
|
+
# @return [Object]
|
26
|
+
attr_reader :_field_set
|
27
|
+
protected :_field_set
|
28
|
+
|
29
|
+
OMIT = Object.new
|
30
|
+
|
31
|
+
# @param slug [String] Slugified label for the weather indicator
|
32
|
+
# @param label [String] Label for the weather indicator
|
33
|
+
# @param segmentation [String] The segmentation type of the weather indicator
|
34
|
+
# @param asof_date [String] The date of the full revision of the input data for the indicator
|
35
|
+
# @param indicator_start_date [String] The earliest date a data point in the indicator is considered valid
|
36
|
+
# @param countries [Array<String>]
|
37
|
+
# @param categories [Array<String>] A list of categories the indicator covers - If null, the indicator includes all
|
38
|
+
# covered categories
|
39
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
40
|
+
# @return [NewDemoApiClient::WeatherMetadata]
|
41
|
+
def initialize(slug:, label:, segmentation:, asof_date:, indicator_start_date:, countries: OMIT, categories: OMIT,
|
42
|
+
additional_properties: nil)
|
43
|
+
@slug = slug
|
44
|
+
@label = label
|
45
|
+
@segmentation = segmentation
|
46
|
+
@asof_date = asof_date
|
47
|
+
@indicator_start_date = indicator_start_date
|
48
|
+
@countries = countries if countries != OMIT
|
49
|
+
@categories = categories if categories != OMIT
|
50
|
+
@additional_properties = additional_properties
|
51
|
+
@_field_set = {
|
52
|
+
"slug": slug,
|
53
|
+
"label": label,
|
54
|
+
"segmentation": segmentation,
|
55
|
+
"asof_date": asof_date,
|
56
|
+
"indicator_start_date": indicator_start_date,
|
57
|
+
"countries": countries,
|
58
|
+
"categories": categories
|
59
|
+
}.reject do |_k, v|
|
60
|
+
v == OMIT
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Deserialize a JSON object to an instance of WeatherMetadata
|
65
|
+
#
|
66
|
+
# @param json_object [String]
|
67
|
+
# @return [NewDemoApiClient::WeatherMetadata]
|
68
|
+
def self.from_json(json_object:)
|
69
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
70
|
+
parsed_json = JSON.parse(json_object)
|
71
|
+
slug = parsed_json["slug"]
|
72
|
+
label = parsed_json["label"]
|
73
|
+
segmentation = parsed_json["segmentation"]
|
74
|
+
asof_date = parsed_json["asof_date"]
|
75
|
+
indicator_start_date = parsed_json["indicator_start_date"]
|
76
|
+
countries = parsed_json["countries"]
|
77
|
+
categories = parsed_json["categories"]
|
78
|
+
new(
|
79
|
+
slug: slug,
|
80
|
+
label: label,
|
81
|
+
segmentation: segmentation,
|
82
|
+
asof_date: asof_date,
|
83
|
+
indicator_start_date: indicator_start_date,
|
84
|
+
countries: countries,
|
85
|
+
categories: categories,
|
86
|
+
additional_properties: struct
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Serialize an instance of WeatherMetadata to a JSON object
|
91
|
+
#
|
92
|
+
# @return [String]
|
93
|
+
def to_json(*_args)
|
94
|
+
@_field_set&.to_json
|
95
|
+
end
|
96
|
+
|
97
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
98
|
+
# hash and check each fields type against the current object's property
|
99
|
+
# definitions.
|
100
|
+
#
|
101
|
+
# @param obj [Object]
|
102
|
+
# @return [Void]
|
103
|
+
def self.validate_raw(obj:)
|
104
|
+
obj.slug.is_a?(String) != false || raise("Passed value for field obj.slug is not the expected type, validation failed.")
|
105
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
106
|
+
obj.segmentation.is_a?(String) != false || raise("Passed value for field obj.segmentation is not the expected type, validation failed.")
|
107
|
+
obj.asof_date.is_a?(String) != false || raise("Passed value for field obj.asof_date is not the expected type, validation failed.")
|
108
|
+
obj.indicator_start_date.is_a?(String) != false || raise("Passed value for field obj.indicator_start_date is not the expected type, validation failed.")
|
109
|
+
obj.countries&.is_a?(Array) != false || raise("Passed value for field obj.countries is not the expected type, validation failed.")
|
110
|
+
obj.categories&.is_a?(Array) != false || raise("Passed value for field obj.categories is not the expected type, validation failed.")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "../types/user_type"
|
5
|
+
require_relative "../types/frequency"
|
6
|
+
require_relative "../types/contribution_response"
|
7
|
+
require "json"
|
8
|
+
require "async"
|
9
|
+
|
10
|
+
module NewDemoApiClient
|
11
|
+
class UnitEconomicsClient
|
12
|
+
# @return [NewDemoApiClient::RequestClient]
|
13
|
+
attr_reader :request_client
|
14
|
+
|
15
|
+
# @param request_client [NewDemoApiClient::RequestClient]
|
16
|
+
# @return [NewDemoApiClient::UnitEconomicsClient]
|
17
|
+
def initialize(request_client:)
|
18
|
+
@request_client = request_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get the contribution for the user type.
|
22
|
+
#
|
23
|
+
# @param group_id [Integer]
|
24
|
+
# @param deal_id [Integer]
|
25
|
+
# @param user_type [NewDemoApiClient::UserType]
|
26
|
+
# @param freq [NewDemoApiClient::Frequency]
|
27
|
+
# @param request_options [NewDemoApiClient::RequestOptions]
|
28
|
+
# @return [Array<NewDemoApiClient::ContributionResponse>]
|
29
|
+
# @example
|
30
|
+
# api = NewDemoApiClient::Client.new(
|
31
|
+
# base_url: "https://api.example.com",
|
32
|
+
# environment: NewDemoApiClient::Environment::DEFAULT,
|
33
|
+
# token: "YOUR_AUTH_TOKEN"
|
34
|
+
# )
|
35
|
+
# api.unit_economics.get_contribution(
|
36
|
+
# group_id: 1,
|
37
|
+
# deal_id: 1,
|
38
|
+
# user_type: BUSINESS
|
39
|
+
# )
|
40
|
+
def get_contribution(group_id:, deal_id:, user_type:, freq: nil, request_options: nil)
|
41
|
+
response = @request_client.conn.get do |req|
|
42
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
43
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
44
|
+
req.headers = {
|
45
|
+
**(req.headers || {}),
|
46
|
+
**@request_client.get_headers,
|
47
|
+
**(request_options&.additional_headers || {})
|
48
|
+
}.compact
|
49
|
+
req.params = {
|
50
|
+
**(request_options&.additional_query_parameters || {}),
|
51
|
+
"user_type": user_type,
|
52
|
+
"freq": freq
|
53
|
+
}.compact
|
54
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
55
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
56
|
+
end
|
57
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/contribution"
|
58
|
+
end
|
59
|
+
parsed_json = JSON.parse(response.body)
|
60
|
+
parsed_json&.map do |item|
|
61
|
+
item = item.to_json
|
62
|
+
NewDemoApiClient::ContributionResponse.from_json(json_object: item)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class AsyncUnitEconomicsClient
|
68
|
+
# @return [NewDemoApiClient::AsyncRequestClient]
|
69
|
+
attr_reader :request_client
|
70
|
+
|
71
|
+
# @param request_client [NewDemoApiClient::AsyncRequestClient]
|
72
|
+
# @return [NewDemoApiClient::AsyncUnitEconomicsClient]
|
73
|
+
def initialize(request_client:)
|
74
|
+
@request_client = request_client
|
75
|
+
end
|
76
|
+
|
77
|
+
# Get the contribution for the user type.
|
78
|
+
#
|
79
|
+
# @param group_id [Integer]
|
80
|
+
# @param deal_id [Integer]
|
81
|
+
# @param user_type [NewDemoApiClient::UserType]
|
82
|
+
# @param freq [NewDemoApiClient::Frequency]
|
83
|
+
# @param request_options [NewDemoApiClient::RequestOptions]
|
84
|
+
# @return [Array<NewDemoApiClient::ContributionResponse>]
|
85
|
+
# @example
|
86
|
+
# api = NewDemoApiClient::Client.new(
|
87
|
+
# base_url: "https://api.example.com",
|
88
|
+
# environment: NewDemoApiClient::Environment::DEFAULT,
|
89
|
+
# token: "YOUR_AUTH_TOKEN"
|
90
|
+
# )
|
91
|
+
# api.unit_economics.get_contribution(
|
92
|
+
# group_id: 1,
|
93
|
+
# deal_id: 1,
|
94
|
+
# user_type: BUSINESS
|
95
|
+
# )
|
96
|
+
def get_contribution(group_id:, deal_id:, user_type:, freq: nil, request_options: nil)
|
97
|
+
Async do
|
98
|
+
response = @request_client.conn.get do |req|
|
99
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
100
|
+
req.headers["Authorization"] = request_options.token unless request_options&.token.nil?
|
101
|
+
req.headers = {
|
102
|
+
**(req.headers || {}),
|
103
|
+
**@request_client.get_headers,
|
104
|
+
**(request_options&.additional_headers || {})
|
105
|
+
}.compact
|
106
|
+
req.params = {
|
107
|
+
**(request_options&.additional_query_parameters || {}),
|
108
|
+
"user_type": user_type,
|
109
|
+
"freq": freq
|
110
|
+
}.compact
|
111
|
+
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
112
|
+
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
113
|
+
end
|
114
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/api/v1/group/#{group_id}/deal/#{deal_id}/data/contribution"
|
115
|
+
end
|
116
|
+
parsed_json = JSON.parse(response.body)
|
117
|
+
parsed_json&.map do |item|
|
118
|
+
item = item.to_json
|
119
|
+
NewDemoApiClient::ContributionResponse.from_json(json_object: item)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|