Class: PactBroker::Models::Pact
- Inherits:
-
Object
- Object
- PactBroker::Models::Pact
- Defined in:
- lib/pact_broker/models/pact.rb
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.
-
#id ⇒ Object
Returns the value of attribute id.
-
#json_content ⇒ Object
Returns the value of attribute json_content.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Pact
constructor
A new instance of Pact.
- #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.
10 11 12 13 14 |
# File 'lib/pact_broker/models/pact.rb', line 10 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.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def consumer @consumer end |
#consumer_version ⇒ Object
Returns the value of attribute consumer_version.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def consumer_version @consumer_version end |
#consumer_version_number ⇒ Object
Returns the value of attribute consumer_version_number.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def consumer_version_number @consumer_version_number end |
#created_at ⇒ Object
Returns the value of attribute created_at.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def id @id end |
#json_content ⇒ Object
Returns the value of attribute json_content.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def json_content @json_content end |
#provider ⇒ Object
Returns the value of attribute provider.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def provider @provider end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
8 9 10 |
# File 'lib/pact_broker/models/pact.rb', line 8 def updated_at @updated_at end |
Instance Method Details
#name ⇒ Object
28 29 30 |
# File 'lib/pact_broker/models/pact.rb', line 28 def name "Pact between #{consumer.name} (v#{consumer_version_number}) and #{provider.name}" end |
#to_json(options = {}) ⇒ Object
24 25 26 |
# File 'lib/pact_broker/models/pact.rb', line 24 def to_json = {} json_content end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/pact_broker/models/pact.rb', line 20 def to_s "Pact: provider_id=#{provider_id} created_at=#{created_at} updated_at=#{updated_at}" end |
#version_and_updated_date ⇒ Object
32 33 34 |
# File 'lib/pact_broker/models/pact.rb', line 32 def version_and_updated_date "Version #{consumer_version_number} - #{updated_at.to_time.localtime.strftime("%d/%m/%Y")}" end |