lib/plaid/models/warning.rb in plaid-14.0.0.beta.5 vs lib/plaid/models/warning.rb in plaid-14.0.0

- old
+ new

@@ -1,11 +1,11 @@ =begin #The Plaid API #The Plaid REST API. Please see https://plaid.com/docs/api for more details. -The version of the OpenAPI document: 2020-09-14_1.16.6 +The version of the OpenAPI document: 2020-09-14_1.20.6 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.1.0 =end @@ -22,10 +22,32 @@ # The warning code identifies a specific kind of warning. Currently, the only possible warning code is `OWNERS_UNAVAILABLE`, which indicates that account-owner information is not available. attr_accessor :warning_code attr_accessor :cause + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + 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 + + def valid?(value) + !value || allowable_values.include?(value) + end + end + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'warning_type' => :'warning_type', :'warning_code' => :'warning_code', @@ -103,11 +125,23 @@ # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? return false if @warning_type.nil? return false if @warning_code.nil? + warning_code_validator = EnumAttributeValidator.new('String', ["OWNERS_UNAVAILABLE"]) + return false unless warning_code_validator.valid?(@warning_code) return false if @cause.nil? true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] warning_code Object to be assigned + def warning_code=(warning_code) + validator = EnumAttributeValidator.new('String', ["OWNERS_UNAVAILABLE"]) + unless validator.valid?(warning_code) + fail ArgumentError, "invalid value for \"warning_code\", must be one of #{validator.allowable_values}." + end + @warning_code = warning_code end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o)