Module: PactBroker::Webhooks::Service

Extended by:
Forwardable, Messages, Repositories, Services, Service
Includes:
Logging
Included in:
Service
Defined in:
lib/pact_broker/webhooks/service.rb

Constant Summary

Constants included from Repositories

Repositories::REPOSITORY_FACTORIES

Constants included from Services

Services::SERVICE_FACTORIES

Instance Method Summary collapse

Methods included from Repositories

branch_repository, branch_version_repository, get_repository, integration_repository, label_repository, matrix_repository, pact_repository, pacticipant_repository, register_default_repositories, register_repository, tag_repository, verification_repository, version_repository, webhook_repository

Methods included from Services

badge_service, branch_service, certificate_service, contract_service, deployed_version_service, environment_service, get_service, group_service, index_service, integration_service, label_service, matrix_service, metrics_service, pact_service, pacticipant_service, register_default_services, register_service, released_version_service, tag_service, verification_service, version_service, webhook_service, webhook_trigger_service

Methods included from Messages

message, pluralize, validation_message, validation_message_at_index

Methods included from Logging

included, #log_error, #log_with_tag, #measure_info

Instance Method Details



57
58
59
# File 'lib/pact_broker/webhooks/service.rb', line 57

def delete_all_webhhook_related_objects_by_pacticipant pacticipant
  webhook_repository.delete_by_pacticipant(pacticipant)
end


61
62
63
# File 'lib/pact_broker/webhooks/service.rb', line 61

def delete_all_webhook_related_objects_by_pact_publication_ids pact_publication_ids
  webhook_repository.delete_triggered_webhooks_by_pact_publication_ids pact_publication_ids
end


65
66
67
# File 'lib/pact_broker/webhooks/service.rb', line 65

def delete_all_webhook_related_objects_by_verification_ids verification_ids
  webhook_repository.delete_triggered_webhooks_by_verification_ids verification_ids
end

#next_uuidObject



46
47
48
# File 'lib/pact_broker/webhooks/service.rb', line 46

def next_uuid
  SecureRandom.urlsafe_base64
end

#parametersObject



69
70
71
72
73
74
75
76
# File 'lib/pact_broker/webhooks/service.rb', line 69

def parameters
  PactAndVerificationParameters::ALL.collect do | parameter |
    OpenStruct.new(
      name: parameter,
      description: message("messages.webhooks.parameters.#{parameter}")
    )
  end
end

#update_by_uuid(uuid, params) ⇒ Object



50
51
52
53
54
55
# File 'lib/pact_broker/webhooks/service.rb', line 50

def update_by_uuid uuid, params
  webhook = webhook_repository.find_by_uuid(uuid)
  maintain_redacted_params(webhook, params)
  PactBroker::Api::Decorators::WebhookDecorator.new(webhook).from_hash(params)
  webhook_repository.update_by_uuid uuid, webhook
end