Class: Gusto::TaxRequirementMetadataValidation
- Inherits:
-
Object
- Object
- Gusto::TaxRequirementMetadataValidation
- 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
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#max ⇒ String
readonly
- for ‘min_max`
-
The inclusive upper bound of the tax rate.
-
#min ⇒ String
readonly
- for ‘min_max`
-
The inclusive lower bound of the tax rate.
-
#rates ⇒ Object
readonly
-
e.g.
-
-
#type ⇒ Gusto::TaxRequirementMetadataValidationType
readonly
Describes the type of tax_rate validation rule.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(type:, min: OMIT, max: OMIT, rates: OMIT, additional_properties: nil) ⇒ Gusto::TaxRequirementMetadataValidation constructor
- #to_json ⇒ String
Constructor Details
#initialize(type:, min: OMIT, max: OMIT, rates: OMIT, additional_properties: nil) ⇒ Gusto::TaxRequirementMetadataValidation
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_properties ⇒ OpenStruct (readonly)
Returns 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 |
#max ⇒ String (readonly)
Returns [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 |
#min ⇒ String (readonly)
Returns [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 |
#rates ⇒ Object (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 |
#type ⇒ Gusto::TaxRequirementMetadataValidationType (readonly)
Returns Describes the type of tax_rate validation rule.
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
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
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_json ⇒ String
65 66 67 |
# File 'lib/fern_gusto/types/tax_requirement_metadata_validation.rb', line 65 def to_json @_field_set&.to_json end |