Sha256: 4706ec6c0bf5d2221fbaa030804168880b4e5bef19332df158caae5a1d2e7c77

Contents?: true

Size: 1.74 KB

Versions: 20

Compression:

Stored size: 1.74 KB

Contents

require 'pact_broker/pacts/latest_pact_publications_by_consumer_version'
require 'pact_broker/pacts/head_pact'

module PactBroker
  module Pacts
    class LatestTaggedPactPublications < LatestPactPublicationsByConsumerVersion
      set_dataset(:latest_tagged_pact_publications)

      dataset_module do
        def where_age_less_than(days)
          start_date = Date.today - days
          where{ latest_tagged_pact_publications[:created_at] >= start_date }
        end

        def for_selector(selector)
          query = self
          query = query.where(consumer_name: selector.pacticipant_name) if selector.pacticipant_name
          query = query.where(tag_name: selector.tag) if selector.tag && selector.tag.is_a?(String)
          query = query.where_age_less_than(selector.max_age) if selector.max_age
          query
        end
      end

      def to_domain
        HeadPact.new(super, consumer_version_number, tag_name)
      end
    end
  end
end

# Table: latest_tagged_pact_publications
# Columns:
#  id                      | integer                     |
#  consumer_id             | integer                     |
#  consumer_name           | text                        |
#  consumer_version_id     | integer                     |
#  consumer_version_number | text                        |
#  consumer_version_order  | integer                     |
#  provider_id             | integer                     |
#  provider_name           | text                        |
#  revision_number         | integer                     |
#  pact_version_id         | integer                     |
#  pact_version_sha        | text                        |
#  created_at              | timestamp without time zone |
#  tag_name                | text                        |

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.79.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.78.1 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.78.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.77.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.76.2 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.76.1 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.76.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.75.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.74.1 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.74.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.73.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.72.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.71.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.70.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.69.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.68.1 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.68.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.67.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb
pact_broker-2.66.0 lib/pact_broker/pacts/latest_tagged_pact_publications.rb