Class: Gusto::CustomFields::EmployeeCustomField
- Inherits:
-
Object
- Object
- Gusto::CustomFields::EmployeeCustomField
- Defined in:
- lib/fern_gusto/custom_fields/types/employee_custom_field.rb
Overview
A custom field of an employee
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#company_custom_field_id ⇒ Object
readonly
fields.
- #description ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
-
#selection_options ⇒ Array<String>
readonly
An array of options for fields of type radio.
- #type ⇒ Gusto::CustomFields::CustomFieldType readonly
- #value ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, company_custom_field_id:, name:, type:, description: OMIT, value:, selection_options: OMIT, additional_properties: nil) ⇒ Gusto::CustomFields::EmployeeCustomField constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, company_custom_field_id:, name:, type:, description: OMIT, value:, selection_options: OMIT, additional_properties: nil) ⇒ Gusto::CustomFields::EmployeeCustomField
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 43 def initialize(id:, company_custom_field_id:, name:, type:, description: OMIT, value:, selection_options: OMIT, additional_properties: nil) @id = id @company_custom_field_id = company_custom_field_id @name = name @type = type @description = description if description != OMIT @value = value @selection_options = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "company_custom_field_id": company_custom_field_id, "name": name, "type": type, "description": description, "value": value, "selection_options": }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
26 27 28 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 26 def additional_properties @additional_properties end |
#company_custom_field_id ⇒ Object (readonly)
fields
14 15 16 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 14 def company_custom_field_id @company_custom_field_id end |
#description ⇒ String (readonly)
20 21 22 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 20 def description @description end |
#id ⇒ String (readonly)
11 12 13 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 11 def id @id end |
#name ⇒ String (readonly)
16 17 18 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 16 def name @name end |
#selection_options ⇒ Array<String> (readonly)
Returns An array of options for fields of type radio. Otherwise, null.
24 25 26 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 24 def @selection_options end |
#type ⇒ Gusto::CustomFields::CustomFieldType (readonly)
18 19 20 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 18 def type @type end |
#value ⇒ String (readonly)
22 23 24 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 22 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::CustomFields::EmployeeCustomField
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 60 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] company_custom_field_id = parsed_json["company_custom_field_id"] name = parsed_json["name"] type = parsed_json["type"] description = parsed_json["description"] value = parsed_json["value"] = parsed_json["selection_options"] new( id: id, company_custom_field_id: company_custom_field_id, name: name, type: type, description: description, value: value, selection_options: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
93 94 95 96 97 98 99 100 101 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 93 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.company_custom_field_id.is_a?(String) != false || raise("Passed value for field obj.company_custom_field_id is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.type.is_a?(Gusto::CustomFields::CustomFieldType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.&.is_a?(Array) != false || raise("Passed value for field obj.selection_options is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
84 85 86 |
# File 'lib/fern_gusto/custom_fields/types/employee_custom_field.rb', line 84 def to_json @_field_set&.to_json end |