Sha256: 89475d69c187e37be5a578f477c2f6848bd51bcd0702f5445a35542c4806c4fe
Contents?: true
Size: 1.26 KB
Versions: 14
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", ErrorResponseBodyGenerator.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
14 entries across 14 versions & 1 rubygems