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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/lib/core/file_utilities.rb +26 -0
  3. data/lib/environment.rb +7 -0
  4. data/lib/gemconfig.rb +14 -0
  5. data/lib/requests.rb +166 -0
  6. data/lib/test_sdk/benchmark/client.rb +1031 -0
  7. data/lib/test_sdk/company/client.rb +474 -0
  8. data/lib/test_sdk/deal/client.rb +584 -0
  9. data/lib/test_sdk/file/client.rb +692 -0
  10. data/lib/test_sdk/financials/client.rb +97 -0
  11. data/lib/test_sdk/group/client.rb +737 -0
  12. data/lib/test_sdk/macro/client.rb +422 -0
  13. data/lib/test_sdk/metadata/client.rb +95 -0
  14. data/lib/test_sdk/product/client.rb +419 -0
  15. data/lib/test_sdk/talent/client.rb +266 -0
  16. data/lib/test_sdk/types/account_manager_response.rb +74 -0
  17. data/lib/test_sdk/types/all_data_metadata_response.rb +68 -0
  18. data/lib/test_sdk/types/area.rb +74 -0
  19. data/lib/test_sdk/types/authenticate_api_key_response.rb +55 -0
  20. data/lib/test_sdk/types/available_categories_response.rb +5 -0
  21. data/lib/test_sdk/types/available_models_response.rb +69 -0
  22. data/lib/test_sdk/types/band_response.rb +83 -0
  23. data/lib/test_sdk/types/benchmark_quantile.rb +465 -0
  24. data/lib/test_sdk/types/categories_metadata_response.rb +72 -0
  25. data/lib/test_sdk/types/category_growth_rates.rb +143 -0
  26. data/lib/test_sdk/types/category_metadata.rb +79 -0
  27. data/lib/test_sdk/types/category_metadata_default_user_type.rb +8 -0
  28. data/lib/test_sdk/types/cohorts_response.rb +132 -0
  29. data/lib/test_sdk/types/column_metadata.rb +110 -0
  30. data/lib/test_sdk/types/column_mini_metadata.rb +83 -0
  31. data/lib/test_sdk/types/columns_metadata_response.rb +72 -0
  32. data/lib/test_sdk/types/company_response.rb +120 -0
  33. data/lib/test_sdk/types/concentration_endpoint_cdf_detail.rb +96 -0
  34. data/lib/test_sdk/types/concentration_endpoint_top_users_detail.rb +72 -0
  35. data/lib/test_sdk/types/concentration_response.rb +103 -0
  36. data/lib/test_sdk/types/concentration_timeseries_detail.rb +159 -0
  37. data/lib/test_sdk/types/contribution_response.rb +135 -0
  38. data/lib/test_sdk/types/create_api_key_response.rb +55 -0
  39. data/lib/test_sdk/types/create_file_for_signed_url_response.rb +127 -0
  40. data/lib/test_sdk/types/create_file_response.rb +113 -0
  41. data/lib/test_sdk/types/deal_combined_metrics_response.rb +477 -0
  42. data/lib/test_sdk/types/deal_data_availablity_response.rb +109 -0
  43. data/lib/test_sdk/types/deal_with_files_response.rb +194 -0
  44. data/lib/test_sdk/types/endpoint_seniority_count.rb +66 -0
  45. data/lib/test_sdk/types/executive_profile.rb +91 -0
  46. data/lib/test_sdk/types/executive_profile_position.rb +97 -0
  47. data/lib/test_sdk/types/file_response.rb +113 -0
  48. data/lib/test_sdk/types/file_type.rb +14 -0
  49. data/lib/test_sdk/types/financial_metrics.rb +113 -0
  50. data/lib/test_sdk/types/financials_response.rb +102 -0
  51. data/lib/test_sdk/types/frequency.rb +9 -0
  52. data/lib/test_sdk/types/function_level_growth_accounting.rb +111 -0
  53. data/lib/test_sdk/types/gcs_signed_url_response.rb +81 -0
  54. data/lib/test_sdk/types/group_response.rb +158 -0
  55. data/lib/test_sdk/types/group_user.rb +124 -0
  56. data/lib/test_sdk/types/group_with_users_response.rb +170 -0
  57. data/lib/test_sdk/types/growth_accounting_response.rb +226 -0
  58. data/lib/test_sdk/types/healthz_response.rb +55 -0
  59. data/lib/test_sdk/types/http_validation_error.rb +61 -0
  60. data/lib/test_sdk/types/income_statement_entry.rb +81 -0
  61. data/lib/test_sdk/types/model_metadata.rb +76 -0
  62. data/lib/test_sdk/types/models_metadata_response.rb +76 -0
  63. data/lib/test_sdk/types/paginated_response_company_response.rb +83 -0
  64. data/lib/test_sdk/types/paginated_response_deal_with_files_response.rb +84 -0
  65. data/lib/test_sdk/types/paginated_response_file_response.rb +83 -0
  66. data/lib/test_sdk/types/paginated_response_group_user.rb +83 -0
  67. data/lib/test_sdk/types/permission_model.rb +65 -0
  68. data/lib/test_sdk/types/priority.rb +10 -0
  69. data/lib/test_sdk/types/product_info_response.rb +65 -0
  70. data/lib/test_sdk/types/role_response.rb +95 -0
  71. data/lib/test_sdk/types/scale.rb +72 -0
  72. data/lib/test_sdk/types/scale_model.rb +80 -0
  73. data/lib/test_sdk/types/scale_models_response.rb +5 -0
  74. data/lib/test_sdk/types/scaling.rb +10 -0
  75. data/lib/test_sdk/types/status.rb +12 -0
  76. data/lib/test_sdk/types/tradeoff_model.rb +95 -0
  77. data/lib/test_sdk/types/tradeoff_models_response.rb +5 -0
  78. data/lib/test_sdk/types/unit.rb +12 -0
  79. data/lib/test_sdk/types/unit_economics_info_response.rb +55 -0
  80. data/lib/test_sdk/types/user_accounting_response.rb +168 -0
  81. data/lib/test_sdk/types/user_role_response.rb +77 -0
  82. data/lib/test_sdk/types/user_type.rb +12 -0
  83. data/lib/test_sdk/types/user_with_groups_response.rb +140 -0
  84. data/lib/test_sdk/types/user_with_permissions_response.rb +153 -0
  85. data/lib/test_sdk/types/validation_error.rb +76 -0
  86. data/lib/test_sdk/types/validation_error_loc_item.rb +52 -0
  87. data/lib/test_sdk/types/weather_components.rb +123 -0
  88. data/lib/test_sdk/types/weather_gauge.rb +76 -0
  89. data/lib/test_sdk/types/weather_market_context.rb +109 -0
  90. data/lib/test_sdk/types/weather_metadata.rb +113 -0
  91. data/lib/test_sdk/unit_economics/client.rb +124 -0
  92. data/lib/test_sdk/user/client.rb +363 -0
  93. data/lib/test_sdk.rb +190 -0
  94. data/lib/types_export.rb +77 -0
  95. metadata +251 -0
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "date"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module NewDemoApiClient
8
+ class CompanyResponse
9
+ # @return [String]
10
+ attr_reader :name
11
+ # @return [String] The domain of the company
12
+ attr_reader :domain
13
+ # @return [String] The thumbnail URL of the company
14
+ attr_reader :thumbnail
15
+ # @return [Integer]
16
+ attr_reader :id
17
+ # @return [DateTime]
18
+ attr_reader :created_at
19
+ # @return [DateTime]
20
+ attr_reader :updated_at
21
+ # @return [Boolean]
22
+ attr_reader :is_archived
23
+ # @return [Integer]
24
+ attr_reader :group_id
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param name [String]
34
+ # @param domain [String] The domain of the company
35
+ # @param thumbnail [String] The thumbnail URL of the company
36
+ # @param id [Integer]
37
+ # @param created_at [DateTime]
38
+ # @param updated_at [DateTime]
39
+ # @param is_archived [Boolean]
40
+ # @param group_id [Integer]
41
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
42
+ # @return [NewDemoApiClient::CompanyResponse]
43
+ def initialize(name:, domain:, id:, group_id:, thumbnail: OMIT, created_at: OMIT, updated_at: OMIT,
44
+ is_archived: OMIT, additional_properties: nil)
45
+ @name = name
46
+ @domain = domain
47
+ @thumbnail = thumbnail if thumbnail != OMIT
48
+ @id = id
49
+ @created_at = created_at if created_at != OMIT
50
+ @updated_at = updated_at if updated_at != OMIT
51
+ @is_archived = is_archived if is_archived != OMIT
52
+ @group_id = group_id
53
+ @additional_properties = additional_properties
54
+ @_field_set = {
55
+ "name": name,
56
+ "domain": domain,
57
+ "thumbnail": thumbnail,
58
+ "id": id,
59
+ "created_at": created_at,
60
+ "updated_at": updated_at,
61
+ "is_archived": is_archived,
62
+ "group_id": group_id
63
+ }.reject do |_k, v|
64
+ v == OMIT
65
+ end
66
+ end
67
+
68
+ # Deserialize a JSON object to an instance of CompanyResponse
69
+ #
70
+ # @param json_object [String]
71
+ # @return [NewDemoApiClient::CompanyResponse]
72
+ def self.from_json(json_object:)
73
+ struct = JSON.parse(json_object, object_class: OpenStruct)
74
+ parsed_json = JSON.parse(json_object)
75
+ name = parsed_json["name"]
76
+ domain = parsed_json["domain"]
77
+ thumbnail = parsed_json["thumbnail"]
78
+ id = parsed_json["id"]
79
+ created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?)
80
+ updated_at = (DateTime.parse(parsed_json["updated_at"]) unless parsed_json["updated_at"].nil?)
81
+ is_archived = parsed_json["is_archived"]
82
+ group_id = parsed_json["group_id"]
83
+ new(
84
+ name: name,
85
+ domain: domain,
86
+ thumbnail: thumbnail,
87
+ id: id,
88
+ created_at: created_at,
89
+ updated_at: updated_at,
90
+ is_archived: is_archived,
91
+ group_id: group_id,
92
+ additional_properties: struct
93
+ )
94
+ end
95
+
96
+ # Serialize an instance of CompanyResponse to a JSON object
97
+ #
98
+ # @return [String]
99
+ def to_json(*_args)
100
+ @_field_set&.to_json
101
+ end
102
+
103
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
104
+ # hash and check each fields type against the current object's property
105
+ # definitions.
106
+ #
107
+ # @param obj [Object]
108
+ # @return [Void]
109
+ def self.validate_raw(obj:)
110
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
111
+ obj.domain.is_a?(String) != false || raise("Passed value for field obj.domain is not the expected type, validation failed.")
112
+ obj.thumbnail&.is_a?(String) != false || raise("Passed value for field obj.thumbnail is not the expected type, validation failed.")
113
+ obj.id.is_a?(Integer) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
114
+ obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
115
+ obj.updated_at&.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
116
+ obj.is_archived&.is_a?(Boolean) != false || raise("Passed value for field obj.is_archived is not the expected type, validation failed.")
117
+ obj.group_id.is_a?(Integer) != false || raise("Passed value for field obj.group_id is not the expected type, validation failed.")
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module NewDemoApiClient
7
+ class ConcentrationEndpointCdfDetail
8
+ # @return [String] The method used. When 'top_user', the value represents the CDF at the exact
9
+ # value of a top user. When 'distribution_quantile', the value represents the CDF
10
+ # at an approximately evenly spaced quantile.
11
+ attr_reader :method
12
+ # @return [Float] The amount for the CDF.
13
+ attr_reader :amount
14
+ # @return [Float] The cumulative distribution function of the users, sorted smallest to largest.
15
+ # This evenly weights users by count, and represents (1 - top quantile) of the
16
+ # user
17
+ attr_reader :cdf_users
18
+ # @return [Float] The cumulative distribution function of the amount, sorted smallest to largest.
19
+ # This tells us what percentage of all amount is held by the bottom x% of users.
20
+ attr_reader :cdf_amount
21
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
22
+ attr_reader :additional_properties
23
+ # @return [Object]
24
+ attr_reader :_field_set
25
+ protected :_field_set
26
+
27
+ OMIT = Object.new
28
+
29
+ # @param method [String] The method used. When 'top_user', the value represents the CDF at the exact
30
+ # value of a top user. When 'distribution_quantile', the value represents the CDF
31
+ # at an approximately evenly spaced quantile.
32
+ # @param amount [Float] The amount for the CDF.
33
+ # @param cdf_users [Float] The cumulative distribution function of the users, sorted smallest to largest.
34
+ # This evenly weights users by count, and represents (1 - top quantile) of the
35
+ # user
36
+ # @param cdf_amount [Float] The cumulative distribution function of the amount, sorted smallest to largest.
37
+ # This tells us what percentage of all amount is held by the bottom x% of users.
38
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
39
+ # @return [NewDemoApiClient::ConcentrationEndpointCdfDetail]
40
+ def initialize(method:, amount:, cdf_users: OMIT, cdf_amount: OMIT, additional_properties: nil)
41
+ @method = method
42
+ @amount = amount
43
+ @cdf_users = cdf_users if cdf_users != OMIT
44
+ @cdf_amount = cdf_amount if cdf_amount != OMIT
45
+ @additional_properties = additional_properties
46
+ @_field_set = {
47
+ "method": method,
48
+ "amount": amount,
49
+ "cdf_users": cdf_users,
50
+ "cdf_amount": cdf_amount
51
+ }.reject do |_k, v|
52
+ v == OMIT
53
+ end
54
+ end
55
+
56
+ # Deserialize a JSON object to an instance of ConcentrationEndpointCdfDetail
57
+ #
58
+ # @param json_object [String]
59
+ # @return [NewDemoApiClient::ConcentrationEndpointCdfDetail]
60
+ def self.from_json(json_object:)
61
+ struct = JSON.parse(json_object, object_class: OpenStruct)
62
+ parsed_json = JSON.parse(json_object)
63
+ method = parsed_json["method"]
64
+ amount = parsed_json["amount"]
65
+ cdf_users = parsed_json["cdf_users"]
66
+ cdf_amount = parsed_json["cdf_amount"]
67
+ new(
68
+ method: method,
69
+ amount: amount,
70
+ cdf_users: cdf_users,
71
+ cdf_amount: cdf_amount,
72
+ additional_properties: struct
73
+ )
74
+ end
75
+
76
+ # Serialize an instance of ConcentrationEndpointCdfDetail to a JSON object
77
+ #
78
+ # @return [String]
79
+ def to_json(*_args)
80
+ @_field_set&.to_json
81
+ end
82
+
83
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
84
+ # hash and check each fields type against the current object's property
85
+ # definitions.
86
+ #
87
+ # @param obj [Object]
88
+ # @return [Void]
89
+ def self.validate_raw(obj:)
90
+ obj.method.is_a?(String) != false || raise("Passed value for field obj.method is not the expected type, validation failed.")
91
+ obj.amount.is_a?(Float) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.")
92
+ obj.cdf_users&.is_a?(Float) != false || raise("Passed value for field obj.cdf_users is not the expected type, validation failed.")
93
+ obj.cdf_amount&.is_a?(Float) != false || raise("Passed value for field obj.cdf_amount is not the expected type, validation failed.")
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module NewDemoApiClient
7
+ class ConcentrationEndpointTopUsersDetail
8
+ # @return [String] The user identifier.
9
+ attr_reader :user_id
10
+ # @return [Float] The amount for the user.
11
+ attr_reader :amount
12
+ # @return [Float] The pdf of the total amount for the user.
13
+ attr_reader :amount_percent
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param user_id [String] The user identifier.
23
+ # @param amount [Float] The amount for the user.
24
+ # @param amount_percent [Float] The pdf of the total amount for the user.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [NewDemoApiClient::ConcentrationEndpointTopUsersDetail]
27
+ def initialize(user_id:, amount:, amount_percent:, additional_properties: nil)
28
+ @user_id = user_id
29
+ @amount = amount
30
+ @amount_percent = amount_percent
31
+ @additional_properties = additional_properties
32
+ @_field_set = { "user_id": user_id, "amount": amount, "amount_percent": amount_percent }
33
+ end
34
+
35
+ # Deserialize a JSON object to an instance of ConcentrationEndpointTopUsersDetail
36
+ #
37
+ # @param json_object [String]
38
+ # @return [NewDemoApiClient::ConcentrationEndpointTopUsersDetail]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ user_id = parsed_json["user_id"]
43
+ amount = parsed_json["amount"]
44
+ amount_percent = parsed_json["amount_percent"]
45
+ new(
46
+ user_id: user_id,
47
+ amount: amount,
48
+ amount_percent: amount_percent,
49
+ additional_properties: struct
50
+ )
51
+ end
52
+
53
+ # Serialize an instance of ConcentrationEndpointTopUsersDetail to a JSON object
54
+ #
55
+ # @return [String]
56
+ def to_json(*_args)
57
+ @_field_set&.to_json
58
+ end
59
+
60
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
61
+ # hash and check each fields type against the current object's property
62
+ # definitions.
63
+ #
64
+ # @param obj [Object]
65
+ # @return [Void]
66
+ def self.validate_raw(obj:)
67
+ obj.user_id.is_a?(String) != false || raise("Passed value for field obj.user_id is not the expected type, validation failed.")
68
+ obj.amount.is_a?(Float) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.")
69
+ obj.amount_percent.is_a?(Float) != false || raise("Passed value for field obj.amount_percent is not the expected type, validation failed.")
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "concentration_timeseries_detail"
4
+ require_relative "concentration_endpoint_top_users_detail"
5
+ require_relative "concentration_endpoint_cdf_detail"
6
+ require "ostruct"
7
+ require "json"
8
+
9
+ module NewDemoApiClient
10
+ # A collection of concentration measurements of the amount.
11
+ # The "amount" is a generic term for the metric being measured, such as revenue or
12
+ # gtv.
13
+ class ConcentrationResponse
14
+ # @return [Array<NewDemoApiClient::ConcentrationTimeseriesDetail>] The time series metrics for the concentration of the amount. The top 5, 10, and
15
+ # 20 users are shown, as well as the top 10% and 20% of users, and some other
16
+ # supporting aggregate concentration metrics.
17
+ attr_reader :time_series_metrics
18
+ # @return [Array<NewDemoApiClient::ConcentrationEndpointTopUsersDetail>] Detail for the top users at the endpoint. Up to the top 100 users are show.
19
+ attr_reader :endpoint_top_users
20
+ # @return [Array<NewDemoApiClient::ConcentrationEndpointCdfDetail>] The detailed cumulative distribution function (CDF). The CDF is presented at the
21
+ # top 100 users, and beyond that it is presented at approximately evenly spaced
22
+ # quantiles. This approach enables robustness to extremely large user bases. The
23
+ # CDF is presented for both users and amount.
24
+ attr_reader :endpoint_cdf
25
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
26
+ attr_reader :additional_properties
27
+ # @return [Object]
28
+ attr_reader :_field_set
29
+ protected :_field_set
30
+
31
+ OMIT = Object.new
32
+
33
+ # @param time_series_metrics [Array<NewDemoApiClient::ConcentrationTimeseriesDetail>] The time series metrics for the concentration of the amount. The top 5, 10, and
34
+ # 20 users are shown, as well as the top 10% and 20% of users, and some other
35
+ # supporting aggregate concentration metrics.
36
+ # @param endpoint_top_users [Array<NewDemoApiClient::ConcentrationEndpointTopUsersDetail>] Detail for the top users at the endpoint. Up to the top 100 users are show.
37
+ # @param endpoint_cdf [Array<NewDemoApiClient::ConcentrationEndpointCdfDetail>] The detailed cumulative distribution function (CDF). The CDF is presented at the
38
+ # top 100 users, and beyond that it is presented at approximately evenly spaced
39
+ # quantiles. This approach enables robustness to extremely large user bases. The
40
+ # CDF is presented for both users and amount.
41
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
42
+ # @return [NewDemoApiClient::ConcentrationResponse]
43
+ def initialize(time_series_metrics: OMIT, endpoint_top_users: OMIT, endpoint_cdf: OMIT, additional_properties: nil)
44
+ @time_series_metrics = time_series_metrics if time_series_metrics != OMIT
45
+ @endpoint_top_users = endpoint_top_users if endpoint_top_users != OMIT
46
+ @endpoint_cdf = endpoint_cdf if endpoint_cdf != OMIT
47
+ @additional_properties = additional_properties
48
+ @_field_set = {
49
+ "time_series_metrics": time_series_metrics,
50
+ "endpoint_top_users": endpoint_top_users,
51
+ "endpoint_cdf": endpoint_cdf
52
+ }.reject do |_k, v|
53
+ v == OMIT
54
+ end
55
+ end
56
+
57
+ # Deserialize a JSON object to an instance of ConcentrationResponse
58
+ #
59
+ # @param json_object [String]
60
+ # @return [NewDemoApiClient::ConcentrationResponse]
61
+ def self.from_json(json_object:)
62
+ struct = JSON.parse(json_object, object_class: OpenStruct)
63
+ parsed_json = JSON.parse(json_object)
64
+ time_series_metrics = parsed_json["time_series_metrics"]&.map do |item|
65
+ item = item.to_json
66
+ NewDemoApiClient::ConcentrationTimeseriesDetail.from_json(json_object: item)
67
+ end
68
+ endpoint_top_users = parsed_json["endpoint_top_users"]&.map do |item|
69
+ item = item.to_json
70
+ NewDemoApiClient::ConcentrationEndpointTopUsersDetail.from_json(json_object: item)
71
+ end
72
+ endpoint_cdf = parsed_json["endpoint_cdf"]&.map do |item|
73
+ item = item.to_json
74
+ NewDemoApiClient::ConcentrationEndpointCdfDetail.from_json(json_object: item)
75
+ end
76
+ new(
77
+ time_series_metrics: time_series_metrics,
78
+ endpoint_top_users: endpoint_top_users,
79
+ endpoint_cdf: endpoint_cdf,
80
+ additional_properties: struct
81
+ )
82
+ end
83
+
84
+ # Serialize an instance of ConcentrationResponse to a JSON object
85
+ #
86
+ # @return [String]
87
+ def to_json(*_args)
88
+ @_field_set&.to_json
89
+ end
90
+
91
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
92
+ # hash and check each fields type against the current object's property
93
+ # definitions.
94
+ #
95
+ # @param obj [Object]
96
+ # @return [Void]
97
+ def self.validate_raw(obj:)
98
+ obj.time_series_metrics&.is_a?(Array) != false || raise("Passed value for field obj.time_series_metrics is not the expected type, validation failed.")
99
+ obj.endpoint_top_users&.is_a?(Array) != false || raise("Passed value for field obj.endpoint_top_users is not the expected type, validation failed.")
100
+ obj.endpoint_cdf&.is_a?(Array) != false || raise("Passed value for field obj.endpoint_cdf is not the expected type, validation failed.")
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,159 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module NewDemoApiClient
7
+ class ConcentrationTimeseriesDetail
8
+ # @return [String] The date of the entry.
9
+ attr_reader :date
10
+ # @return [Float] The share of amount in the top 5 users.
11
+ attr_reader :top5count
12
+ # @return [Float] The share of amount in the top 10 users.
13
+ attr_reader :top10count
14
+ # @return [Float] The share of amount in the top 20 users.
15
+ attr_reader :top20count
16
+ # @return [Float] The share of amount in the top 10% of users.
17
+ attr_reader :top10percent
18
+ # @return [Float] The share of amount in the top 20% of users.
19
+ attr_reader :top20percent
20
+ # @return [Float] The mean amount in the period.
21
+ attr_reader :mean
22
+ # @return [Float] The 25th percentile of the amount in the period.
23
+ attr_reader :p25
24
+ # @return [Float] The 50th percentile of the amount in the period.
25
+ attr_reader :median
26
+ # @return [Float] The 75th percentile of the amount in the period.
27
+ attr_reader :p75
28
+ # @return [Float] The 90th percentile of the amount in the period.
29
+ attr_reader :p90
30
+ # @return [Float] The ratio of the mean to the median amount in the period.
31
+ attr_reader :average_to_median
32
+ # @return [Float] The Gini coefficient of the amount in the period, ranging from 0 to 1.
33
+ attr_reader :gini_coefficient
34
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
35
+ attr_reader :additional_properties
36
+ # @return [Object]
37
+ attr_reader :_field_set
38
+ protected :_field_set
39
+
40
+ OMIT = Object.new
41
+
42
+ # @param date [String] The date of the entry.
43
+ # @param top5count [Float] The share of amount in the top 5 users.
44
+ # @param top10count [Float] The share of amount in the top 10 users.
45
+ # @param top20count [Float] The share of amount in the top 20 users.
46
+ # @param top10percent [Float] The share of amount in the top 10% of users.
47
+ # @param top20percent [Float] The share of amount in the top 20% of users.
48
+ # @param mean [Float] The mean amount in the period.
49
+ # @param p25 [Float] The 25th percentile of the amount in the period.
50
+ # @param median [Float] The 50th percentile of the amount in the period.
51
+ # @param p75 [Float] The 75th percentile of the amount in the period.
52
+ # @param p90 [Float] The 90th percentile of the amount in the period.
53
+ # @param average_to_median [Float] The ratio of the mean to the median amount in the period.
54
+ # @param gini_coefficient [Float] The Gini coefficient of the amount in the period, ranging from 0 to 1.
55
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
56
+ # @return [NewDemoApiClient::ConcentrationTimeseriesDetail]
57
+ def initialize(date:, top5count: OMIT, top10count: OMIT, top20count: OMIT, top10percent: OMIT, top20percent: OMIT,
58
+ mean: OMIT, p25: OMIT, median: OMIT, p75: OMIT, p90: OMIT, average_to_median: OMIT, gini_coefficient: OMIT, additional_properties: nil)
59
+ @date = date
60
+ @top5count = top5count if top5count != OMIT
61
+ @top10count = top10count if top10count != OMIT
62
+ @top20count = top20count if top20count != OMIT
63
+ @top10percent = top10percent if top10percent != OMIT
64
+ @top20percent = top20percent if top20percent != OMIT
65
+ @mean = mean if mean != OMIT
66
+ @p25 = p25 if p25 != OMIT
67
+ @median = median if median != OMIT
68
+ @p75 = p75 if p75 != OMIT
69
+ @p90 = p90 if p90 != OMIT
70
+ @average_to_median = average_to_median if average_to_median != OMIT
71
+ @gini_coefficient = gini_coefficient if gini_coefficient != OMIT
72
+ @additional_properties = additional_properties
73
+ @_field_set = {
74
+ "date": date,
75
+ "top_5_count": top5count,
76
+ "top_10_count": top10count,
77
+ "top_20_count": top20count,
78
+ "top_10_percent": top10percent,
79
+ "top_20_percent": top20percent,
80
+ "mean": mean,
81
+ "p25": p25,
82
+ "median": median,
83
+ "p75": p75,
84
+ "p90": p90,
85
+ "average_to_median": average_to_median,
86
+ "gini_coefficient": gini_coefficient
87
+ }.reject do |_k, v|
88
+ v == OMIT
89
+ end
90
+ end
91
+
92
+ # Deserialize a JSON object to an instance of ConcentrationTimeseriesDetail
93
+ #
94
+ # @param json_object [String]
95
+ # @return [NewDemoApiClient::ConcentrationTimeseriesDetail]
96
+ def self.from_json(json_object:)
97
+ struct = JSON.parse(json_object, object_class: OpenStruct)
98
+ parsed_json = JSON.parse(json_object)
99
+ date = parsed_json["date"]
100
+ top5count = parsed_json["top_5_count"]
101
+ top10count = parsed_json["top_10_count"]
102
+ top20count = parsed_json["top_20_count"]
103
+ top10percent = parsed_json["top_10_percent"]
104
+ top20percent = parsed_json["top_20_percent"]
105
+ mean = parsed_json["mean"]
106
+ p25 = parsed_json["p25"]
107
+ median = parsed_json["median"]
108
+ p75 = parsed_json["p75"]
109
+ p90 = parsed_json["p90"]
110
+ average_to_median = parsed_json["average_to_median"]
111
+ gini_coefficient = parsed_json["gini_coefficient"]
112
+ new(
113
+ date: date,
114
+ top5count: top5count,
115
+ top10count: top10count,
116
+ top20count: top20count,
117
+ top10percent: top10percent,
118
+ top20percent: top20percent,
119
+ mean: mean,
120
+ p25: p25,
121
+ median: median,
122
+ p75: p75,
123
+ p90: p90,
124
+ average_to_median: average_to_median,
125
+ gini_coefficient: gini_coefficient,
126
+ additional_properties: struct
127
+ )
128
+ end
129
+
130
+ # Serialize an instance of ConcentrationTimeseriesDetail to a JSON object
131
+ #
132
+ # @return [String]
133
+ def to_json(*_args)
134
+ @_field_set&.to_json
135
+ end
136
+
137
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
138
+ # hash and check each fields type against the current object's property
139
+ # definitions.
140
+ #
141
+ # @param obj [Object]
142
+ # @return [Void]
143
+ def self.validate_raw(obj:)
144
+ obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
145
+ obj.top5count&.is_a?(Float) != false || raise("Passed value for field obj.top5count is not the expected type, validation failed.")
146
+ obj.top10count&.is_a?(Float) != false || raise("Passed value for field obj.top10count is not the expected type, validation failed.")
147
+ obj.top20count&.is_a?(Float) != false || raise("Passed value for field obj.top20count is not the expected type, validation failed.")
148
+ obj.top10percent&.is_a?(Float) != false || raise("Passed value for field obj.top10percent is not the expected type, validation failed.")
149
+ obj.top20percent&.is_a?(Float) != false || raise("Passed value for field obj.top20percent is not the expected type, validation failed.")
150
+ obj.mean&.is_a?(Float) != false || raise("Passed value for field obj.mean is not the expected type, validation failed.")
151
+ obj.p25&.is_a?(Float) != false || raise("Passed value for field obj.p25 is not the expected type, validation failed.")
152
+ obj.median&.is_a?(Float) != false || raise("Passed value for field obj.median is not the expected type, validation failed.")
153
+ obj.p75&.is_a?(Float) != false || raise("Passed value for field obj.p75 is not the expected type, validation failed.")
154
+ obj.p90&.is_a?(Float) != false || raise("Passed value for field obj.p90 is not the expected type, validation failed.")
155
+ obj.average_to_median&.is_a?(Float) != false || raise("Passed value for field obj.average_to_median is not the expected type, validation failed.")
156
+ obj.gini_coefficient&.is_a?(Float) != false || raise("Passed value for field obj.gini_coefficient is not the expected type, validation failed.")
157
+ end
158
+ end
159
+ end