Sha256: 7168537a6c870cf65b16fd310bf7eeb9decd67c8d407beb89fd4c6dbfc013c09
Contents?: true
Size: 660 Bytes
Versions: 2
Compression:
Stored size: 660 Bytes
Contents
module Pacto class ContractFactory attr_reader :schema def initialize(options = {}) @schema = options[:schema] || MetaSchema.new end def build(contract_files, host) contract_files.map { |file| build_from_file(file, host) } end def build_from_file(contract_path, host) contract_definition = File.read(contract_path) definition = JSON.parse(contract_definition) schema.validate definition request = RequestClause.new(host, definition['request']) response = ResponseClause.new(definition['response']) Contract.new(request, response, contract_path, definition['name']) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pacto-0.3.1 | lib/pacto/contract_factory.rb |
pacto-0.3.0 | lib/pacto/contract_factory.rb |