Class: Gusto::Department
- Inherits:
-
Object
- Object
- Gusto::Department
- Defined in:
- lib/fern_gusto/types/department.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company_uuid ⇒ String
readonly
The UUID of the company.
-
#contractors ⇒ Array<Gusto::DepartmentContractorsItem>
readonly
Array of contractors assigned to the department.
-
#employees ⇒ Array<Gusto::DepartmentEmployeesItem>
readonly
Array of employees assigned to the department.
-
#title ⇒ String
readonly
Name of the department.
-
#uuid ⇒ String
readonly
The UUID of the department.
-
#version ⇒ Object
readonly
on how to use this field.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid: OMIT, company_uuid: OMIT, title: OMIT, employees: OMIT, contractors: OMIT, version: OMIT, additional_properties: nil) ⇒ Gusto::Department constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid: OMIT, company_uuid: OMIT, title: OMIT, employees: OMIT, contractors: OMIT, version: OMIT, additional_properties: nil) ⇒ Gusto::Department
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_properties ⇒ OpenStruct (readonly)
Returns 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_uuid ⇒ String (readonly)
Returns The UUID of the company.
12 13 14 |
# File 'lib/fern_gusto/types/department.rb', line 12 def company_uuid @company_uuid end |
#contractors ⇒ Array<Gusto::DepartmentContractorsItem> (readonly)
Returns Array of contractors assigned to the department.
18 19 20 |
# File 'lib/fern_gusto/types/department.rb', line 18 def contractors @contractors end |
#employees ⇒ Array<Gusto::DepartmentEmployeesItem> (readonly)
Returns Array of employees assigned to the department.
16 17 18 |
# File 'lib/fern_gusto/types/department.rb', line 16 def employees @employees end |
#title ⇒ String (readonly)
Returns Name of the department.
14 15 16 |
# File 'lib/fern_gusto/types/department.rb', line 14 def title @title end |
#uuid ⇒ String (readonly)
Returns The UUID of the department.
10 11 12 |
# File 'lib/fern_gusto/types/department.rb', line 10 def uuid @uuid end |
#version ⇒ Object (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
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
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_json ⇒ String
85 86 87 |
# File 'lib/fern_gusto/types/department.rb', line 85 def to_json @_field_set&.to_json end |