Class: NewDemoApiClient::GrowthAccountingResponse

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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_propertiesOpenStruct (readonly)



56
57
58
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 56

def additional_properties
  @additional_properties
end

#amountFloat (readonly)



14
15
16
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 14

def amount
  @amount
end

#churnedFloat (readonly)



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

def churned
  @churned
end

#cmgr12Float (readonly)



32
33
34
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 32

def cmgr12
  @cmgr12
end

#cmgr3Float (readonly)



28
29
30
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 28

def cmgr3
  @cmgr3
end

#cmgr6Float (readonly)



30
31
32
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 30

def cmgr6
  @cmgr6
end

#contractionFloat (readonly)



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

def contraction
  @contraction
end

#cqgr1Float (readonly)



34
35
36
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 34

def cqgr1
  @cqgr1
end

#cqgr2Float (readonly)



36
37
38
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 36

def cqgr2
  @cqgr2
end

#cqgr4Float (readonly)



38
39
40
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 38

def cqgr4
  @cqgr4
end

#dateString (readonly)



12
13
14
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 12

def date
  @date
end

#expansionFloat (readonly)



22
23
24
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 22

def expansion
  @expansion
end

#gross_retentionFloat (readonly)



43
44
45
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 43

def gross_retention
  @gross_retention
end

#lifetime_gross_retentionFloat (readonly)



51
52
53
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 51

def lifetime_gross_retention
  @lifetime_gross_retention
end

#lifetime_net_churnFloat (readonly)



54
55
56
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 54

def lifetime_net_churn
  @lifetime_net_churn
end

#lifetime_quick_ratioFloat (readonly)



49
50
51
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 49

def lifetime_quick_ratio
  @lifetime_quick_ratio
end

#net_churnFloat (readonly)



47
48
49
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 47

def net_churn
  @net_churn
end

#newFloat (readonly)



18
19
20
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 18

def new
  @new
end

#quick_ratioFloat (readonly)



41
42
43
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 41

def quick_ratio
  @quick_ratio
end

#resurrectedFloat (readonly)



20
21
22
# File 'lib/test_sdk/types/growth_accounting_response.rb', line 20

def resurrected
  @resurrected
end

#retainedFloat (readonly)



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