Custom attribute writer method checking allowed values (enum).
 @param [Object] expiration_interval Object to be assigned
960629
def expiration_interval=(expiration_interval)
      validator = EnumAttributeValidator.new('String', ['minutes', 'hours', 'days'])
      unless validator.valid?(expiration_interval)
        fail ArgumentError, 'invalid value for "expiration_interval", must be one of #{validator.allowable_values}.'
      end
      @expiration_interval = expiration_interval
    end
290600
def setValidTo(self, value):
        

        valid_from = self.getValidFrom()
        valid_to = DateTime(value)
        interval = self.getExpirationInterval()

        if valid_from and interval:
            valid_to = valid_from + int(interval)
            self.getField("ValidTo").set(self, valid_to)
            logger.debug("Set ValidTo Date to: %r" % valid_to)
        else:
            # just set the value
            self.getField("ValidTo").set(self, valid_to)
1201983
def _validate_range(self, max_, min_, max_ex, min_ex, value, path, prefix):
        
        if not isinstance(value, int) and not isinstance(value, float):
            raise CoreError("Value must be a integer type")

        log.debug(
            u"Validate range : %s : %s : %s : %s : %s : %s",
            max_,
            min_,
            max_ex,
            min_ex,
            value,
            path,
        )

        if max_ is not None and max_ < value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', greater than max limit '{max_}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    max_=max_))

        if min_ is not None and min_ > value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', less than min limit '{min_}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    min_=min_))

        if max_ex is not None and max_ex <= value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', greater than or equals to max limit(exclusive) '{max_ex}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    max_ex=max_ex))

        if min_ex is not None and min_ex >= value:
                self.errors.append(SchemaError.SchemaErrorEntry(
                    msg=u"Type '{prefix}' has size of '{value}', less than or equals to min limit(exclusive) '{min_ex}'. Path: '{path}'",
                    path=path,
                    value=nativestr(value) if tt['str'](value) else value,
                    prefix=prefix,
                    min_ex=min_ex))
390244
def validate_wrap(self, value):
        '''  '''
        self.item_type.validate_wrap(value)

        if value not in self.values:
            self._fail_validation(value, 'Value was not in the enum values')
847599
def server_side_expiration=(expiration)
      raise JSS::InvalidDataError, 'Expiration must be a Time' unless expiration.is_a? Time
      @server_side_limitations[:expiration] = expiration
      @need_to_update = true
    end
445359
def __set_interval(self, value):
        '''
        
        '''
        if not isinstance(self, Interval):
            raise ValueError("'value' must be of type Interval")

        self.__interval = value
858057
def validate_ENUM(in_value, restriction):
    
    value = _get_val(in_value)
    if type(value) is list:
        for subval in value:
            if type(subval) is tuple:
                subval = subval[1]
            validate_ENUM(subval, restriction)
    else:
        if value not in restriction:
            raise ValidationError("ENUM : %s"%(restriction))
877296
def object_type=(object_type)
      validator = EnumAttributeValidator.new('String', ["ITEM", "DISCOUNT", "CATEGORY", "PLACEHOLDER"])
      unless validator.valid?(object_type)
        fail ArgumentError, "invalid value for 'object_type', must be one of #{validator.allowable_values}."
      end
      @object_type = object_type
    end
7924
def valid?
      return false if @status.nil?
      status_validator = EnumAttributeValidator.new('String', ['error'])
      return false unless status_validator.valid?(@status)
      return false if @errors.nil?
      true
    end
628933
def valid?
      return false if @name.nil?
      acl_validator = EnumAttributeValidator.new('String', ["public", "private"])
      return false unless acl_validator.valid?(@acl)
      return true
    end
90879
def sync=(sync)
      validator = EnumAttributeValidator.new('String', ["true", "false"])
      unless validator.valid?(sync)
        fail ArgumentError, "invalid value for 'sync', must be one of #{validator.allowable_values}."
      end
      @sync = sync
    end
946944
def valid?
      return false if @id.nil?
      return false if @test.nil?
      return false if @expired.nil?
      return false if @state.nil?
      state_validator = EnumAttributeValidator.new('String', ['pending', 'processed', 'invalid_data', 'error', 'image_download_failed', 'image_processing_failed', 'waiting_for_data_requests', 'liquid_syntax_error'])
      return false unless state_validator.valid?(@state)
      true
    end
153187
def valid?
      return false if @account_id.nil?
      return false if @date.nil?
      return false if @amount.nil?
      cleared_validator = EnumAttributeValidator.new('String', ['cleared', 'uncleared', 'reconciled'])
      return false unless cleared_validator.valid?(@cleared)
      flag_color_validator = EnumAttributeValidator.new('String', ['red', 'orange', 'yellow', 'green', 'blue', 'purple'])
      return false unless flag_color_validator.valid?(@flag_color)
      true
    end
43020
def attribute_prefix=(attribute_prefix)
      if attribute_prefix.nil?
        fail ArgumentError, "attribute_prefix cannot be nil"
      end

      if attribute_prefix.to_s.length < 1
        fail ArgumentError, "invalid value for 'attribute_prefix', the character length must be great than or equal to 1."
      end

      @attribute_prefix = attribute_prefix
    end
595562
def inclusion_type=(inclusion_type)
      validator = EnumAttributeValidator.new('String', ["ADDITIVE", "INCLUSIVE"])
      unless validator.valid?(inclusion_type)
        fail ArgumentError, "invalid value for 'inclusion_type', must be one of #{validator.allowable_values}."
      end
      @inclusion_type = inclusion_type
    end
418021
def discount_type=(discount_type)
      validator = EnumAttributeValidator.new('String', ["FIXED_PERCENTAGE", "FIXED_AMOUNT", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"])
      unless validator.valid?(discount_type)
        fail ArgumentError, "invalid value for 'discount_type', must be one of #{validator.allowable_values}."
      end
      @discount_type = discount_type
    end
934434
def valid_input?(input)
      case @attributes[:type]
      when :boolean
        [true,false].include?(input)
      when :enum
        raise MissingValuesError unless @attributes[:values]
        raise InvalidValuesError unless @attributes[:values].class == Array
        @attributes[:values].include?(input)
      when :string
        format = @attributes[:format] || :anything
        Validator.valid_input?(format, input)
      when :number
        [Integer, Fixnum].include?(input.class)
      when :timestamp
        # TODO timestamp pending
        # raise PendingBranchError
        true
      else
        false
      end
    end