lib/talon_one/models/import.rb in talon_one-2.2.0 vs lib/talon_one/models/import.rb in talon_one-2.3.0

- old
+ new

@@ -25,38 +25,16 @@ attr_accessor :account_id # The ID of the account that owns this entity. attr_accessor :user_id - # The name of the entity that was imported. + # The name of the entity that was imported. Possible values are Coupons and LoyaltyPoints. attr_accessor :entity # The number of members that imported. attr_accessor :amount - 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 { :'id' => :'id', :'created' => :'created', @@ -166,24 +144,12 @@ return false if @id.nil? return false if @created.nil? return false if @account_id.nil? return false if @user_id.nil? return false if @entity.nil? - entity_validator = EnumAttributeValidator.new('String', ["Coupon"]) - return false unless entity_validator.valid?(@entity) return false if @amount.nil? return false if @amount < 0 true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] entity Object to be assigned - def entity=(entity) - validator = EnumAttributeValidator.new('String', ["Coupon"]) - unless validator.valid?(entity) - fail ArgumentError, "invalid value for \"entity\", must be one of #{validator.allowable_values}." - end - @entity = entity end # Custom attribute writer method with validation # @param [Object] amount Value to be assigned def amount=(amount)