Class: Pact::Message::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/pact/message/cli.rb

Instance Method Summary collapse

Instance Method Details

#reify(json) ⇒ Object



32
33
34
35
# File 'lib/pact/message/cli.rb', line 32

def reify(json)
  require 'pact/support'
  puts Pact::Reification.from_term(JSON.load(json)).to_json
end

#update(maybe_json = '-') ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/pact/message/cli.rb', line 20

def update(maybe_json = '-')
  require 'pact/message'
  require 'pact/message/consumer/write_pact'

  message_json = JSON.parse(maybe_json == '-' ? $stdin.read : maybe_json)

  pact_specification_version = Pact::SpecificationVersion.new(options.pact_specification_version)
  message_hash = Pact::Message.from_hash(message_json, { pact_specification_version: pact_specification_version })
  Pact::Message::Consumer::WritePact.call(message_hash, options.pact_dir, options.consumer, options.provider, options.pact_specification_version, :update)
end

#versionObject



38
39
40
41
# File 'lib/pact/message/cli.rb', line 38

def version
  require 'pact/message/version.rb'
  puts Pact::Message::VERSION
end