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
112 113 114 115 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 112 def before_create super self.revision_number ||= 1 end |
#consumer_version_tags ⇒ Object
123 124 125 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 123 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)
119 120 121 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 119 def head_tag_names @head_tag_names ||= PactBroker::Domain::Tag.(self).collect(&:name) end |
#latest_verification ⇒ Object
127 128 129 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 127 def latest_verification pact_version.latest_verification end |
#to_domain ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 131 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
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 148 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
162 163 164 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 162 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
166 167 168 |
# File 'lib/pact_broker/pacts/pact_publication.rb', line 166 def to_version_domain_lightweight OpenStruct.new(number: consumer_version.number, pacticipant: consumer, order: consumer_version.order) end |