Sha256: acc4a5d28b9fb812b24ac303a758b8422761af2935a618d53e19f3bbc1855f5c
Contents?: true
Size: 1.42 KB
Versions: 14
Compression:
Stored size: 1.42 KB
Contents
require 'pact_broker/api/resources/base_resource' require 'pact_broker/verifications/verification_status' require 'pact_broker/configuration' module PactBroker module Api module Resources class Badge < BaseResource def allowed_methods ['GET'] end def content_types_provided [['image/svg+xml', :to_svg]] end def resource_exists? true end def is_authorized?(authorization_header) super || PactBroker.configuration.enable_public_badge_access end def forbidden? false end private def to_svg response.headers['Cache-Control'] = 'no-cache' badge_service.pact_verification_badge pact, label, initials, verification_status end def pact @pact ||= pact_service.find_latest_pact(identifier_from_path) end def latest_verification return nil unless pact @verification ||= verification_service.find_latest_verification_for(pact.consumer, pact.provider, identifier_from_path[:tag]) end def verification_status @verification_status ||= PactBroker::Verifications::Status.new(pact, latest_verification).to_sym end def label request.query['label'] end def initials request.query['initials'] == 'true' end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems