Class: PactBroker::Webhooks::TriggeredWebhook
- Inherits:
-
Object
- Object
- PactBroker::Webhooks::TriggeredWebhook
- Defined in:
- lib/pact_broker/webhooks/triggered_webhook.rb
Direct Known Subclasses
Constant Summary collapse
- TRIGGER_TYPE_RESOURCE_CREATION =
"resource_creation"
- TRIGGER_TYPE_USER =
"user"
- STATUS_NOT_RUN =
"not_run".freeze
- STATUS_RETRYING =
"retrying".freeze
- STATUS_SUCCESS =
"success".freeze
- STATUS_FAILURE =
"failure".freeze
Instance Method Summary collapse
- #consumer_name ⇒ Object
- #execute(options) ⇒ Object
- #failure? ⇒ Boolean
- #finished? ⇒ Boolean
- #not_run? ⇒ Boolean
- #number_of_attempts_made ⇒ Object
- #number_of_attempts_remaining ⇒ Object
- #provider_name ⇒ Object
- #request_description ⇒ Object
- #retrying? ⇒ Boolean
- #success? ⇒ Boolean
Instance Method Details
#consumer_name ⇒ Object
76 77 78 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 76 def consumer_name consumer && consumer.name end |
#execute(options) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 69 def execute # getting a random 'no method to_domain for null' error # not sure on which object, so splitting this out into two lines pact = pact_publication..to_domain webhook.to_domain.execute(pact, verification, event_context.symbolize_keys, ) end |
#failure? ⇒ Boolean
88 89 90 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 88 def failure? status == STATUS_FAILURE end |
#finished? ⇒ Boolean
104 105 106 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 104 def finished? success? || failure? end |
#not_run? ⇒ Boolean
96 97 98 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 96 def not_run? status == STATUS_NOT_RUN end |
#number_of_attempts_made ⇒ Object
100 101 102 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 100 def number_of_attempts_made webhook_executions.size end |
#number_of_attempts_remaining ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 108 def number_of_attempts_remaining if finished? 0 else (PactBroker.configuration.webhook_retry_schedule.size + 1) - number_of_attempts_made end end |
#provider_name ⇒ Object
80 81 82 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 80 def provider_name provider && provider.name end |
#request_description ⇒ Object
64 65 66 67 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 64 def request_description # webhook could be deleted webhook&.to_domain&.request_description end |
#retrying? ⇒ Boolean
92 93 94 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 92 def status == STATUS_RETRYING end |
#success? ⇒ Boolean
84 85 86 |
# File 'lib/pact_broker/webhooks/triggered_webhook.rb', line 84 def success? status == STATUS_SUCCESS end |