Class: NewDemoApiClient::FunctionLevelGrowthAccounting

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

Overview

Represents the growth accounting metrics at the function level for a company.

This model captures the changes in employee count within specific functions over
time.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function:, date:, active:, new:, retained:, resurrected:, churned:, additional_properties: nil) ⇒ NewDemoApiClient::FunctionLevelGrowthAccounting

Parameters:

  • function (String)

    The function or department within the company.

  • date (String)

    The date of the entry in YYYYQ format.

  • active (Integer)

    The number of active employees in the function during the period.

  • new (Integer)

    The number of new employees in the function during the period.

  • retained (Integer)

    The number of employees retained in the function from the last period.

  • resurrected (Integer)

    The number of employees who left and returned to the function.

  • churned (Integer)

    The number of employees who left the function during the period.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/test_sdk/types/function_level_growth_accounting.rb', line 42

def initialize(function:, date:, active:, new:, retained:, resurrected:, churned:, additional_properties: nil)
  @function = function
  @date = date
  @active = active
  @new = new
  @retained = retained
  @resurrected = resurrected
  @churned = churned
  @additional_properties = additional_properties
  @_field_set = {
    "function": function,
    "date": date,
    "active": active,
    "new": new,
    "retained": retained,
    "resurrected": resurrected,
    "churned": churned
  }
end

Instance Attribute Details

#activeInteger (readonly)

Returns The number of active employees in the function during the period.

Returns:

  • (Integer)

    The number of active employees in the function during the period.



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

def active
  @active
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#churnedInteger (readonly)

Returns The number of employees who left the function during the period.

Returns:

  • (Integer)

    The number of employees who left the function during the period.



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

def churned
  @churned
end

#dateString (readonly)

Returns The date of the entry in YYYYQ format.

Returns:

  • (String)

    The date of the entry in YYYYQ format.



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

def date
  @date
end

#functionString (readonly)

Returns The function or department within the company.

Returns:

  • (String)

    The function or department within the company.



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

def function
  @function
end

#newInteger (readonly)

Returns The number of new employees in the function during the period.

Returns:

  • (Integer)

    The number of new employees in the function during the period.



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

def new
  @new
end

#resurrectedInteger (readonly)

Returns The number of employees who left and returned to the function.

Returns:

  • (Integer)

    The number of employees who left and returned to the function.



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

def resurrected
  @resurrected
end

#retainedInteger (readonly)

Returns The number of employees retained in the function from the last period.

Returns:

  • (Integer)

    The number of employees retained in the function from the last period.



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

def retained
  @retained
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::FunctionLevelGrowthAccounting

Deserialize a JSON object to an instance of FunctionLevelGrowthAccounting

Parameters:

  • json_object (String)

Returns:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/test_sdk/types/function_level_growth_accounting.rb', line 66

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  function = parsed_json["function"]
  date = parsed_json["date"]
  active = parsed_json["active"]
  new = parsed_json["new"]
  retained = parsed_json["retained"]
  resurrected = parsed_json["resurrected"]
  churned = parsed_json["churned"]
  new(
    function: function,
    date: date,
    active: active,
    new: new,
    retained: retained,
    resurrected: resurrected,
    churned: churned,
    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)


101
102
103
104
105
106
107
108
109
# File 'lib/test_sdk/types/function_level_growth_accounting.rb', line 101

def self.validate_raw(obj:)
  obj.function.is_a?(String) != false || raise("Passed value for field obj.function is not the expected type, validation failed.")
  obj.date.is_a?(String) != false || raise("Passed value for field obj.date is not the expected type, validation failed.")
  obj.active.is_a?(Integer) != false || raise("Passed value for field obj.active 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.retained.is_a?(Integer) != false || raise("Passed value for field obj.retained 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.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of FunctionLevelGrowthAccounting to a JSON object

Returns:

  • (String)


91
92
93
# File 'lib/test_sdk/types/function_level_growth_accounting.rb', line 91

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