Class: NewDemoApiClient::GrowthAccountingResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::GrowthAccountingResponse
- Defined in:
- lib/test_sdk/types/growth_accounting_response.rb
Overview
Represents the basic growth-accounting metrics for 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#amount ⇒ Float
readonly
The amount, such as revenue or gtv, in the period.
-
#churned ⇒ Float
readonly
The number of churned users in the period.
-
#cmgr12 ⇒ Float
readonly
12-month amount growth rate, for monthly frequency.
-
#cmgr3 ⇒ Float
readonly
3-month amount growth rate, for monthly frequency.
-
#cmgr6 ⇒ Float
readonly
6-month amount growth rate, for monthly frequency.
-
#contraction ⇒ Float
readonly
The amount of contraction in the period.
-
#cqgr1 ⇒ Float
readonly
1-quarter amount growth rate, for quarterly frequency.
-
#cqgr2 ⇒ Float
readonly
2-quarter amount growth rate, for quarterly frequency.
-
#cqgr4 ⇒ Float
readonly
4-quarter amount growth rate, for quarterly frequency.
-
#date ⇒ String
readonly
The date of the entry.
-
#expansion ⇒ Float
readonly
The amount of expansion in the period.
-
#gross_retention ⇒ Float
readonly
The gross retention rate, defined as retained / last period amount.
-
#lifetime_gross_retention ⇒ Float
readonly
The lifetime gross retention rate, integrated over all time.
-
#lifetime_net_churn ⇒ Float
readonly
The lifetime net churn rate, integrated over all time.
-
#lifetime_quick_ratio ⇒ Float
readonly
The lifetime quick ratio, integrated over all time.
-
#net_churn ⇒ Float
readonly
The net churn rate, defined as -(resurrected + expansion - churned - contraction) / last period amount.
-
#new ⇒ Float
readonly
The number of new users in the period.
-
#quick_ratio ⇒ Float
readonly
The quick ratio, defined as (new + resurrected + expansion) / (churned + contraction).
-
#resurrected ⇒ Float
readonly
The number of resurrected users in the period.
-
#retained ⇒ Float
readonly
The retained amount from the last period in the current period.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::GrowthAccountingResponse
Deserialize a JSON object to an instance of GrowthAccountingResponse.
-
.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.
Instance Method Summary collapse
- #initialize(date:, amount:, retained: OMIT, new: OMIT, resurrected: OMIT, expansion: OMIT, contraction: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, quick_ratio: OMIT, gross_retention: OMIT, net_churn: OMIT, lifetime_quick_ratio: OMIT, lifetime_gross_retention: OMIT, lifetime_net_churn: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::GrowthAccountingResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of GrowthAccountingResponse to a JSON object.
Constructor Details
#initialize(date:, amount:, retained: OMIT, new: OMIT, resurrected: OMIT, expansion: OMIT, contraction: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, quick_ratio: OMIT, gross_retention: OMIT, net_churn: OMIT, lifetime_quick_ratio: OMIT, lifetime_gross_retention: OMIT, lifetime_net_churn: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::GrowthAccountingResponse
89 90 91 92 93 94 95 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 129 130 131 132 133 134 135 136 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 89 def initialize(date:, amount:, retained: OMIT, new: OMIT, resurrected: OMIT, expansion: OMIT, contraction: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, quick_ratio: OMIT, gross_retention: OMIT, net_churn: OMIT, lifetime_quick_ratio: OMIT, lifetime_gross_retention: OMIT, lifetime_net_churn: OMIT, additional_properties: nil) @date = date @amount = amount @retained = retained if retained != OMIT @new = new if new != OMIT @resurrected = resurrected if resurrected != OMIT @expansion = expansion if expansion != OMIT @contraction = contraction if contraction != OMIT @churned = churned if churned != OMIT @cmgr3 = cmgr3 if cmgr3 != OMIT @cmgr6 = cmgr6 if cmgr6 != OMIT @cmgr12 = cmgr12 if cmgr12 != OMIT @cqgr1 = cqgr1 if cqgr1 != OMIT @cqgr2 = cqgr2 if cqgr2 != OMIT @cqgr4 = cqgr4 if cqgr4 != OMIT @quick_ratio = quick_ratio if quick_ratio != OMIT @gross_retention = gross_retention if gross_retention != OMIT @net_churn = net_churn if net_churn != OMIT @lifetime_quick_ratio = lifetime_quick_ratio if lifetime_quick_ratio != OMIT @lifetime_gross_retention = lifetime_gross_retention if lifetime_gross_retention != OMIT @lifetime_net_churn = lifetime_net_churn if lifetime_net_churn != OMIT @additional_properties = additional_properties @_field_set = { "date": date, "amount": amount, "retained": retained, "new": new, "resurrected": resurrected, "expansion": expansion, "contraction": contraction, "churned": churned, "cmgr3": cmgr3, "cmgr6": cmgr6, "cmgr12": cmgr12, "cqgr1": cqgr1, "cqgr2": cqgr2, "cqgr4": cqgr4, "quick_ratio": quick_ratio, "gross_retention": gross_retention, "net_churn": net_churn, "lifetime_quick_ratio": lifetime_quick_ratio, "lifetime_gross_retention": lifetime_gross_retention, "lifetime_net_churn": lifetime_net_churn }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
56 57 58 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 56 def additional_properties @additional_properties end |
#amount ⇒ Float (readonly)
Returns The amount, such as revenue or gtv, in the period.
14 15 16 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 14 def amount @amount end |
#churned ⇒ Float (readonly)
Returns The number of churned users in the period.
26 27 28 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 26 def churned @churned end |
#cmgr12 ⇒ Float (readonly)
Returns 12-month amount growth rate, for monthly frequency.
32 33 34 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 32 def cmgr12 @cmgr12 end |
#cmgr3 ⇒ Float (readonly)
Returns 3-month amount growth rate, for monthly frequency.
28 29 30 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 28 def cmgr3 @cmgr3 end |
#cmgr6 ⇒ Float (readonly)
Returns 6-month amount growth rate, for monthly frequency.
30 31 32 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 30 def cmgr6 @cmgr6 end |
#contraction ⇒ Float (readonly)
Returns The amount of contraction in the period.
24 25 26 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 24 def contraction @contraction end |
#cqgr1 ⇒ Float (readonly)
Returns 1-quarter amount growth rate, for quarterly frequency.
34 35 36 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 34 def cqgr1 @cqgr1 end |
#cqgr2 ⇒ Float (readonly)
Returns 2-quarter amount growth rate, for quarterly frequency.
36 37 38 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 36 def cqgr2 @cqgr2 end |
#cqgr4 ⇒ Float (readonly)
Returns 4-quarter amount growth rate, for quarterly frequency.
38 39 40 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 38 def cqgr4 @cqgr4 end |
#date ⇒ String (readonly)
Returns The date of the entry.
12 13 14 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 12 def date @date end |
#expansion ⇒ Float (readonly)
Returns The amount of expansion in the period.
22 23 24 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 22 def expansion @expansion end |
#gross_retention ⇒ Float (readonly)
Returns The gross retention rate, defined as retained / last period amount.
43 44 45 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 43 def gross_retention @gross_retention end |
#lifetime_gross_retention ⇒ Float (readonly)
Returns The lifetime gross retention rate, integrated over all time.
51 52 53 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 51 def lifetime_gross_retention @lifetime_gross_retention end |
#lifetime_net_churn ⇒ Float (readonly)
Returns The lifetime net churn rate, integrated over all time. This is also known as 1 - lifetime net dollar retention. Negative values indicate net-expansion.
54 55 56 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 54 def lifetime_net_churn @lifetime_net_churn end |
#lifetime_quick_ratio ⇒ Float (readonly)
Returns The lifetime quick ratio, integrated over all time.
49 50 51 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 49 def lifetime_quick_ratio @lifetime_quick_ratio end |
#net_churn ⇒ Float (readonly)
Returns The net churn rate, defined as -(resurrected + expansion - churned - contraction) / last period amount. This is also known as 1 - net dollar retention. Negative values indicate net-expansion.
47 48 49 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 47 def net_churn @net_churn end |
#new ⇒ Float (readonly)
Returns The number of new users in the period.
18 19 20 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 18 def new @new end |
#quick_ratio ⇒ Float (readonly)
Returns The quick ratio, defined as (new + resurrected + expansion) / (churned + contraction).
41 42 43 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 41 def quick_ratio @quick_ratio end |
#resurrected ⇒ Float (readonly)
Returns The number of resurrected users in the period.
20 21 22 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 20 def resurrected @resurrected end |
#retained ⇒ Float (readonly)
Returns The retained amount from the last period in the current period.
16 17 18 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 16 def retained @retained end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::GrowthAccountingResponse
Deserialize a JSON object to an instance of GrowthAccountingResponse
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 142 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) date = parsed_json["date"] amount = parsed_json["amount"] retained = parsed_json["retained"] new = parsed_json["new"] resurrected = parsed_json["resurrected"] expansion = parsed_json["expansion"] contraction = parsed_json["contraction"] churned = parsed_json["churned"] cmgr3 = parsed_json["cmgr3"] cmgr6 = parsed_json["cmgr6"] cmgr12 = parsed_json["cmgr12"] cqgr1 = parsed_json["cqgr1"] cqgr2 = parsed_json["cqgr2"] cqgr4 = parsed_json["cqgr4"] quick_ratio = parsed_json["quick_ratio"] gross_retention = parsed_json["gross_retention"] net_churn = parsed_json["net_churn"] lifetime_quick_ratio = parsed_json["lifetime_quick_ratio"] lifetime_gross_retention = parsed_json["lifetime_gross_retention"] lifetime_net_churn = parsed_json["lifetime_net_churn"] new( date: date, amount: amount, retained: retained, new: new, resurrected: resurrected, expansion: expansion, contraction: contraction, churned: churned, cmgr3: cmgr3, cmgr6: cmgr6, cmgr12: cmgr12, cqgr1: cqgr1, cqgr2: cqgr2, cqgr4: cqgr4, quick_ratio: quick_ratio, gross_retention: gross_retention, net_churn: net_churn, lifetime_quick_ratio: lifetime_quick_ratio, lifetime_gross_retention: lifetime_gross_retention, lifetime_net_churn: lifetime_net_churn, 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.
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 203 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.amount.is_a?(Float) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.") obj.retained&.is_a?(Float) != false || raise("Passed value for field obj.retained is not the expected type, validation failed.") obj.new&.is_a?(Float) != false || raise("Passed value for field obj.new is not the expected type, validation failed.") obj.resurrected&.is_a?(Float) != false || raise("Passed value for field obj.resurrected is not the expected type, validation failed.") obj.expansion&.is_a?(Float) != false || raise("Passed value for field obj.expansion is not the expected type, validation failed.") obj.contraction&.is_a?(Float) != false || raise("Passed value for field obj.contraction is not the expected type, validation failed.") obj.churned&.is_a?(Float) != false || raise("Passed value for field obj.churned is not the expected type, validation failed.") obj.cmgr3&.is_a?(Float) != false || raise("Passed value for field obj.cmgr3 is not the expected type, validation failed.") obj.cmgr6&.is_a?(Float) != false || raise("Passed value for field obj.cmgr6 is not the expected type, validation failed.") obj.cmgr12&.is_a?(Float) != false || raise("Passed value for field obj.cmgr12 is not the expected type, validation failed.") obj.cqgr1&.is_a?(Float) != false || raise("Passed value for field obj.cqgr1 is not the expected type, validation failed.") obj.cqgr2&.is_a?(Float) != false || raise("Passed value for field obj.cqgr2 is not the expected type, validation failed.") obj.cqgr4&.is_a?(Float) != false || raise("Passed value for field obj.cqgr4 is not the expected type, validation failed.") obj.quick_ratio&.is_a?(Float) != false || raise("Passed value for field obj.quick_ratio is not the expected type, validation failed.") obj.gross_retention&.is_a?(Float) != false || raise("Passed value for field obj.gross_retention is not the expected type, validation failed.") obj.net_churn&.is_a?(Float) != false || raise("Passed value for field obj.net_churn is not the expected type, validation failed.") obj.lifetime_quick_ratio&.is_a?(Float) != false || raise("Passed value for field obj.lifetime_quick_ratio is not the expected type, validation failed.") obj.lifetime_gross_retention&.is_a?(Float) != false || raise("Passed value for field obj.lifetime_gross_retention is not the expected type, validation failed.") obj.lifetime_net_churn&.is_a?(Float) != false || raise("Passed value for field obj.lifetime_net_churn is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of GrowthAccountingResponse to a JSON object
193 194 195 |
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 193 def to_json(*_args) @_field_set&.to_json end |