Sha256: bfaf4ec0c35033437eae3064fba421c07f2654bb42c35800681a4c3b9d8614e6

Contents?: true

Size: 1.18 KB

Versions: 31

Compression:

Stored size: 1.18 KB

Contents

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

module PactBroker

  module Domain
    class Pact

      attr_accessor :id, :provider, :consumer_version, :consumer, :created_at, :json_content, :consumer_version_number, :revision_number, :pact_version_sha

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

      def consumer_name
        consumer.name
      end

      def provider_name
        provider.name
      end

      def consumer
        consumer_version.pacticipant
      end

      def consumer_version_tag_names
        consumer_version.tags.collect(&:name)
      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} - #{created_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

31 entries across 31 versions & 1 rubygems

Version Path
pact_broker-2.20.0 lib/pact_broker/domain/pact.rb
pact_broker-2.19.2 lib/pact_broker/domain/pact.rb
pact_broker-2.19.1 lib/pact_broker/domain/pact.rb
pact_broker-2.19.0 lib/pact_broker/domain/pact.rb
pact_broker-2.18.0 lib/pact_broker/domain/pact.rb
pact_broker-2.17.1 lib/pact_broker/domain/pact.rb
pact_broker-2.17.0 lib/pact_broker/domain/pact.rb
pact_broker-2.16.1 lib/pact_broker/domain/pact.rb
pact_broker-2.16.0 lib/pact_broker/domain/pact.rb
pact_broker-2.15.0 lib/pact_broker/domain/pact.rb
pact_broker-2.14.0 lib/pact_broker/domain/pact.rb
pact_broker-2.13.1 lib/pact_broker/domain/pact.rb
pact_broker-2.13.0 lib/pact_broker/domain/pact.rb
pact_broker-2.12.0 lib/pact_broker/domain/pact.rb
pact_broker-2.11.0 lib/pact_broker/domain/pact.rb
pact_broker-2.10.0 lib/pact_broker/domain/pact.rb
pact_broker-2.9.0 lib/pact_broker/domain/pact.rb
pact_broker-2.9.0.beta.5 lib/pact_broker/domain/pact.rb
pact_broker-2.8.0.beta.5 lib/pact_broker/domain/pact.rb
pact_broker-2.8.0.beta.4 lib/pact_broker/domain/pact.rb