class PactBroker::Api::Resources::PacticipantWebhooks
Public Instance Methods
allowed_methods()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 13 def allowed_methods ["POST", "GET", "OPTIONS"] end
content_types_accepted()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 21 def content_types_accepted [["application/json", :from_json]] end
content_types_provided()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 17 def content_types_provided [["application/hal+json", :to_json]] end
create_path()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 36 def create_path webhook_url next_uuid, base_url end
from_json()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 44 def from_json saved_webhook = webhook_service.create next_uuid, webhook, consumer, provider response.body = decorator_class(:webhook_decorator).new(saved_webhook).to_json(decorator_options) end
malformed_request?()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 29 def malformed_request? if request.post? return invalid_json? || webhook_validation_errors?(webhook) end false end
policy_name()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 53 def policy_name :'webhooks::webhooks' end
policy_record()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 57 def policy_record request.post? ? webhook : nil end
post_is_create?()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 40 def post_is_create? true end
resource_exists?()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 25 def resource_exists? (!consumer_specified? || consumer) && (!provider_specified? || provider) end
to_json()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 49 def to_json decorator_class(:webhooks_decorator).new(webhooks).to_json(decorator_options(resource_title: "Webhooks")) end
Private Instance Methods
next_uuid()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 71 def next_uuid @next_uuid ||= webhook_service.next_uuid end
webhook()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 67 def webhook @webhook ||= decorator_class(:webhook_decorator).new(PactBroker::Domain::Webhook.new).from_json(request_body) end
webhooks()
click to toggle source
# File lib/pact_broker/api/resources/pacticipant_webhooks.rb, line 63 def webhooks webhook_service.find_by_consumer_and_provider(consumer, provider) end