Class: Gusto::CustomFields::CompanyCustomField
- Inherits:
-
Object
- Object
- Gusto::CustomFields::CompanyCustomField
- Defined in:
- lib/fern_gusto/custom_fields/types/company_custom_field.rb
Overview
A custom field on a company
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#description ⇒ String
readonly
Description of the company custom field.
-
#name ⇒ String
readonly
Name of the company custom field.
-
#selection_options ⇒ Array<String>
readonly
An array of options for fields of type radio.
- #type ⇒ Gusto::CustomFields::CustomFieldType readonly
-
#uuid ⇒ String
readonly
UUID of the company custom field.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(uuid:, name:, type:, description: OMIT, selection_options: OMIT, additional_properties: nil) ⇒ Gusto::CustomFields::CompanyCustomField constructor
- #to_json ⇒ String
Constructor Details
#initialize(uuid:, name:, type:, description: OMIT, selection_options: OMIT, additional_properties: nil) ⇒ Gusto::CustomFields::CompanyCustomField
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 35 def initialize(uuid:, name:, type:, description: OMIT, selection_options: OMIT, additional_properties: nil) @uuid = uuid @name = name @type = type @description = description if description != OMIT @selection_options = if != OMIT @additional_properties = additional_properties @_field_set = { "uuid": uuid, "name": name, "type": type, "description": description, "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.
21 22 23 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 21 def additional_properties @additional_properties end |
#description ⇒ String (readonly)
Returns Description of the company custom field.
17 18 19 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 17 def description @description end |
#name ⇒ String (readonly)
Returns Name of the company custom field.
13 14 15 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 13 def name @name end |
#selection_options ⇒ Array<String> (readonly)
Returns An array of options for fields of type radio. Otherwise, null.
19 20 21 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 19 def @selection_options end |
#type ⇒ Gusto::CustomFields::CustomFieldType (readonly)
15 16 17 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 15 def type @type end |
#uuid ⇒ String (readonly)
Returns UUID of the company custom field.
11 12 13 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 11 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::CustomFields::CompanyCustomField
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 50 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) uuid = parsed_json["uuid"] name = parsed_json["name"] type = parsed_json["type"] description = parsed_json["description"] = parsed_json["selection_options"] new( uuid: uuid, name: name, type: type, description: description, selection_options: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
79 80 81 82 83 84 85 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 79 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.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.&.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
70 71 72 |
# File 'lib/fern_gusto/custom_fields/types/company_custom_field.rb', line 70 def to_json @_field_set&.to_json end |