Class: Gusto::Payroll::EarningTypes::EarningTypesGetResponse
- Inherits:
-
Object
- Object
- Gusto::Payroll::EarningTypes::EarningTypesGetResponse
- Defined in:
- lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#custom ⇒ Array<Gusto::EarningTypes::EarningType>
readonly
The custom earning types for the company.
-
#default ⇒ Array<Gusto::EarningTypes::EarningType>
readonly
The default earning types for the company.
Class Method Summary collapse
- .from_json(json_object:) ⇒ Gusto::Payroll::EarningTypes::EarningTypesGetResponse
- .validate_raw(obj:) ⇒ Void
Instance Method Summary collapse
- #initialize(default: OMIT, custom: OMIT, additional_properties: nil) ⇒ Gusto::Payroll::EarningTypes::EarningTypesGetResponse constructor
- #to_json ⇒ String
Constructor Details
#initialize(default: OMIT, custom: OMIT, additional_properties: nil) ⇒ Gusto::Payroll::EarningTypes::EarningTypesGetResponse
26 27 28 29 30 31 32 33 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 26 def initialize(default: OMIT, custom: OMIT, additional_properties: nil) @default = default if default != OMIT @custom = custom if custom != OMIT @additional_properties = additional_properties @_field_set = { "default": default, "custom": custom }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 15 def additional_properties @additional_properties end |
#custom ⇒ Array<Gusto::EarningTypes::EarningType> (readonly)
Returns The custom earning types for the company.
13 14 15 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 13 def custom @custom end |
#default ⇒ Array<Gusto::EarningTypes::EarningType> (readonly)
Returns The default earning types for the company.
11 12 13 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 11 def default @default end |
Class Method Details
.from_json(json_object:) ⇒ Gusto::Payroll::EarningTypes::EarningTypesGetResponse
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) default = parsed_json["default"]&.map do | item | item = item.to_json Gusto::EarningTypes::EarningType.from_json(json_object: item) end custom = parsed_json["custom"]&.map do | item | item = item.to_json Gusto::EarningTypes::EarningType.from_json(json_object: item) end new( default: default, custom: custom, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
67 68 69 70 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 67 def self.validate_raw(obj:) obj.default&.is_a?(Array) != false || raise("Passed value for field obj.default is not the expected type, validation failed.") obj.custom&.is_a?(Array) != false || raise("Passed value for field obj.custom is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
58 59 60 |
# File 'lib/fern_gusto/payroll/earning_types/types/earning_types_get_response.rb', line 58 def to_json @_field_set&.to_json end |