Class: NewDemoApiClient::ConcentrationResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/test_sdk/types/concentration_response.rb

Overview

A collection of concentration measurements of the amount.

The "amount" is a generic term for the metric being measured, such as revenue or
gtv.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time_series_metrics: OMIT, endpoint_top_users: OMIT, endpoint_cdf: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationResponse

Parameters:

  • time_series_metrics (Array<NewDemoApiClient::ConcentrationTimeseriesDetail>) (defaults to: OMIT)

    The time series metrics for the concentration of the amount. The top 5, 10, and 20 users are shown, as well as the top 10% and 20% of users, and some other supporting aggregate concentration metrics.

  • endpoint_top_users (Array<NewDemoApiClient::ConcentrationEndpointTopUsersDetail>) (defaults to: OMIT)

    Detail for the top users at the endpoint. Up to the top 100 users are show.

  • endpoint_cdf (Array<NewDemoApiClient::ConcentrationEndpointCdfDetail>) (defaults to: OMIT)

    The detailed cumulative distribution function (CDF). The CDF is presented at the top 100 users, and beyond that it is presented at approximately evenly spaced quantiles. This approach enables robustness to extremely large user bases. The CDF is presented for both users and amount.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/test_sdk/types/concentration_response.rb', line 43

def initialize(time_series_metrics: OMIT, endpoint_top_users: OMIT, endpoint_cdf: OMIT, additional_properties: nil)
  @time_series_metrics = time_series_metrics if time_series_metrics != OMIT
  @endpoint_top_users = endpoint_top_users if endpoint_top_users != OMIT
  @endpoint_cdf = endpoint_cdf if endpoint_cdf != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "time_series_metrics": time_series_metrics,
    "endpoint_top_users": endpoint_top_users,
    "endpoint_cdf": endpoint_cdf
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



26
27
28
# File 'lib/test_sdk/types/concentration_response.rb', line 26

def additional_properties
  @additional_properties
end

#endpoint_cdfArray<NewDemoApiClient::ConcentrationEndpointCdfDetail> (readonly)

Returns The detailed cumulative distribution function (CDF). The CDF is presented at the top 100 users, and beyond that it is presented at approximately evenly spaced quantiles. This approach enables robustness to extremely large user bases. The CDF is presented for both users and amount.

Returns:

  • (Array<NewDemoApiClient::ConcentrationEndpointCdfDetail>)

    The detailed cumulative distribution function (CDF). The CDF is presented at the top 100 users, and beyond that it is presented at approximately evenly spaced quantiles. This approach enables robustness to extremely large user bases. The CDF is presented for both users and amount.



24
25
26
# File 'lib/test_sdk/types/concentration_response.rb', line 24

def endpoint_cdf
  @endpoint_cdf
end

#endpoint_top_usersArray<NewDemoApiClient::ConcentrationEndpointTopUsersDetail> (readonly)

Returns Detail for the top users at the endpoint. Up to the top 100 users are show.

Returns:



19
20
21
# File 'lib/test_sdk/types/concentration_response.rb', line 19

def endpoint_top_users
  @endpoint_top_users
end

#time_series_metricsArray<NewDemoApiClient::ConcentrationTimeseriesDetail> (readonly)

Returns The time series metrics for the concentration of the amount. The top 5, 10, and 20 users are shown, as well as the top 10% and 20% of users, and some other supporting aggregate concentration metrics.

Returns:

  • (Array<NewDemoApiClient::ConcentrationTimeseriesDetail>)

    The time series metrics for the concentration of the amount. The top 5, 10, and 20 users are shown, as well as the top 10% and 20% of users, and some other supporting aggregate concentration metrics.



17
18
19
# File 'lib/test_sdk/types/concentration_response.rb', line 17

def time_series_metrics
  @time_series_metrics
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationResponse

Deserialize a JSON object to an instance of ConcentrationResponse

Parameters:

  • json_object (String)

Returns:



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/test_sdk/types/concentration_response.rb', line 61

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  time_series_metrics = parsed_json["time_series_metrics"]&.map do |item|
    item = item.to_json
    NewDemoApiClient::ConcentrationTimeseriesDetail.from_json(json_object: item)
  end
  endpoint_top_users = parsed_json["endpoint_top_users"]&.map do |item|
    item = item.to_json
    NewDemoApiClient::ConcentrationEndpointTopUsersDetail.from_json(json_object: item)
  end
  endpoint_cdf = parsed_json["endpoint_cdf"]&.map do |item|
    item = item.to_json
    NewDemoApiClient::ConcentrationEndpointCdfDetail.from_json(json_object: item)
  end
  new(
    time_series_metrics: time_series_metrics,
    endpoint_top_users: endpoint_top_users,
    endpoint_cdf: endpoint_cdf,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


97
98
99
100
101
# File 'lib/test_sdk/types/concentration_response.rb', line 97

def self.validate_raw(obj:)
  obj.time_series_metrics&.is_a?(Array) != false || raise("Passed value for field obj.time_series_metrics is not the expected type, validation failed.")
  obj.endpoint_top_users&.is_a?(Array) != false || raise("Passed value for field obj.endpoint_top_users is not the expected type, validation failed.")
  obj.endpoint_cdf&.is_a?(Array) != false || raise("Passed value for field obj.endpoint_cdf is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ConcentrationResponse to a JSON object

Returns:

  • (String)


87
88
89
# File 'lib/test_sdk/types/concentration_response.rb', line 87

def to_json(*_args)
  @_field_set&.to_json
end