Class: Gusto::TaxRequirementApplicableIfItem

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: OMIT, value: OMIT, additional_properties: nil) ⇒ Gusto::TaxRequirementApplicableIfItem

Parameters:

  • key (String) (defaults to: OMIT)
  • value (Gusto::TaxRequirementApplicableIfItemValue) (defaults to: OMIT)

    The required value of the requirement identified by ‘key`

  • 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/types/tax_requirement_applicable_if_item.rb', line 24

def initialize(key: OMIT, value: OMIT, additional_properties: nil)
  @key = key if key != OMIT
  @value = value if value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "key": key, "value": value }.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/types/tax_requirement_applicable_if_item.rb', line 13

def additional_properties
  @additional_properties
end

#keyString (readonly)

Returns:

  • (String)


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

def key
  @key
end

#valueGusto::TaxRequirementApplicableIfItemValue (readonly)

Returns The required value of the requirement identified by ‘key`.

Returns:



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

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::TaxRequirementApplicableIfItem

Parameters:

  • json_object (String)

Returns:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fern_gusto/types/tax_requirement_applicable_if_item.rb', line 36

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  key = parsed_json["key"]
  unless parsed_json["value"].nil?
    value = parsed_json["value"].to_json
    value = Gusto::TaxRequirementApplicableIfItemValue.from_json(json_object: value)
  else
    value = nil
  end
  new(
    key: key,
    value: value,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


64
65
66
67
# File 'lib/fern_gusto/types/tax_requirement_applicable_if_item.rb', line 64

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


55
56
57
# File 'lib/fern_gusto/types/tax_requirement_applicable_if_item.rb', line 55

def to_json
  @_field_set&.to_json
end