Sha256: f99a388e3e7f6211f8792d42dfd7d952d78054623b526944ff7def7e67a542d9

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

# encoding: utf-8

require_relative '../error/client_error'

module Github
  module Validations
    module Required
      # Validate all keys present in a provided hash against required set,
      # on mismatch raise Github::Error::RequiredParams
      # Note that keys need to be in the same format i.e. symbols or strings,
      # otherwise the comparison will fail.
      #
      # @api public
      def assert_required_keys(*required, provided)
        required.flatten.all? { |key|
          provided.deep_key?(key.to_s)
        } || (raise Github::Error::RequiredParams.new(provided, required))
      end
    end # Required
  end # Validations
end # Github

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/validations/required.rb
github_api2-1.0.0 lib/github_api2/validations/required.rb
github_api-0.19.0 lib/github_api/validations/required.rb
lingfennan-github_api-0.18.2 lib/github_api/validations/required.rb
github_api-0.18.2 lib/github_api/validations/required.rb
github_api-0.18.1 lib/github_api/validations/required.rb