Sha256: 30f0728657702d49cc93dad930f8fb18dc7b5bc3b153193b4ca433fed6820097

Contents?: true

Size: 916 Bytes

Versions: 2

Compression:

Stored size: 916 Bytes

Contents

require 'capsulecd'
module CapsuleCD
  class ValidationUtils
    def self.validate_repo_payload(repo_payload)
      unless repo_payload['sha']
        fail CapsuleCD::Error::SourcePayloadFormatError, 'Incorrectly formatted payload, missing "sha1" key'
      end
      unless repo_payload['ref']
        fail CapsuleCD::Error::SourcePayloadFormatError, 'Incorrectly formatted payload, missing "ref" key'
      end
      unless repo_payload['repo']
        fail CapsuleCD::Error::SourcePayloadFormatError, 'Incorrectly formatted payload, missing "repo" key'
      end
      unless repo_payload['repo']['clone_url']
        fail CapsuleCD::Error::SourcePayloadFormatError, 'Incorrectly formatted payload, missing "clone_url" key'
      end
      unless repo_payload['repo']['name']
        fail CapsuleCD::Error::SourcePayloadFormatError, 'Incorrectly formatted payload, missing "name" key'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capsulecd-1.0.1 lib/capsulecd/base/common/validation_utils.rb
capsulecd-1.0.0 lib/capsulecd/base/common/validation_utils.rb