Class: Gusto::ExternalPayrolls::ExternalPayrollExternalPayrollItemsItemTaxesItem

Inherits:
Object
  • Object
show all
Defined in:
lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tax_id: OMIT, amount: OMIT, additional_properties: nil) ⇒ Gusto::ExternalPayrolls::ExternalPayrollExternalPayrollItemsItemTaxesItem

Parameters:

  • tax_id (Integer) (defaults to: OMIT)
  • amount (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



24
25
26
27
28
29
30
31
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 24

def initialize(tax_id: OMIT, amount: OMIT, additional_properties: nil)
  @tax_id = tax_id if tax_id != OMIT
  @amount = amount if amount != OMIT
  @additional_properties = additional_properties
  @_field_set = { "tax_id": tax_id, "amount": amount }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



13
14
15
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 13

def additional_properties
  @additional_properties
end

#amountString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 11

def amount
  @amount
end

#tax_idInteger (readonly)

Returns:

  • (Integer)


9
10
11
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 9

def tax_id
  @tax_id
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::ExternalPayrolls::ExternalPayrollExternalPayrollItemsItemTaxesItem



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 37

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  tax_id = parsed_json["tax_id"]
  amount = parsed_json["amount"]
  new(
    tax_id: tax_id,
    amount: amount,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


61
62
63
64
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 61

def self.validate_raw(obj:)
  obj.tax_id&.is_a?(Integer) != false || raise("Passed value for field obj.tax_id is not the expected type, validation failed.")
  obj.amount&.is_a?(String) != false || raise("Passed value for field obj.amount is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


52
53
54
# File 'lib/fern_gusto/external_payrolls/types/external_payroll_external_payroll_items_item_taxes_item.rb', line 52

def to_json
  @_field_set&.to_json
end