Sha256: d1a5b75fe7753efb7c03991b1c86dae222083f165ac9af9f8042d7d5ee6c1bb9
Contents?: true
Size: 1.04 KB
Versions: 41
Compression:
Stored size: 1.04 KB
Contents
require 'reform' require 'reform/form' module PactBroker module Api module Contracts class WebhookContract < Reform::Form property :request validation do configure do config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__) end required(:request).filled end property :request do property :url property :http_method validation do configure do config.messages_file = File.expand_path("../../../locale/en.yml", __FILE__) def valid_method?(value) Net::HTTP.const_defined?(value.capitalize) end def valid_url?(value) uri = URI(value) uri.scheme && uri.host rescue URI::InvalidURIError false end end required(:http_method).filled(:valid_method?) required(:url).filled(:valid_url?) end end end end end end
Version data entries
41 entries across 41 versions & 1 rubygems