class PactBroker::Api::Resources::AllWebhooks
Public Instance Methods
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 20 def allowed_methods ["GET", "POST", "OPTIONS"] end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 16 def content_types_accepted [["application/json", :from_json]] end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 12 def content_types_provided [["application/hal+json", :to_json]] end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 24 def create_path webhook_url next_uuid, base_url end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 40 def from_json saved_webhook = webhook_service.create(next_uuid, webhook, webhook_consumer, webhook_provider) response.body = decorator_class(:webhook_decorator).new(saved_webhook).to_json(**decorator_options) end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 32 def malformed_request? super || (request.post? && validation_errors_for_schema?) end
Calls superclass method
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 45 def policy_name :'webhooks::webhooks' end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 49 def policy_record if request.post? webhook else nil end end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 28 def post_is_create? true end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 36 def to_json decorator_class(:webhooks_decorator).new(webhooks).to_json(**decorator_options(resource_title: "Webhooks")) end
Private Instance Methods
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 79 def next_uuid @next_uuid ||= webhook_service.next_uuid end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 59 def schema api_contract_class(:webhook_contract) end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 75 def webhook @webhook ||= decorator_class(:webhook_decorator).new(PactBroker::Domain::Webhook.new).from_json(request_body) end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 63 def webhook_consumer webhook.consumer&.name ? pacticipant_service.find_pacticipant_by_name(webhook.consumer.name) : nil end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 67 def webhook_provider webhook.provider&.name ? pacticipant_service.find_pacticipant_by_name(webhook.provider.name) : nil end
Source
# File lib/pact_broker/api/resources/all_webhooks.rb, line 71 def webhooks webhook_service.find_all end