Sha256: 9d18fa5f759d5afbc0cd2a1e9982df1322de4f8d42586005ad4b8b82e3c0a229

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'pact_broker/db'

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: provider_id=#{provider_id} created_at=#{created_at} updated_at=#{updated_at}"
      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
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-1.3.2.rc1 lib/pact_broker/domain/pact.rb