Sha256: f22d1cbe077fb1be138b58ebb7cf0159942b40a71de0d3e069d4803711282e86
Contents?: true
Size: 587 Bytes
Versions: 5
Compression:
Stored size: 587 Bytes
Contents
require "active_support/core_ext/object/to_param" require "dry-validation" module Tangany class ApplicationContract < Dry::Validation::Contract ALLOWED_SORTS = ["asc", "desc"].freeze COUNTRY_CODE_REGEX = %r{[A-Z]{2}} DATE_REGEX = %r{[0-9]{4}-[0-9]{2}-[0-9]{2}} DATETIME_REGEX = %r{[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z} ETHEREUM_ADDRESS_REGEX = %r{^0x[a-fA-F0-9]{40}$} def to_safe_params!(params) response = call(params) raise InputError, response.errors.to_h if response.failure? response.to_h end end end
Version data entries
5 entries across 5 versions & 1 rubygems