Class: Gusto::EarningTypes::EarningType
- Inherits:
-
Object
- Object
- Gusto::EarningTypes::EarningType
- Defined in:
- lib/fern_gusto/earning_types/types/earning_type.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#name ⇒ String
readonly
The name of the earning type.
-
#uuid ⇒ String
readonly
The ID of the earning type.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(name: OMIT, uuid:, additional_properties: nil) ⇒ Gusto::EarningTypes::EarningType constructor
- #to_json ⇒ String
Constructor Details
#initialize(name: OMIT, uuid:, additional_properties: nil) ⇒ Gusto::EarningTypes::EarningType
25 26 27 28 29 30 31 32 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 25 def initialize(name: OMIT, uuid:, additional_properties: nil) @name = name if name != OMIT @uuid = uuid @additional_properties = additional_properties @_field_set = { "name": name, "uuid": uuid }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 14 def additional_properties @additional_properties end |
#name ⇒ String (readonly)
Returns The name of the earning type.
10 11 12 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 10 def name @name end |
#uuid ⇒ String (readonly)
Returns The ID of the earning type.
12 13 14 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 12 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::EarningTypes::EarningType
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] uuid = parsed_json["uuid"] new( name: name, uuid: uuid, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
60 61 62 63 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 60 def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.uuid.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
51 52 53 |
# File 'lib/fern_gusto/earning_types/types/earning_type.rb', line 51 def to_json @_field_set&.to_json end |