Class: PactBroker::Domain::Pact
- Inherits:
-
Object
- Object
- PactBroker::Domain::Pact
- Defined in:
- lib/pact_broker/domain/pact.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#consumer ⇒ Object
Returns the value of attribute consumer.
-
#consumer_version ⇒ Object
Returns the value of attribute consumer_version.
-
#consumer_version_number ⇒ Object
Returns the value of attribute consumer_version_number.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#head_tag_names ⇒ Object
Returns the value of attribute head_tag_names.
-
#id ⇒ Object
Returns the value of attribute id.
-
#json_content ⇒ Object
Returns the value of attribute json_content.
-
#latest_verification ⇒ Object
Returns the value of attribute latest_verification.
-
#pact_version_sha ⇒ Object
Returns the value of attribute pact_version_sha.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#revision_number ⇒ Object
Returns the value of attribute revision_number.
Instance Method Summary collapse
- #consumer_name ⇒ Object
- #consumer_version_tag_names ⇒ Object
- #content_hash ⇒ Object
-
#initialize(attributes) ⇒ Pact
constructor
A new instance of Pact.
- #name ⇒ Object
- #pact_publication_id ⇒ Object
- #provider_name ⇒ Object
- #to_json(options = {}) ⇒ Object
- #to_s ⇒ Object
- #version_and_updated_date ⇒ Object
Constructor Details
#initialize(attributes) ⇒ Pact
Returns a new instance of Pact.
11 12 13 14 15 |
# File 'lib/pact_broker/domain/pact.rb', line 11 def initialize attributes attributes.each_pair do | key, value | self.send(key.to_s + "=", value) end end |
Instance Attribute Details
#consumer ⇒ Object
Returns the value of attribute consumer.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def consumer @consumer end |
#consumer_version ⇒ Object
Returns the value of attribute consumer_version.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def consumer_version @consumer_version end |
#consumer_version_number ⇒ Object
Returns the value of attribute consumer_version_number.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def consumer_version_number @consumer_version_number end |
#created_at ⇒ Object
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def created_at @created_at end |
#head_tag_names ⇒ Object
Returns the value of attribute head_tag_names.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def head_tag_names @head_tag_names end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def id @id end |
#json_content ⇒ Object
Returns the value of attribute json_content.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def json_content @json_content end |
#latest_verification ⇒ Object
Returns the value of attribute latest_verification.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def latest_verification @latest_verification end |
#pact_version_sha ⇒ Object
Returns the value of attribute pact_version_sha.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def pact_version_sha @pact_version_sha end |
#provider ⇒ Object
Returns the value of attribute provider.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def provider @provider end |
#revision_number ⇒ Object
Returns the value of attribute revision_number.
9 10 11 |
# File 'lib/pact_broker/domain/pact.rb', line 9 def revision_number @revision_number end |
Instance Method Details
#consumer_name ⇒ Object
17 18 19 |
# File 'lib/pact_broker/domain/pact.rb', line 17 def consumer_name consumer.name end |
#consumer_version_tag_names ⇒ Object
29 30 31 |
# File 'lib/pact_broker/domain/pact.rb', line 29 def consumer_version_tag_names consumer_version..collect(&:name) end |
#content_hash ⇒ Object
49 50 51 |
# File 'lib/pact_broker/domain/pact.rb', line 49 def content_hash JSON.parse(json_content, PACT_PARSING_OPTIONS) end |
#name ⇒ Object
41 42 43 |
# File 'lib/pact_broker/domain/pact.rb', line 41 def name "Pact between #{consumer.name} (v#{consumer_version_number}) and #{provider.name}" end |
#pact_publication_id ⇒ Object
53 54 55 |
# File 'lib/pact_broker/domain/pact.rb', line 53 def pact_publication_id id end |
#provider_name ⇒ Object
21 22 23 |
# File 'lib/pact_broker/domain/pact.rb', line 21 def provider_name provider.name end |
#to_json(options = {}) ⇒ Object
37 38 39 |
# File 'lib/pact_broker/domain/pact.rb', line 37 def to_json = {} json_content end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/pact_broker/domain/pact.rb', line 33 def to_s "Pact: consumer=#{consumer.name} provider=#{provider.name}" end |
#version_and_updated_date ⇒ Object
45 46 47 |
# File 'lib/pact_broker/domain/pact.rb', line 45 def version_and_updated_date "Version #{consumer_version_number} - #{created_at.to_time.localtime.strftime("%d/%m/%Y")}" end |