Class: AvalaraSdk::A1099::V2::W8ImyFormResponse::EnumAttributeValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/avalara_sdk/models/A1099/V2/w8_imy_form_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(datatype, allowable_values) ⇒ EnumAttributeValidator

Returns a new instance of EnumAttributeValidator.



393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/avalara_sdk/models/A1099/V2/w8_imy_form_response.rb', line 393

def initialize(datatype, allowable_values)
  @allowable_values = allowable_values.map do |value|
    case datatype.to_s
    when /Integer/i
      value.to_i
    when /Float/i
      value.to_f
    else
      value
    end
  end
end

Instance Attribute Details

#allowable_valuesObject (readonly)

Returns the value of attribute allowable_values.



391
392
393
# File 'lib/avalara_sdk/models/A1099/V2/w8_imy_form_response.rb', line 391

def allowable_values
  @allowable_values
end

#datatypeObject (readonly)

Returns the value of attribute datatype.



390
391
392
# File 'lib/avalara_sdk/models/A1099/V2/w8_imy_form_response.rb', line 390

def datatype
  @datatype
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


406
407
408
# File 'lib/avalara_sdk/models/A1099/V2/w8_imy_form_response.rb', line 406

def valid?(value)
  !value || allowable_values.include?(value)
end