lib/svix/models/endpoint_in.rb in svix-0.61.0 vs lib/svix/models/endpoint_in.rb in svix-0.62.0
- old
+ new
@@ -24,11 +24,11 @@
attr_accessor :filter_types
attr_accessor :rate_limit
- # The endpoint's verification secret. If `null` is passed, a secret is automatically generated.
+ # The endpoint's verification secret. If `null` is passed, a secret is automatically generated. Format: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24.
attr_accessor :secret
# Optional unique identifier for the endpoint
attr_accessor :uid
@@ -72,10 +72,15 @@
end
# List of attributes with nullable: true
def self.openapi_nullable
Set.new([
+ :'channels',
+ :'filter_types',
+ :'rate_limit',
+ :'secret',
+ :'uid',
])
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
@@ -151,11 +156,11 @@
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}$/)
+ 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
if !@uid.nil? && @uid.to_s.length > 256
@@ -194,11 +199,11 @@
# @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 !@secret.nil? && @secret !~ Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/)
+ 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?
return false if @url.to_s.length > 65536
@@ -232,10 +237,10 @@
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}$/)
+ pattern = Regexp.new(/^(whsec_)?[a-zA-Z0-9+\/=]{32,100}$/)
if !secret.nil? && secret !~ pattern
fail ArgumentError, "invalid value for \"secret\", must conform to the pattern #{pattern}."
end
@secret = secret