Sha256: c9571814cb32c75b16f2bd3a00402f591cdfabc7d3f31c9a788000db40586031
Contents?: true
Size: 709 Bytes
Versions: 2
Compression:
Stored size: 709 Bytes
Contents
module Pact class HttpConsumerContractParser include SymbolizeKeys def call(hash) hash = symbolize_keys(hash) interactions = if hash[:interactions] hash[:interactions].collect { |hash| Interaction.from_hash(hash)} elsif hash[:messages] hash[:messages].collect { |hash| Message.from_hash(hash)} else [] # or raise an error? end ConsumerContract.new( :consumer => ServiceConsumer.from_hash(hash[:consumer]), :provider => ServiceProvider.from_hash(hash[:provider]), :interactions => interactions ) end def can_parse?(hash) hash.key?('interactions') || hash.key?(:interactions) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact-support-1.2.99.alpha.1 | lib/pact/consumer_contract/http_consumer_contract_parser.rb |
pact-support-1.3.0.alpha.2 | lib/pact/consumer_contract/http_consumer_contract_parser.rb |