module PactBroker::Api::Contracts::ValidationHelpers
Public Instance Methods
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 22 def blank?(value) value&.blank? end
@return true if there is a value present, and it only contains whitespace
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 57 def environment_with_name_exists?(value) PactBroker::Services.environment_service.find_by_name(value) end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 17 def includes_space?(value) value && value.is_a?(String) && value.include?(" ") end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 13 def multiple_lines?(value) value && value.is_a?(String) && value.include?("\n") end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 37 def not_provided?(value) !provided?(value) end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 53 def pacticipant_with_name_exists?(value) PactBroker::Services.pacticipant_service.find_pacticipant_by_name(value) end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 29 def provided?(value) if value.is_a?(String) value.strip.size > 0 else !value.nil? end end
The tins gem has screwed up the present? method by not using refinements Return true if the object is not nil, and if a String, is not blank. @param [Object]
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 47 def valid_http_method?(http_method) Net::HTTP.const_defined?(http_method.capitalize) rescue StandardError false end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 41 def valid_url?(url) URI(url) rescue URI::InvalidURIError, ArgumentError false end
Source
# File lib/pact_broker/api/contracts/validation_helpers.rb, line 61 def valid_version_number?(value) if PactBroker.configuration.order_versions_by_date true else !!PactBroker.configuration.version_parser.call(value) end end