Class: NewDemoApiClient::UserAccountingResponse
- Inherits:
-
Object
- Object
- NewDemoApiClient::UserAccountingResponse
- Defined in:
- lib/test_sdk/types/user_accounting_response.rb
Overview
Represents the basic growth accounting metrics for the user count.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#active_users ⇒ Integer
readonly
The number of active users in the period.
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#churned ⇒ Integer
readonly
The number of churned users in the period.
-
#cmgr12 ⇒ Float
readonly
12-month user count growth rate, for monthly frequency.
-
#cmgr3 ⇒ Float
readonly
3-month user count growth rate, for monthly frequency.
-
#cmgr6 ⇒ Float
readonly
6-month user count growth rate, for monthly frequency.
-
#cqgr1 ⇒ Float
readonly
1-quarter user count growth rate, for quarterly frequency.
-
#cqgr2 ⇒ Float
readonly
2-quarter user count growth rate, for quarterly frequency.
-
#cqgr4 ⇒ Float
readonly
4-quarter user count growth rate, for quarterly frequency.
-
#date ⇒ String
readonly
The date of the entry.
-
#logo_retention ⇒ Float
readonly
The logo retention rate, defined as retained / active over last period.
-
#new ⇒ Integer
readonly
The number of new users in the period.
-
#quick_ratio ⇒ Float
readonly
The quick ratio, defined as (resurrected + new) / churned.
-
#resurrected ⇒ Integer
readonly
The number of resurrected users in the period.
-
#retained ⇒ Integer
readonly
The number of retained users from the last period in the current period.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ NewDemoApiClient::UserAccountingResponse
Deserialize a JSON object to an instance of UserAccountingResponse.
-
.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:, active_users:, retained: OMIT, new: OMIT, resurrected: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, logo_retention: OMIT, quick_ratio: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::UserAccountingResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of UserAccountingResponse to a JSON object.
Constructor Details
#initialize(date:, active_users:, retained: OMIT, new: OMIT, resurrected: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, logo_retention: OMIT, quick_ratio: OMIT, additional_properties: nil) ⇒ NewDemoApiClient::UserAccountingResponse
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 91 92 93 94 95 96 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 61 def initialize(date:, active_users:, retained: OMIT, new: OMIT, resurrected: OMIT, churned: OMIT, cmgr3: OMIT, cmgr6: OMIT, cmgr12: OMIT, cqgr1: OMIT, cqgr2: OMIT, cqgr4: OMIT, logo_retention: OMIT, quick_ratio: OMIT, additional_properties: nil) @date = date @active_users = active_users @retained = retained if retained != OMIT @new = new if new != OMIT @resurrected = resurrected if resurrected != 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 @logo_retention = logo_retention if logo_retention != OMIT @quick_ratio = quick_ratio if quick_ratio != OMIT @additional_properties = additional_properties @_field_set = { "date": date, "active_users": active_users, "retained": retained, "new": new, "resurrected": resurrected, "churned": churned, "cmgr3": cmgr3, "cmgr6": cmgr6, "cmgr12": cmgr12, "cqgr1": cqgr1, "cqgr2": cqgr2, "cqgr4": cqgr4, "logo_retention": logo_retention, "quick_ratio": quick_ratio }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#active_users ⇒ Integer (readonly)
Returns The number of active users in the period.
12 13 14 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 12 def active_users @active_users end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
38 39 40 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 38 def additional_properties @additional_properties end |
#churned ⇒ Integer (readonly)
Returns The number of churned users in the period.
20 21 22 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 20 def churned @churned end |
#cmgr12 ⇒ Float (readonly)
Returns 12-month user count growth rate, for monthly frequency.
26 27 28 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 26 def cmgr12 @cmgr12 end |
#cmgr3 ⇒ Float (readonly)
Returns 3-month user count growth rate, for monthly frequency.
22 23 24 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 22 def cmgr3 @cmgr3 end |
#cmgr6 ⇒ Float (readonly)
Returns 6-month user count growth rate, for monthly frequency.
24 25 26 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 24 def cmgr6 @cmgr6 end |
#cqgr1 ⇒ Float (readonly)
Returns 1-quarter user count growth rate, for quarterly frequency.
28 29 30 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 28 def cqgr1 @cqgr1 end |
#cqgr2 ⇒ Float (readonly)
Returns 2-quarter user count growth rate, for quarterly frequency.
30 31 32 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 30 def cqgr2 @cqgr2 end |
#cqgr4 ⇒ Float (readonly)
Returns 4-quarter user count growth rate, for quarterly frequency.
32 33 34 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 32 def cqgr4 @cqgr4 end |
#date ⇒ String (readonly)
Returns The date of the entry.
10 11 12 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 10 def date @date end |
#logo_retention ⇒ Float (readonly)
Returns The logo retention rate, defined as retained / active over last period.
34 35 36 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 34 def logo_retention @logo_retention end |
#new ⇒ Integer (readonly)
Returns The number of new users in the period.
16 17 18 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 16 def new @new end |
#quick_ratio ⇒ Float (readonly)
Returns The quick ratio, defined as (resurrected + new) / churned.
36 37 38 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 36 def quick_ratio @quick_ratio end |
#resurrected ⇒ Integer (readonly)
Returns The number of resurrected users in the period.
18 19 20 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 18 def resurrected @resurrected end |
#retained ⇒ Integer (readonly)
Returns The number of retained users from the last period in the current period.
14 15 16 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 14 def retained @retained end |
Class Method Details
.from_json(json_object:) ⇒ NewDemoApiClient::UserAccountingResponse
Deserialize a JSON object to an instance of UserAccountingResponse
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/user_accounting_response.rb', line 102 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) date = parsed_json["date"] active_users = parsed_json["active_users"] retained = parsed_json["retained"] new = parsed_json["new"] resurrected = parsed_json["resurrected"] 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"] logo_retention = parsed_json["logo_retention"] quick_ratio = parsed_json["quick_ratio"] new( date: date, active_users: active_users, retained: retained, new: new, resurrected: resurrected, churned: churned, cmgr3: cmgr3, cmgr6: cmgr6, cmgr12: cmgr12, cqgr1: cqgr1, cqgr2: cqgr2, cqgr4: cqgr4, logo_retention: logo_retention, quick_ratio: quick_ratio, 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.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 151 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.active_users.is_a?(Integer) != false || raise("Passed value for field obj.active_users is not the expected type, validation failed.") obj.retained&.is_a?(Integer) != false || raise("Passed value for field obj.retained is not the expected type, validation failed.") obj.new&.is_a?(Integer) != false || raise("Passed value for field obj.new is not the expected type, validation failed.") obj.resurrected&.is_a?(Integer) != false || raise("Passed value for field obj.resurrected is not the expected type, validation failed.") obj.churned&.is_a?(Integer) != 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.logo_retention&.is_a?(Float) != false || raise("Passed value for field obj.logo_retention 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of UserAccountingResponse to a JSON object
141 142 143 |
# File 'lib/test_sdk/types/user_accounting_response.rb', line 141 def to_json(*_args) @_field_set&.to_json end |