Sha256: b8d48181c0e21adddc61981011416c7331ddfeb870acc77f6d5e3f5ae1ca79f7

Contents?: true

Size: 976 Bytes

Versions: 25

Compression:

Stored size: 976 Bytes

Contents

require 'pact_broker/db'
require 'pact_broker/json'

module PactBroker

  module Domain
    class Pact

      attr_accessor :id, :provider, :consumer_version, :consumer, :updated_at, :created_at, :json_content, :consumer_version_number

      def initialize attributes
        attributes.each_pair do | key, value |
          self.send(key.to_s + "=", value)
        end
      end

      def consumer
        consumer_version.pacticipant
      end

      def to_s
        "Pact: consumer=#{consumer.name} provider=#{provider.name}"
      end

      def to_json options = {}
        json_content
      end

      def name
        "Pact between #{consumer.name} (v#{consumer_version_number}) and #{provider.name}"
      end

      def version_and_updated_date
        "Version #{consumer_version_number} - #{updated_at.to_time.localtime.strftime("%d/%m/%Y")}"
      end

      def content_hash
        JSON.parse(json_content, PACT_PARSING_OPTIONS)
      end
    end

  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
pact_broker-1.18.0 lib/pact_broker/domain/pact.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/domain/pact.rb
pact_broker-1.17.2 lib/pact_broker/domain/pact.rb
pact_broker-1.17.1 lib/pact_broker/domain/pact.rb
pact_broker-1.17.0 lib/pact_broker/domain/pact.rb
pact_broker-1.16.0 lib/pact_broker/domain/pact.rb
pact_broker-1.15.0 lib/pact_broker/domain/pact.rb
pact_broker-1.14.0 lib/pact_broker/domain/pact.rb
pact_broker-1.13.0 lib/pact_broker/domain/pact.rb
pact_broker-1.12.0 lib/pact_broker/domain/pact.rb
pact_broker-1.11.2 lib/pact_broker/domain/pact.rb
pact_broker-1.11.1 lib/pact_broker/domain/pact.rb
pact_broker-1.11.0 lib/pact_broker/domain/pact.rb
pact_broker-1.10.0 lib/pact_broker/domain/pact.rb
pact_broker-1.9.3 lib/pact_broker/domain/pact.rb
pact_broker-1.9.2 lib/pact_broker/domain/pact.rb
pact_broker-1.9.1 lib/pact_broker/domain/pact.rb
pact_broker-1.9.0 lib/pact_broker/domain/pact.rb
pact_broker-1.9.0.rc1 lib/pact_broker/domain/pact.rb
pact_broker-1.8.1 lib/pact_broker/domain/pact.rb