Class: Gusto::TaxRequirementMetadataValidation

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

Overview

for ‘tax_rate`

Describes the validation required for the tax rate

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, min: OMIT, max: OMIT, rates: OMIT, additional_properties: nil) ⇒ Gusto::TaxRequirementMetadataValidation

Parameters:

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



33
34
35
36
37
38
39
40
41
42
# File 'lib/fern_gusto/types/tax_requirement_metadata_validation.rb', line 33

def initialize(type:, min: OMIT, max: OMIT, rates: OMIT, additional_properties: nil)
  @type = type
  @min = min if min != OMIT
  @max = max if max != OMIT
  @rates = rates if rates != OMIT
  @additional_properties = additional_properties
  @_field_set = { "type": type, "min": min, "max": max, "rates": rates }.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



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

def additional_properties
  @additional_properties
end

#maxString (readonly)

Returns [for ‘min_max`] The inclusive upper bound of the tax rate.

Returns:

  • (String)
    for ‘min_max`

    The inclusive upper bound of the tax rate



14
15
16
# File 'lib/fern_gusto/types/tax_requirement_metadata_validation.rb', line 14

def max
  @max
end

#minString (readonly)

Returns [for ‘min_max`] The inclusive lower bound of the tax rate.

Returns:

  • (String)
    for ‘min_max`

    The inclusive lower bound of the tax rate



12
13
14
# File 'lib/fern_gusto/types/tax_requirement_metadata_validation.rb', line 12

def min
  @min
end

#ratesObject (readonly)

  • e.g. [“0.0”, “0.001”] representing 0% and 0.1%



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

def rates
  @rates
end

#typeGusto::TaxRequirementMetadataValidationType (readonly)

Returns Describes the type of tax_rate validation rule.

Returns:



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

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Gusto::TaxRequirementMetadataValidation

Parameters:

  • json_object (String)

Returns:



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

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  min = parsed_json["min"]
  max = parsed_json["max"]
  rates = parsed_json["rates"]
  new(
    type: type,
    min: min,
    max: max,
    rates: rates,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


74
75
76
77
78
79
# File 'lib/fern_gusto/types/tax_requirement_metadata_validation.rb', line 74

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


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

def to_json
  @_field_set&.to_json
end