Sha256: c9fc4469ea75ba390b78d17e1b7424f28fc75f529aea6fde43d820d9bfeb8e9f
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
module PactBroker module Api module Resources module BadgeMethods def allowed_methods ["GET", "OPTIONS"] end def content_types_provided [["image/svg+xml", :to_svg]] end def resource_exists? false end # Only called if resource_exists? returns false def previously_existed? true end def forbidden? false end def is_authorized?(authorization_header) super || PactBroker.configuration.enable_public_badge_access end def policy_name :'badges::badge' end def moved_temporarily? response.headers["Cache-Control"] = "no-cache" begin badge_url rescue StandardError => e # Want to render a badge, even if there's an error badge_service.error_badge_url("error", ErrorResponseGenerator.display_message(e, "reference: #{PactBroker::Errors.generate_error_reference}")) end end def badge_url raise NotImplementedError end private def label lab = request.query["label"] lab && !lab.empty? ? lab : nil end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems