Class: NewDemoApiClient::EndpointSeniorityCount

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

Overview

The count of employees at each seniority level at the company

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seniority:, count:, additional_properties: nil) ⇒ NewDemoApiClient::EndpointSeniorityCount

Parameters:

  • seniority (String)

    The seniority level of the employee.

  • count (Integer)

    The count of employees at the seniority level.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



25
26
27
28
29
30
# File 'lib/test_sdk/types/endpoint_seniority_count.rb', line 25

def initialize(seniority:, count:, additional_properties: nil)
  @seniority = seniority
  @count = count
  @additional_properties = additional_properties
  @_field_set = { "seniority": seniority, "count": count }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



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

def additional_properties
  @additional_properties
end

#countInteger (readonly)

Returns The count of employees at the seniority level.

Returns:

  • (Integer)

    The count of employees at the seniority level.



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

def count
  @count
end

#seniorityString (readonly)

Returns The seniority level of the employee.

Returns:

  • (String)

    The seniority level of the employee.



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

def seniority
  @seniority
end

Class Method Details

.from_json(json_object:) ⇒ NewDemoApiClient::EndpointSeniorityCount

Deserialize a JSON object to an instance of EndpointSeniorityCount

Parameters:

  • json_object (String)

Returns:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/test_sdk/types/endpoint_seniority_count.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  seniority = parsed_json["seniority"]
  count = parsed_json["count"]
  new(
    seniority: seniority,
    count: count,
    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)


61
62
63
64
# File 'lib/test_sdk/types/endpoint_seniority_count.rb', line 61

def self.validate_raw(obj:)
  obj.seniority.is_a?(String) != false || raise("Passed value for field obj.seniority is not the expected type, validation failed.")
  obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of EndpointSeniorityCount to a JSON object

Returns:

  • (String)


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

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