Sha256: eb2f97d66a9176e513e59758a68f01dd193ad86d8f3a258b56416fc0b76485af

Contents?: true

Size: 581 Bytes

Versions: 121

Compression:

Stored size: 581 Bytes

Contents

require 'json'
require 'pact_broker/client/pact_hash'

module PactBroker
  module Client
    class PactFile
      def initialize path
        @path = path
      end

      def path
        @path
      end

      def pact_name
        pact_hash.pact_name
      end

      def consumer_name
        pact_hash.consumer_name
      end

      def provider_name
        pact_hash.provider_name
      end

      def pact_hash
        @pact_hash ||= PactHash[JSON.parse(read, symbolize_names: true)]
      end

      def read
        @read ||= File.read(@path)
      end
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
pact_broker-client-1.5.0 lib/pact_broker/client/pact_file.rb