Sha256: 3a1c4e1f21e23ccf24e2845c0e92fbc7c973c7dc6afa598716b83e822d308f0d

Contents?: true

Size: 667 Bytes

Versions: 12

Compression:

Stored size: 667 Bytes

Contents

# encoding: utf-8

module BitBucket
  module Validations
    module Required

      # Validate all keys present in a provided hash against required set,
      # on mismatch raise BitBucket::Error::RequiredParams
      # Note that keys need to be in the same format i.e. symbols or strings,
      # otherwise the comparison will fail.
      #
      def assert_required_keys(required, provided)
        result = required.all? do |key|
          provided.has_deep_key? key
        end
        if !result
          raise BitBucket::Error::RequiredParams.new(provided, required)
        end
        result
      end

    end # Required
  end # Validations
end # BitBucket

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
codenamev_bitbucket_api-0.4.1 lib/bitbucket_rest_api/validations/required.rb
codenamev_bitbucket_api-0.4.0 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.7 lib/bitbucket_rest_api/validations/required.rb
reenhanced_bitbucket_api-0.3.2 lib/bitbucket_rest_api/validations/required.rb
reenhanced_bitbucket_api-0.3.1 lib/bitbucket_rest_api/validations/required.rb
reenhanced_bitbucket_api-0.3.0 lib/bitbucket_rest_api/validations/required.rb
reenhanced_bitbucket_api-0.1.6 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.5 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.4 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.2 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.1 lib/bitbucket_rest_api/validations/required.rb
bitbucket_rest_api-0.1.0 lib/bitbucket_rest_api/validations/required.rb