lib/svix/models/endpoint_in.rb in svix-0.32.0 vs lib/svix/models/endpoint_in.rb in svix-0.34.1
- old
+ new
@@ -128,10 +128,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 !@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
+
+ pattern = Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/)
+ if !@secret.nil? && @secret !~ pattern
+ invalid_properties.push("invalid value for \"secret\", must conform to the pattern #{pattern}.")
+ end
+
if !@uid.nil? && @uid.to_s.length > 256
invalid_properties.push('invalid value for "uid", the character length must be smaller than or equal to 256.')
end
if !@uid.nil? && @uid.to_s.length < 1
@@ -163,10 +172,12 @@
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 !@filter_types.nil? && @filter_types.length < 1
+ return false if !@secret.nil? && @secret !~ Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/)
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?
return false if @url.to_s.length > 65536
@@ -176,10 +187,25 @@
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
+
@filter_types = filter_types
+ end
+
+ # Custom attribute writer method with validation
+ # @param [Object] secret Value to be assigned
+ def secret=(secret)
+ pattern = Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/)
+ if !secret.nil? && secret !~ pattern
+ fail ArgumentError, "invalid value for \"secret\", must conform to the pattern #{pattern}."
+ end
+
+ @secret = secret
end
# Custom attribute writer method with validation
# @param [Object] uid Value to be assigned
def uid=(uid)