Class: Gusto::Department

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/types/department.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uuid: OMIT, company_uuid: OMIT, title: OMIT, employees: OMIT, contractors: OMIT, version: OMIT, additional_properties: nil) ⇒ Gusto::Department

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fern_gusto/types/department.rb', line 41

def initialize(uuid: OMIT, company_uuid: OMIT, title: OMIT, employees: OMIT, contractors: OMIT, version: OMIT, additional_properties: nil)
  @uuid = uuid if uuid != OMIT
  @company_uuid = company_uuid if company_uuid != OMIT
  @title = title if title != OMIT
  @employees = employees if employees != OMIT
  @contractors = contractors if contractors != OMIT
  @version = version if version != OMIT
  @additional_properties = additional_properties
  @_field_set = { "uuid": uuid, "company_uuid": company_uuid, "title": title, "employees": employees, "contractors": contractors, "version": version }.reject do | _k, v |
  v == OMIT
end
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



24
25
26
# File 'lib/fern_gusto/types/department.rb', line 24

def additional_properties
  @additional_properties
end

#company_uuidString (readonly)

Returns The UUID of the company.

Returns:

  • (String)

    The UUID of the company



12
13
14
# File 'lib/fern_gusto/types/department.rb', line 12

def company_uuid
  @company_uuid
end

#contractorsArray<Gusto::DepartmentContractorsItem> (readonly)

Returns Array of contractors assigned to the department.

Returns:



18
19
20
# File 'lib/fern_gusto/types/department.rb', line 18

def contractors
  @contractors
end

#employeesArray<Gusto::DepartmentEmployeesItem> (readonly)

Returns Array of employees assigned to the department.

Returns:



16
17
18
# File 'lib/fern_gusto/types/department.rb', line 16

def employees
  @employees
end

#titleString (readonly)

Returns Name of the department.

Returns:

  • (String)

    Name of the department



14
15
16
# File 'lib/fern_gusto/types/department.rb', line 14

def title
  @title
end

#uuidString (readonly)

Returns The UUID of the department.

Returns:

  • (String)

    The UUID of the department



10
11
12
# File 'lib/fern_gusto/types/department.rb', line 10

def uuid
  @uuid
end

#versionObject (readonly)

on how to use this field.



22
23
24
# File 'lib/fern_gusto/types/department.rb', line 22

def version
  @version
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::Department

Parameters:

  • json_object (String)

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/fern_gusto/types/department.rb', line 57

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  uuid = parsed_json["uuid"]
  company_uuid = parsed_json["company_uuid"]
  title = parsed_json["title"]
  employees = parsed_json["employees"]&.map do | item |
  item = item.to_json
  Gusto::DepartmentEmployeesItem.from_json(json_object: item)
end
  contractors = parsed_json["contractors"]&.map do | item |
  item = item.to_json
  Gusto::DepartmentContractorsItem.from_json(json_object: item)
end
  version = parsed_json["version"]
  new(
    uuid: uuid,
    company_uuid: company_uuid,
    title: title,
    employees: employees,
    contractors: contractors,
    version: version,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


94
95
96
97
98
99
100
101
# File 'lib/fern_gusto/types/department.rb', line 94

def self.validate_raw(obj:)
  obj.uuid&.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.")
  obj.company_uuid&.is_a?(String) != false || raise("Passed value for field obj.company_uuid is not the expected type, validation failed.")
  obj.title&.is_a?(String) != false || raise("Passed value for field obj.title is not the expected type, validation failed.")
  obj.employees&.is_a?(Array) != false || raise("Passed value for field obj.employees is not the expected type, validation failed.")
  obj.contractors&.is_a?(Array) != false || raise("Passed value for field obj.contractors is not the expected type, validation failed.")
  obj.version&.is_a?(String) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


85
86
87
# File 'lib/fern_gusto/types/department.rb', line 85

def to_json
  @_field_set&.to_json
end