Class: NewDemoApiClient::ConcentrationTimeseriesDetail

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date:, top5count: OMIT, top10count: OMIT, top20count: OMIT, top10percent: OMIT, top20percent: OMIT, mean: OMIT, p25: OMIT, median: OMIT, p75: OMIT, p90: OMIT, average_to_median: OMIT, gini_coefficient: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::ConcentrationTimeseriesDetail

Parameters:

  • date (String)

    The date of the entry.

  • top5count (Float) (defaults to: OMIT)

    The share of amount in the top 5 users.

  • top10count (Float) (defaults to: OMIT)

    The share of amount in the top 10 users.

  • top20count (Float) (defaults to: OMIT)

    The share of amount in the top 20 users.

  • top10percent (Float) (defaults to: OMIT)

    The share of amount in the top 10% of users.

  • top20percent (Float) (defaults to: OMIT)

    The share of amount in the top 20% of users.

  • mean (Float) (defaults to: OMIT)

    The mean amount in the period.

  • p25 (Float) (defaults to: OMIT)

    The 25th percentile of the amount in the period.

  • median (Float) (defaults to: OMIT)

    The 50th percentile of the amount in the period.

  • p75 (Float) (defaults to: OMIT)

    The 75th percentile of the amount in the period.

  • p90 (Float) (defaults to: OMIT)

    The 90th percentile of the amount in the period.

  • average_to_median (Float) (defaults to: OMIT)

    The ratio of the mean to the median amount in the period.

  • gini_coefficient (Float) (defaults to: OMIT)

    The Gini coefficient of the amount in the period, ranging from 0 to 1.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 57

def initialize(date:, top5count: OMIT, top10count: OMIT, top20count: OMIT, top10percent: OMIT, top20percent: OMIT,
               mean: OMIT, p25: OMIT, median: OMIT, p75: OMIT, p90: OMIT, average_to_median: OMIT, gini_coefficient: OMIT, additional_properties: nil)
  @date = date
  @top5count = top5count if top5count != OMIT
  @top10count = top10count if top10count != OMIT
  @top20count = top20count if top20count != OMIT
  @top10percent = top10percent if top10percent != OMIT
  @top20percent = top20percent if top20percent != OMIT
  @mean = mean if mean != OMIT
  @p25 = p25 if p25 != OMIT
  @median = median if median != OMIT
  @p75 = p75 if p75 != OMIT
  @p90 = p90 if p90 != OMIT
  @average_to_median = average_to_median if average_to_median != OMIT
  @gini_coefficient = gini_coefficient if gini_coefficient != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "date": date,
    "top_5_count": top5count,
    "top_10_count": top10count,
    "top_20_count": top20count,
    "top_10_percent": top10percent,
    "top_20_percent": top20percent,
    "mean": mean,
    "p25": p25,
    "median": median,
    "p75": p75,
    "p90": p90,
    "average_to_median": average_to_median,
    "gini_coefficient": gini_coefficient
  }.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



35
36
37
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 35

def additional_properties
  @additional_properties
end

#average_to_medianFloat (readonly)

Returns The ratio of the mean to the median amount in the period.

Returns:

  • (Float)

    The ratio of the mean to the median amount in the period.



31
32
33
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 31

def average_to_median
  @average_to_median
end

#dateString (readonly)

Returns The date of the entry.

Returns:

  • (String)

    The date of the entry.



9
10
11
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 9

def date
  @date
end

#gini_coefficientFloat (readonly)

Returns The Gini coefficient of the amount in the period, ranging from 0 to 1.

Returns:

  • (Float)

    The Gini coefficient of the amount in the period, ranging from 0 to 1.



33
34
35
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 33

def gini_coefficient
  @gini_coefficient
end

#meanFloat (readonly)

Returns The mean amount in the period.

Returns:

  • (Float)

    The mean amount in the period.



21
22
23
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 21

def mean
  @mean
end

#medianFloat (readonly)

Returns The 50th percentile of the amount in the period.

Returns:

  • (Float)

    The 50th percentile of the amount in the period.



25
26
27
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 25

def median
  @median
end

#p25Float (readonly)

Returns The 25th percentile of the amount in the period.

Returns:

  • (Float)

    The 25th percentile of the amount in the period.



23
24
25
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 23

def p25
  @p25
end

#p75Float (readonly)

Returns The 75th percentile of the amount in the period.

Returns:

  • (Float)

    The 75th percentile of the amount in the period.



27
28
29
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 27

def p75
  @p75
end

#p90Float (readonly)

Returns The 90th percentile of the amount in the period.

Returns:

  • (Float)

    The 90th percentile of the amount in the period.



29
30
31
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 29

def p90
  @p90
end

#top10countFloat (readonly)

Returns The share of amount in the top 10 users.

Returns:

  • (Float)

    The share of amount in the top 10 users.



13
14
15
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 13

def top10count
  @top10count
end

#top10percentFloat (readonly)

Returns The share of amount in the top 10% of users.

Returns:

  • (Float)

    The share of amount in the top 10% of users.



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

def top10percent
  @top10percent
end

#top20countFloat (readonly)

Returns The share of amount in the top 20 users.

Returns:

  • (Float)

    The share of amount in the top 20 users.



15
16
17
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 15

def top20count
  @top20count
end

#top20percentFloat (readonly)

Returns The share of amount in the top 20% of users.

Returns:

  • (Float)

    The share of amount in the top 20% of users.



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

def top20percent
  @top20percent
end

#top5countFloat (readonly)

Returns The share of amount in the top 5 users.

Returns:

  • (Float)

    The share of amount in the top 5 users.



11
12
13
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 11

def top5count
  @top5count
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::ConcentrationTimeseriesDetail

Deserialize a JSON object to an instance of ConcentrationTimeseriesDetail

Parameters:

  • json_object (String)

Returns:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 96

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  date = parsed_json["date"]
  top5count = parsed_json["top_5_count"]
  top10count = parsed_json["top_10_count"]
  top20count = parsed_json["top_20_count"]
  top10percent = parsed_json["top_10_percent"]
  top20percent = parsed_json["top_20_percent"]
  mean = parsed_json["mean"]
  p25 = parsed_json["p25"]
  median = parsed_json["median"]
  p75 = parsed_json["p75"]
  p90 = parsed_json["p90"]
  average_to_median = parsed_json["average_to_median"]
  gini_coefficient = parsed_json["gini_coefficient"]
  new(
    date: date,
    top5count: top5count,
    top10count: top10count,
    top20count: top20count,
    top10percent: top10percent,
    top20percent: top20percent,
    mean: mean,
    p25: p25,
    median: median,
    p75: p75,
    p90: p90,
    average_to_median: average_to_median,
    gini_coefficient: gini_coefficient,
    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)


143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 143

def self.validate_raw(obj:)
  obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
  obj.top5count&.is_a?(Float) != false || raise("Passed value for field obj.top5count is not the expected type, validation failed.")
  obj.top10count&.is_a?(Float) != false || raise("Passed value for field obj.top10count is not the expected type, validation failed.")
  obj.top20count&.is_a?(Float) != false || raise("Passed value for field obj.top20count is not the expected type, validation failed.")
  obj.top10percent&.is_a?(Float) != false || raise("Passed value for field obj.top10percent is not the expected type, validation failed.")
  obj.top20percent&.is_a?(Float) != false || raise("Passed value for field obj.top20percent is not the expected type, validation failed.")
  obj.mean&.is_a?(Float) != false || raise("Passed value for field obj.mean is not the expected type, validation failed.")
  obj.p25&.is_a?(Float) != false || raise("Passed value for field obj.p25 is not the expected type, validation failed.")
  obj.median&.is_a?(Float) != false || raise("Passed value for field obj.median is not the expected type, validation failed.")
  obj.p75&.is_a?(Float) != false || raise("Passed value for field obj.p75 is not the expected type, validation failed.")
  obj.p90&.is_a?(Float) != false || raise("Passed value for field obj.p90 is not the expected type, validation failed.")
  obj.average_to_median&.is_a?(Float) != false || raise("Passed value for field obj.average_to_median is not the expected type, validation failed.")
  obj.gini_coefficient&.is_a?(Float) != false || raise("Passed value for field obj.gini_coefficient is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ConcentrationTimeseriesDetail to a JSON object

Returns:

  • (String)


133
134
135
# File 'lib/test_sdk/types/concentration_timeseries_detail.rb', line 133

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