Sha256: 2e91abc8a50d9dc6939bca0b41f11d9c96472398fd9dd623159929c6a68c85fa

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

require_relative 'base_decorator'
require_relative 'verifiable_pact_decorator'
require 'pact_broker/api/pact_broker_urls'

module PactBroker
  module Api
    module Decorators
      class VerifiablePactsQueryDecorator < BaseDecorator
        collection :provider_version_tags

        collection :consumer_version_selectors, class: OpenStruct do
          property :tag
          property :latest, setter: ->(fragment:, represented:, **) { represented.latest = (fragment == 'true') }
        end


        def from_hash(*args)
          # Should remember how to do this via Representable...
          result = super
          result.consumer_version_selectors = [] if result.consumer_version_selectors.nil?
          result.provider_version_tags = [] if result.provider_version_tags.nil?
          result
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-2.40.0 lib/pact_broker/api/decorators/verifiable_pacts_query_decorator.rb
pact_broker-2.39.0 lib/pact_broker/api/decorators/verifiable_pacts_query_decorator.rb