lib/svix/models/template_patch.rb in svix-1.11.0 vs lib/svix/models/template_patch.rb in svix-1.12.0

- old
+ new

@@ -15,10 +15,12 @@ module Svix class TemplatePatch attr_accessor :description + attr_accessor :feature_flag + attr_accessor :filter_types attr_accessor :instructions attr_accessor :instructions_link @@ -31,10 +33,11 @@ # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'description' => :'description', + :'feature_flag' => :'featureFlag', :'filter_types' => :'filterTypes', :'instructions' => :'instructions', :'instructions_link' => :'instructionsLink', :'logo' => :'logo', :'name' => :'name', @@ -49,10 +52,11 @@ # Attribute type mapping. def self.openapi_types { :'description' => :'String', + :'feature_flag' => :'String', :'filter_types' => :'Array<String>', :'instructions' => :'String', :'instructions_link' => :'String', :'logo' => :'String', :'name' => :'String', @@ -61,10 +65,11 @@ end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'feature_flag', :'filter_types', :'instructions_link', ]) end @@ -85,10 +90,14 @@ if attributes.key?(:'description') self.description = attributes[:'description'] end + if attributes.key?(:'feature_flag') + self.feature_flag = attributes[:'feature_flag'] + end + if attributes.key?(:'filter_types') if (value = attributes[:'filter_types']).is_a?(Array) self.filter_types = value end end @@ -116,10 +125,19 @@ # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new + if !@feature_flag.nil? && @feature_flag.to_s.length > 256 + invalid_properties.push('invalid value for "feature_flag", the character length must be smaller than or equal to 256.') + end + + pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) + if !@feature_flag.nil? && @feature_flag !~ pattern + invalid_properties.push("invalid value for \"feature_flag\", must conform to the pattern #{pattern}.") + end + if !@filter_types.nil? && @filter_types.length < 1 invalid_properties.push('invalid value for "filter_types", number of items must be greater than or equal to 1.') end if !@transformation.nil? && @transformation.to_s.length > 51200 @@ -134,17 +152,34 @@ end # 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 !@feature_flag.nil? && @feature_flag.to_s.length > 256 + return false if !@feature_flag.nil? && @feature_flag !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/) return false if !@filter_types.nil? && @filter_types.length < 1 return false if !@transformation.nil? && @transformation.to_s.length > 51200 return false if !@transformation.nil? && @transformation.to_s.length < 10 true end # Custom attribute writer method with validation + # @param [Object] feature_flag Value to be assigned + def feature_flag=(feature_flag) + if !feature_flag.nil? && feature_flag.to_s.length > 256 + fail ArgumentError, 'invalid value for "feature_flag", the character length must be smaller than or equal to 256.' + end + + pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) + if !feature_flag.nil? && feature_flag !~ pattern + fail ArgumentError, "invalid value for \"feature_flag\", must conform to the pattern #{pattern}." + end + + @feature_flag = feature_flag + end + + # Custom attribute writer method with validation # @param [Object] filter_types Value to be assigned def filter_types=(filter_types) if !filter_types.nil? && filter_types.length < 1 fail ArgumentError, 'invalid value for "filter_types", number of items must be greater than or equal to 1.' end @@ -170,10 +205,11 @@ # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && description == o.description && + feature_flag == o.feature_flag && filter_types == o.filter_types && instructions == o.instructions && instructions_link == o.instructions_link && logo == o.logo && name == o.name && @@ -187,10 +223,10 @@ end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [description, filter_types, instructions, instructions_link, logo, name, transformation].hash + [description, feature_flag, filter_types, instructions, instructions_link, logo, name, transformation].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself