pact-message 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 987ee7a93d7e2486be29a279820a93a7189e85ca
4
- data.tar.gz: ca3015400a9b05d9af0755b80008dd722dfce8aa
3
+ metadata.gz: f54ca64733cb4974c13068aa5ed4412ba654c87a
4
+ data.tar.gz: 9ae451bed4b40ff3d547c26d9c3a118bd5c276fb
5
5
  SHA512:
6
- metadata.gz: c5e295846169414dfe580899215b7d048a4c53e1feb67f27cc606f6362a6d7f6d63f74928dee765ea83316aee1316ec30cc04a4b43e8f2395c83e44b644b514d
7
- data.tar.gz: 93d5e5bd4964a13f75ecc9cbbd45615480d784bc09e7c56e1d00d87ac4a85864f5cf8bb2cd8852a60944ee9d80583f2517441df663857b62d9eae8a56e6504ee
6
+ metadata.gz: 74890674a4e6e734ad6bbe9a61b1059e43936daf1eb5660bd4c38bb736072f7cd56bbbe371371631fdc8df884287b661058263fd76bcd5a222211ec5d3cc1656
7
+ data.tar.gz: c87fb12b7118e3703faae3fb21100f1d64b7cbf7e79321921997f8beb5d5253f479384bbee15fa5572e987fb6f8a5056454b2f1c439ffd90fb2d177dc854c612
@@ -21,8 +21,8 @@ module Pact
21
21
  @content = attributes[:content]
22
22
  end
23
23
 
24
- def self.from_hash hash
25
- content_hash = Pact::MatchingRules.merge(hash['content'], hash['content']['matchingRules'])
24
+ def self.from_hash hash, options
25
+ content_hash = Pact::MatchingRules.merge(hash['content'], hash['content']['matchingRules'], options)
26
26
  content = Pact::ConsumerContract::Message::Content.new(content_hash)
27
27
  new(symbolize_keys(hash).merge(content: content))
28
28
  end
@@ -9,7 +9,8 @@ module Pact
9
9
 
10
10
  def call(hash)
11
11
  hash = symbolize_keys(hash)
12
- interactions = hash[:messages].collect { |hash| Pact::ConsumerContract::Message.from_hash(hash)}
12
+ options = { pact_specification_version: pact_specification_version(hash) }
13
+ interactions = hash[:messages].collect { |hash| Pact::ConsumerContract::Message.from_hash(hash, options)}
13
14
  ConsumerContract.new(
14
15
  :consumer => ServiceConsumer.from_hash(hash[:consumer]),
15
16
  :provider => ServiceProvider.from_hash(hash[:provider]),
@@ -20,6 +21,15 @@ module Pact
20
21
  def can_parse?(hash)
21
22
  hash.key?('messages') || hash.key?(:messages)
22
23
  end
24
+
25
+ def pact_specification_version hash
26
+ # TODO handle all 3 ways of defining this...
27
+ # metadata.pactSpecificationVersion
28
+ maybe_pact_specification_version_1 = hash[:metadata] && hash[:metadata]['pactSpecification'] && hash[:metadata]['pactSpecification']['version']
29
+ maybe_pact_specification_version_2 = hash[:metadata] && hash[:metadata]['pactSpecificationVersion']
30
+ pact_specification_version = maybe_pact_specification_version_1 || maybe_pact_specification_version_2
31
+ pact_specification_version ? Pact::SpecificationVersion.new(pact_specification_version) : Pact::SpecificationVersion::NIL_VERSION
32
+ end
23
33
  end
24
34
  end
25
35
  end
@@ -1,5 +1,5 @@
1
1
  module Pact
2
2
  module Message
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
data/pact-message.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_runtime_dependency "pact-support", "1.2.99.alpha.1"
32
+ spec.add_runtime_dependency "pact-support", "~> 1.5"
33
33
  # pact-mock_service dependencies are Pact::ConsumerContractDecorator
34
34
  # and Pact::ConsumerContractWriter. Potentially we should extract
35
35
  # or duplicate these classes to remove the pact-mock_service dependency.
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pact-message
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Beth Skurrie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pact-support
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.99.alpha.1
19
+ version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.99.alpha.1
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pact-mock_service
29
29
  requirement: !ruby/object:Gem::Requirement