Class: Gusto::TaxRequirement

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key: OMIT, applicable_if: OMIT, label: OMIT, description: OMIT, value: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Gusto::TaxRequirement

Parameters:

  • label (String) (defaults to: OMIT)

    A customer facing description of the requirement

  • description (String) (defaults to: OMIT)

    A more detailed customer facing description of the requirement

  • value (String) (defaults to: OMIT)

    The “answer”

  • metadata (Gusto::TaxRequirementMetadata) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fern_gusto/types/tax_requirement.rb', line 47

def initialize(key: OMIT, applicable_if: OMIT, label: OMIT, description: OMIT, value: OMIT, metadata: OMIT, additional_properties: nil)
  @key = key if key != OMIT
  @applicable_if = applicable_if if applicable_if != OMIT
  @label = label if label != OMIT
  @description = description if description != OMIT
  @value = value if value != OMIT
  @metadata =  if  != OMIT
  @additional_properties = additional_properties
  @_field_set = { "key": key, "applicable_if": applicable_if, "label": label, "description": description, "value": value, "metadata":  }.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



27
28
29
# File 'lib/fern_gusto/types/tax_requirement.rb', line 27

def additional_properties
  @additional_properties
end

#applicable_ifObject (readonly)

means the requirement is applicable.



17
18
19
# File 'lib/fern_gusto/types/tax_requirement.rb', line 17

def applicable_if
  @applicable_if
end

#descriptionString (readonly)

Returns A more detailed customer facing description of the requirement.

Returns:

  • (String)

    A more detailed customer facing description of the requirement



21
22
23
# File 'lib/fern_gusto/types/tax_requirement.rb', line 21

def description
  @description
end

#keyString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/fern_gusto/types/tax_requirement.rb', line 10

def key
  @key
end

#labelString (readonly)

Returns A customer facing description of the requirement.

Returns:

  • (String)

    A customer facing description of the requirement



19
20
21
# File 'lib/fern_gusto/types/tax_requirement.rb', line 19

def label
  @label
end

#metadataGusto::TaxRequirementMetadata (readonly)



25
26
27
# File 'lib/fern_gusto/types/tax_requirement.rb', line 25

def 
  @metadata
end

#valueString (readonly)

Returns The “answer”.

Returns:

  • (String)

    The “answer”



23
24
25
# File 'lib/fern_gusto/types/tax_requirement.rb', line 23

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::TaxRequirement

Parameters:

  • json_object (String)

Returns:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/fern_gusto/types/tax_requirement.rb', line 63

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  key = parsed_json["key"]
  applicable_if = parsed_json["applicable_if"]&.map do | item |
  item = item.to_json
  Gusto::TaxRequirementApplicableIfItem.from_json(json_object: item)
end
  label = parsed_json["label"]
  description = parsed_json["description"]
  value = parsed_json["value"]
  unless parsed_json["metadata"].nil?
     = parsed_json["metadata"].to_json
     = Gusto::TaxRequirementMetadata.from_json(json_object: )
  else
     = nil
  end
  new(
    key: key,
    applicable_if: applicable_if,
    label: label,
    description: description,
    value: value,
    metadata: ,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


102
103
104
105
106
107
108
109
# File 'lib/fern_gusto/types/tax_requirement.rb', line 102

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.applicable_if&.is_a?(Array) != false || raise("Passed value for field obj.applicable_if is not the expected type, validation failed.")
  obj.label&.is_a?(String) != false || raise("Passed value for field obj.label 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.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
  obj..nil? || Gusto::TaxRequirementMetadata.validate_raw(obj: obj.)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


93
94
95
# File 'lib/fern_gusto/types/tax_requirement.rb', line 93

def to_json
  @_field_set&.to_json
end