Custom attribute writer method checking allowed values (enum).
 @param [Object] calculation_phase Object to be assigned
504200
def calculation_phase=(calculation_phase)
      validator = EnumAttributeValidator.new('String', ["TAX_SUBTOTAL_PHASE", "TAX_TOTAL_PHASE"])
      unless validator.valid?(calculation_phase)
        fail ArgumentError, "invalid value for 'calculation_phase', must be one of #{validator.allowable_values}."
      end
      @calculation_phase = calculation_phase
    end
826716
def method=(method)
      validator = EnumAttributeValidator.new('String', ["ENUM", "FC"])
      unless validator.valid?(method)
        fail ArgumentError, "invalid value for 'method', must be one of #{validator.allowable_values}."
      end
      @method = method
    end
573126
def validate_enum_attribute(self, attribute: str,
                                candidates: Set[Union[str, int, float]]) -> None:
        
        self.add_errors(
            validate_enum_attribute(self.fully_qualified_name, self._spec, attribute, candidates))
1110062
def eac3_stereo_downmix_preference=(eac3_stereo_downmix_preference)
      validator = EnumAttributeValidator.new('String', ["m0", "m1", "m2", "m3"])
      unless validator.valid?(eac3_stereo_downmix_preference)
        fail ArgumentError, "invalid value for 'eac3_stereo_downmix_preference', must be one of #{validator.allowable_values}."
      end
      @eac3_stereo_downmix_preference = eac3_stereo_downmix_preference
    end
902655
def itemization_type=(itemization_type)
      validator = EnumAttributeValidator.new('String', ["ITEM", "CUSTOM_AMOUNT", "GIFT_CARD_ACTIVATION", "GIFT_CARD_RELOAD", "GIFT_CARD_UNKNOWN", "OTHER"])
      unless validator.valid?(itemization_type)
        fail ArgumentError, "invalid value for 'itemization_type', must be one of #{validator.allowable_values}."
      end
      @itemization_type = itemization_type
    end
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
496869
def valid_attribute?(attribute)
    case attr_type_for(attribute)
    when :bool
      validate_class_for(attribute, [TrueClass, FalseClass])
    when :datetime, :datetimecombo
      validate_class_for(attribute, [DateTime])
    when :int
      validate_class_for(attribute, [Fixnum, Float])
    else 
      if @attributes[attribute].blank?
        add_error(attribute, "cannot be blank")
      end
    end
  end
669529
def sort_order=(sort_order)
      validator = EnumAttributeValidator.new('String', ["DESC", "ASC"])
      unless validator.valid?(sort_order)
        fail ArgumentError, "invalid value for 'sort_order', must be one of #{validator.allowable_values}."
      end
      @sort_order = sort_order
    end
1089054
def signature_implementation=(signature_implementation)
      validator = EnumAttributeValidator.new('String', ["TextStamp", "TextAsImage"])
      if signature_implementation.to_i == 0
        unless validator.valid?(signature_implementation)
          raise ArgumentError, "invalid value for 'signature_implementation', must be one of #{validator.allowable_values}."
        end
        @signature_implementation = signature_implementation
      else
        @signature_implementation = validator.allowable_values[signature_implementation.to_i]
      end
    end
1204254
def each
      return enum_for(__method__) unless block_given?

      each_event { |v, _, _, i|
        break if i > 0
        yield v
      }
    end
1005486
def check_enum(enum, name=None, valid=None):
    
    name = name or 'enum'
    # Try to convert
    res = None
    if isinstance(enum, int):
        if hasattr(enum, 'name') and enum.name.startswith('GL_'):
            res = enum.name[3:].lower()
    elif isinstance(enum, string_types):
        res = enum.lower()
    # Check
    if res is None:
        raise ValueError('Could not determine string represenatation for'
                         'enum %r' % enum)
    elif valid and res not in valid:
        raise ValueError('Value of %s must be one of %r, not %r' % 
                         (name, valid, enum))
    return res
702830
def sort_field=(sort_field)
      validator = EnumAttributeValidator.new('String', ["DEFAULT", "CREATED_AT"])
      unless validator.valid?(sort_field)
        fail ArgumentError, "invalid value for 'sort_field', must be one of #{validator.allowable_values}."
      end
      @sort_field = sort_field
    end
180190
def audio_format=(audio_format)
      validator = EnumAttributeValidator.new('String', ["pcm_s24le", "pcm_s16le"])
      unless validator.valid?(audio_format)
        fail ArgumentError, "invalid value for 'audio_format', must be one of #{validator.allowable_values}."
      end
      @audio_format = audio_format
    end
1139067
def frequency=(frequency)
      validator = EnumAttributeValidator.new('String', ['never', 'daily', 'weekly', 'everyOtherWeek', 'twiceAMonth', 'every4Weeks', 'monthly', 'everyOtherMonth', 'every3Months', 'every4Months', 'twiceAYear', 'yearly', 'everyOtherYear'])
      unless validator.valid?(frequency)
        fail ArgumentError, 'invalid value for "frequency", must be one of #{validator.allowable_values}.'
      end
      @frequency = frequency
    end
844173
def phase_type(self, value):
        ''''''
        self._params.phase_type = value
        self._overwrite_lock.disable()
7316
def valid?
      return false if @payment_id.nil?
      return false if @type.nil?
      type_validator = EnumAttributeValidator.new('String', ["FULL", "PARTIAL"])
      return false unless type_validator.valid?(@type)
      return false if @reason.nil?
      return true
    end
140398
def translate_enum(attribute, &block)
      builder = Builder.new(self, attribute, &block)

      # User.translated_status(:active)
      define_singleton_method(builder.method_name_singular) do |key|
        I18n.translate("#{builder.i18n_scope}.#{builder.i18n_location(key)}", default: builder.i18n_default_location(key))
      end

      # @return [Array]
      # @example
      #   f.select_field :gender, f.object.class.translated_genders
      define_singleton_method(builder.method_name_plural) do
        public_send(builder.enum_klass_method_name).map do |key, value|
          [public_send(builder.method_name_singular, key), key, value]
        end
      end

      # @return [String]
      # @example
      #   @user.translated_gender
      define_method(builder.method_name_singular) do
        if (key = public_send(builder.enum_instance_method_name)).present?
          self.class.public_send(builder.method_name_singular, key)
        end
      end
    end