Class: PactBroker::Models::Webhook
- Inherits:
-
Object
- Object
- PactBroker::Models::Webhook
- Includes:
- Logging, PactBroker::Messages
- Defined in:
- lib/pact_broker/models/webhook.rb
Constant Summary
Constants included from Logging
Logging::LOG_DIR, Logging::LOG_FILE_NAME
Instance Attribute Summary collapse
-
#consumer ⇒ Object
Returns the value of attribute consumer.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#request ⇒ Object
Returns the value of attribute request.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
- #description ⇒ Object
-
#execute ⇒ Object
TODO retries.
-
#initialize(attributes = {}) ⇒ Webhook
constructor
A new instance of Webhook.
- #request_description ⇒ Object
- #to_s ⇒ Object
- #validate ⇒ Object
Methods included from Logging
Methods included from PactBroker::Messages
#message, #potential_duplicate_pacticipant_message
Constructor Details
#initialize(attributes = {}) ⇒ Webhook
Returns a new instance of Webhook.
16 17 18 19 20 21 22 23 |
# File 'lib/pact_broker/models/webhook.rb', line 16 def initialize attributes = {} @uuid = attributes[:uuid] @request = attributes[:request] @consumer = attributes[:consumer] @provider = attributes[:provider] @created_at = attributes[:created_at] @updated_at = attributes[:updated_at] end |
Instance Attribute Details
#consumer ⇒ Object
Returns the value of attribute consumer.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def consumer @consumer end |
#created_at ⇒ Object
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def created_at @created_at end |
#provider ⇒ Object
Returns the value of attribute provider.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def provider @provider end |
#request ⇒ Object
Returns the value of attribute request.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def request @request end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def updated_at @updated_at end |
#uuid ⇒ Object
Returns the value of attribute uuid.
14 15 16 |
# File 'lib/pact_broker/models/webhook.rb', line 14 def uuid @uuid end |
Instance Method Details
#description ⇒ Object
32 33 34 |
# File 'lib/pact_broker/models/webhook.rb', line 32 def description "A webhook for the pact between #{consumer.name} and #{provider.name}" end |
#execute ⇒ Object
TODO retries
41 42 43 44 |
# File 'lib/pact_broker/models/webhook.rb', line 41 def execute logger.info "Executing #{self}" request.execute end |
#request_description ⇒ Object
36 37 38 |
# File 'lib/pact_broker/models/webhook.rb', line 36 def request_description request && request.description end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/pact_broker/models/webhook.rb', line 46 def to_s "webhook for consumer=#{consumer.name} provider=#{provider.name} uuid=#{uuid} request=#{request}" end |
#validate ⇒ Object
25 26 27 28 29 30 |
# File 'lib/pact_broker/models/webhook.rb', line 25 def validate = [] << ('errors.validation.attribute_missing', attribute: 'request') unless request .concat request.validate if request end |