lib/svix/models/endpoint_in.rb in svix-0.65.1 vs lib/svix/models/endpoint_in.rb in svix-0.66.0

- old
+ new

@@ -156,10 +156,18 @@ 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 !@rate_limit.nil? && @rate_limit > 65535 + invalid_properties.push('invalid value for "rate_limit", must be smaller than or equal to 65535.') + end + + if !@rate_limit.nil? && @rate_limit < 1 + invalid_properties.push('invalid value for "rate_limit", must be greater than or equal to 1.') + end + pattern = Regexp.new(/^(whsec_)?[a-zA-Z0-9+\/=]{32,100}$/) if !@secret.nil? && @secret !~ pattern invalid_properties.push("invalid value for \"secret\", must conform to the pattern #{pattern}.") end @@ -199,10 +207,12 @@ # @return true if the model is valid def valid? return false if !@channels.nil? && @channels.length > 10 return false if !@channels.nil? && @channels.length < 1 return false if !@filter_types.nil? && @filter_types.length < 1 + return false if !@rate_limit.nil? && @rate_limit > 65535 + return false if !@rate_limit.nil? && @rate_limit < 1 return false if !@secret.nil? && @secret !~ Regexp.new(/^(whsec_)?[a-zA-Z0-9+\/=]{32,100}$/) return false if !@uid.nil? && @uid.to_s.length > 256 return false if !@uid.nil? && @uid.to_s.length < 1 return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/) return false if @url.nil? @@ -232,9 +242,23 @@ 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 @filter_types = filter_types + end + + # Custom attribute writer method with validation + # @param [Object] rate_limit Value to be assigned + def rate_limit=(rate_limit) + if !rate_limit.nil? && rate_limit > 65535 + fail ArgumentError, 'invalid value for "rate_limit", must be smaller than or equal to 65535.' + end + + if !rate_limit.nil? && rate_limit < 1 + fail ArgumentError, 'invalid value for "rate_limit", must be greater than or equal to 1.' + end + + @rate_limit = rate_limit end # Custom attribute writer method with validation # @param [Object] secret Value to be assigned def secret=(secret)