Class: NewDemoApiClient::UserAccountingResponse

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

Class Method Summary collapse

Instance Method Summary collapse

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



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

def active_users
  @active_users
end

#additional_propertiesOpenStruct (readonly)



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

def additional_properties
  @additional_properties
end

#churnedInteger (readonly)



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

def churned
  @churned
end

#cmgr12Float (readonly)



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

def cmgr12
  @cmgr12
end

#cmgr3Float (readonly)



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

def cmgr3
  @cmgr3
end

#cmgr6Float (readonly)



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

def cmgr6
  @cmgr6
end

#cqgr1Float (readonly)



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

def cqgr1
  @cqgr1
end

#cqgr2Float (readonly)



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

def cqgr2
  @cqgr2
end

#cqgr4Float (readonly)



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

def cqgr4
  @cqgr4
end

#dateString (readonly)



10
11
12
# File 'lib/test_sdk/types/user_accounting_response.rb', line 10

def date
  @date
end

#logo_retentionFloat (readonly)



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

def logo_retention
  @logo_retention
end

#newInteger (readonly)



16
17
18
# File 'lib/test_sdk/types/user_accounting_response.rb', line 16

def new
  @new
end

#quick_ratioFloat (readonly)



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

def quick_ratio
  @quick_ratio
end

#resurrectedInteger (readonly)



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

def resurrected
  @resurrected
end

#retainedInteger (readonly)



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