Class: PactBroker::Integrations::Integration
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- PactBroker::Integrations::Integration
- Defined in:
- lib/pact_broker/integrations/integration.rb
Constant Summary collapse
- LATEST_PACT_EAGER_LOADER =
When viewing the index, every latest_pact in the database will match at least one of the rows, so it makes sense to load the entire table and match each pact to the appropriate row. Update: now we have pagination, we should probably filter the pacts by consumer/provider id.
proc do |eo_opts| eo_opts[:rows].each do |integration| integration.associations[:latest_pact] = [] end PactBroker::Pacts::PactPublication.overall_latest.each do | pact | eo_opts[:rows].each do | integration | if integration.consumer_id == pact.consumer_id && integration.provider_id == pact.provider_id integration.associations[:latest_pact] = pact end end end end
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #latest_pact_or_verification_publication_date ⇒ Object
- #latest_verification_publication_date ⇒ Object
- #verification_status_for_latest_pact ⇒ Object
Instance Method Details
#<=>(other) ⇒ Object
68 69 70 |
# File 'lib/pact_broker/integrations/integration.rb', line 68 def <=>(other) [consumer.name.downcase, provider.name.downcase] <=> [other.consumer.name.downcase, other.provider.name.downcase] end |
#latest_pact_or_verification_publication_date ⇒ Object
60 61 62 |
# File 'lib/pact_broker/integrations/integration.rb', line 60 def latest_pact_or_verification_publication_date [latest_pact.created_at, latest_verification_publication_date].compact.max end |
#latest_verification_publication_date ⇒ Object
64 65 66 |
# File 'lib/pact_broker/integrations/integration.rb', line 64 def latest_verification_publication_date latest_verification&.execution_date end |
#verification_status_for_latest_pact ⇒ Object
56 57 58 |
# File 'lib/pact_broker/integrations/integration.rb', line 56 def verification_status_for_latest_pact @verification_status_for_latest_pact ||= PactBroker::Verifications::PseudoBranchStatus.new(latest_pact, latest_pact&.latest_verification) end |