Class: PactBroker::Pacts::PactPublication
- Inherits:
-
Object
- Object
- PactBroker::Pacts::PactPublication
- Extended by:
- Forwardable
- Defined in:
- lib/pact_broker/pacts/pact_publication.rb
Instance Method Summary collapse
- #before_create ⇒ Object
- #consumer_version_tags ⇒ Object
-
#head_tag_names ⇒ Object
The names of the tags for which this pact is the latest pact with that tag (ie. it is not necessarily the pact for the latest consumer version with the given tag).
- #latest_verification ⇒ Object
- #to_domain ⇒ Object
- #to_domain_lightweight ⇒ Object
- #to_version_domain ⇒ Object
- #to_version_domain_lightweight ⇒ Object
Instance Method Details
#before_create ⇒ Object
105 106 107 108 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 105 def before_create super self.revision_number ||= 1 end |
#consumer_version_tags ⇒ Object
116 117 118 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 116 def consumer_version. end |
#head_tag_names ⇒ Object
The names of the tags for which this pact is the latest pact with that tag (ie. it is not necessarily the pact for the latest consumer version with the given tag)
112 113 114 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 112 def head_tag_names LatestTaggedPactPublications.where(id: id).select(:tag_name).collect{|t| t[:tag_name]} end |
#latest_verification ⇒ Object
120 121 122 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 120 def latest_verification pact_version.latest_verification end |
#to_domain ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 124 def to_domain PactBroker::Domain::Pact.new( id: id, provider: provider, consumer: consumer, consumer_version_number: consumer_version.number, consumer_version: to_version_domain, revision_number: revision_number, json_content: pact_version.content, pact_version_sha: pact_version.sha, latest_verification: pact_version.latest_verification, created_at: created_at, head_tag_names: [], db_model: self ) end |
#to_domain_lightweight ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 141 def to_domain_lightweight PactBroker::Domain::Pact.new( id: id, provider: provider, consumer: consumer, consumer_version_number: consumer_version.number, consumer_version: to_version_domain_lightweight, revision_number: revision_number, pact_version_sha: pact_version.sha, created_at: created_at, db_model: self ) end |
#to_version_domain ⇒ Object
155 156 157 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 155 def to_version_domain OpenStruct.new(number: consumer_version.number, pacticipant: consumer, tags: consumer_version., order: consumer_version.order) end |
#to_version_domain_lightweight ⇒ Object
159 160 161 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 159 def to_version_domain_lightweight OpenStruct.new(number: consumer_version.number, pacticipant: consumer, order: consumer_version.order) end |