Skip to content

Commit

Permalink
Merge pull request #237 from lob/feature/MI-226-fix-regex-warning
Browse files Browse the repository at this point in the history
MI-226 fix: regex warning
  • Loading branch information
mrkaspa authored Apr 25, 2024
2 parents 069bb1c + c6341c7 commit f88113e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 49 deletions.
6 changes: 3 additions & 3 deletions lib/lob/models/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def list_invalid_properties
invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if !@signature_url.nil? && @signature_url !~ pattern
invalid_properties.push("invalid value for \"signature_url\", must conform to the pattern #{pattern}.")
end
Expand Down Expand Up @@ -293,7 +293,7 @@ def valid?
return false if @signatory.to_s.length > 30
return false if @id.nil?
return false if @id !~ Regexp.new(/^bank_[a-zA-Z0-9]+$/)
return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if !@signature_url.nil? && @signature_url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
return false if @date_created.nil?
return false if @date_modified.nil?
return false if @object.nil?
Expand Down Expand Up @@ -392,7 +392,7 @@ def id=(id)
# Custom attribute writer method with validation
# @param [Object] signature_url Value to be assigned
def signature_url=(signature_url)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if !signature_url.nil? && signature_url !~ pattern
fail ArgumentError, "invalid value for \"signature_url\", must conform to the pattern #{pattern}."
end
Expand Down
6 changes: 3 additions & 3 deletions lib/lob/models/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def list_invalid_properties
invalid_properties.push('invalid value for "url", url cannot be nil.')
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if @url !~ pattern
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
end
Expand Down Expand Up @@ -447,7 +447,7 @@ def valid?
return false if !@check_bottom_template_version_id.nil? && @check_bottom_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)
return false if !@attachment_template_version_id.nil? && @attachment_template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)
return false if @url.nil?
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
return false if @carrier.nil?
carrier_validator = EnumAttributeValidator.new('String', ["USPS"])
return false unless carrier_validator.valid?(@carrier)
Expand Down Expand Up @@ -605,7 +605,7 @@ def url=(url)
fail ArgumentError, 'url cannot be nil'
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if url !~ pattern
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
end
Expand Down
23 changes: 4 additions & 19 deletions lib/lob/models/letter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Letter
# The tracking number, if applicable, will appear here when it becomes available. Dummy tracking numbers are not created in test mode.
attr_accessor :tracking_number

# Tracking events are not populated for registered or regular (no extra service) letters.
# An array of tracking_event objects ordered by ascending `time`. Will not be populated for letters created in test mode.
attr_accessor :tracking_events

# Specifies the address the return envelope will be sent back to. This is an optional argument that is available if an account is signed up for the return envelope tracking beta, and has `return_envelope`, and `perforated_page` fields populated in the API request.
Expand Down Expand Up @@ -401,7 +401,7 @@ def list_invalid_properties
invalid_properties.push("invalid value for \"template_version_id\", must conform to the pattern #{pattern}.")
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if !@url.nil? && @url !~ pattern
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
end
Expand All @@ -414,10 +414,6 @@ def list_invalid_properties
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.')
end

if !@tracking_events.nil? && @tracking_events.length > 0
invalid_properties.push('invalid value for "tracking_events", number of items must be less than or equal to 0.')
end

invalid_properties
end

Expand All @@ -434,12 +430,11 @@ def valid?
return false if @id !~ Regexp.new(/^ltr_[a-zA-Z0-9]+$/)
return false if !@template_id.nil? && @template_id !~ Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)
return false if !@template_version_id.nil? && @template_version_id !~ Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)
return false if !@url.nil? && @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if !@url.nil? && @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
return false if @object.nil?
object_validator = EnumAttributeValidator.new('String', ["letter"])
return false unless object_validator.valid?(@object)
return false if !@description.nil? && @description.to_s.length > 255
return false if !@tracking_events.nil? && @tracking_events.length > 0
address_placement_validator = EnumAttributeValidator.new('String', ["top_first_page", "insert_blank_page", "bottom_first_page_center", "bottom_first_page"])
return false unless address_placement_validator.valid?(@address_placement)
true
Expand Down Expand Up @@ -495,7 +490,7 @@ def template_version_id=(template_version_id)
# Custom attribute writer method with validation
# @param [Object] url Value to be assigned
def url=(url)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if !url.nil? && url !~ pattern
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
end
Expand Down Expand Up @@ -535,16 +530,6 @@ def merge_variables=(merge_variables)
@merge_variables = merge_variables
end

# Custom attribute writer method with validation
# @param [Object] tracking_events Value to be assigned
def tracking_events=(tracking_events)
if !tracking_events.nil? && tracking_events.length > 0
fail ArgumentError, 'invalid value for "tracking_events", number of items must be less than or equal to 0.'
end

@tracking_events = tracking_events
end

# Custom attribute writer method checking allowed values (enum).
# @param [Object] address_placement Object to be assigned
def address_placement=(address_placement)
Expand Down
6 changes: 3 additions & 3 deletions lib/lob/models/postcard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def list_invalid_properties
invalid_properties.push('invalid value for "url", url cannot be nil.')
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if @url !~ pattern
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
end
Expand All @@ -360,7 +360,7 @@ def valid?
object_validator = EnumAttributeValidator.new('String', ["postcard"])
return false unless object_validator.valid?(@object)
return false if @url.nil?
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
return false if !@description.nil? && @description.to_s.length > 255
true
end
Expand Down Expand Up @@ -451,7 +451,7 @@ def url=(url)
fail ArgumentError, 'url cannot be nil'
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if url !~ pattern
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
end
Expand Down
10 changes: 5 additions & 5 deletions lib/lob/models/self_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SelfMailer
# Value is resource type.
attr_accessor :object

# An array of tracking events ordered by ascending `time`. Not populated in test mode.
# An array of certified tracking events ordered by ascending `time`. Not populated in test mode.
attr_accessor :tracking_events

# A [signed link](#section/Asset-URLs) served over HTTPS. The link returned will expire in 30 days to prevent mis-sharing. Each time a GET request is initiated, a new signed URL will be generated.
Expand Down Expand Up @@ -128,7 +128,7 @@ def self.openapi_types
:'outside_template_version_id' => :'String',
:'inside_template_version_id' => :'String',
:'object' => :'String',
:'tracking_events' => :'Array<TrackingEventNormal>',
:'tracking_events' => :'Array<TrackingEventCertified>',
:'url' => :'String',
:'use_type' => :'SfmUseType'
}
Expand Down Expand Up @@ -284,7 +284,7 @@ def list_invalid_properties
invalid_properties.push('invalid value for "url", url cannot be nil.')
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if @url !~ pattern
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
end
Expand All @@ -305,7 +305,7 @@ def valid?
object_validator = EnumAttributeValidator.new('String', ["self_mailer"])
return false unless object_validator.valid?(@object)
return false if @url.nil?
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
true
end

Expand Down Expand Up @@ -407,7 +407,7 @@ def url=(url)
fail ArgumentError, 'url cannot be nil'
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if url !~ pattern
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
end
Expand Down
10 changes: 5 additions & 5 deletions lib/lob/models/snap_pack.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=begin
#Lob
#The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors. <p> Looking for our [previous documentation](https://lob.github.io/legacy-docs/)?
#The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors. <p> Looking for our [previous documentation](https://lob.github.io/legacy-docs/)?
The version of the OpenAPI document: 1.3.0
Contact: [email protected]
Expand All @@ -24,7 +24,7 @@ class SnapPack

attr_accessor :size

# An internal description that identifies this resource. Must be no longer than 255 characters.
# An internal description that identifies this resource. Must be no longer than 255 characters.
attr_accessor :description

# Use metadata to store custom information for tagging and labeling back to your internal systems. Must be an object with up to 20 key-value pairs. Keys must be at most 40 characters and values must be at most 500 characters. Neither can contain the characters `\"` and `\\`. i.e. '{\"customer_id\" : \"NEWYORK2015\"}' Nested objects are not supported. See [Metadata](#section/Metadata) for more information.
Expand Down Expand Up @@ -284,7 +284,7 @@ def list_invalid_properties
invalid_properties.push('invalid value for "url", url cannot be nil.')
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if @url !~ pattern
invalid_properties.push("invalid value for \"url\", must conform to the pattern #{pattern}.")
end
Expand All @@ -305,7 +305,7 @@ def valid?
object_validator = EnumAttributeValidator.new('String', ["snap_pack"])
return false unless object_validator.valid?(@object)
return false if @url.nil?
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
return false if @url !~ Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
true
end

Expand Down Expand Up @@ -407,7 +407,7 @@ def url=(url)
fail ArgumentError, 'url cannot be nil'
end

pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9-_]+/)
pattern = Regexp.new(/^https:\/\/lob-assets.com\/(letters|postcards|bank-accounts|checks|self-mailers|cards)\/[a-z]{3,4}_[a-z0-9]{15,16}(_signature)?(\.pdf|_thumb_[a-z]+_[0-9]+\.png|\.png)\?(version=[a-z0-9]*&)expires=[0-9]{10}&signature=[a-zA-Z0-9_-]+/)
if url !~ pattern
fail ArgumentError, "invalid value for \"url\", must conform to the pattern #{pattern}."
end
Expand Down
Loading

0 comments on commit f88113e

Please sign in to comment.