Sha256: 0df33ac8d663dbc0db0017923c7650a9913c7b9be71714771e515a56fba81de7

Contents?: true

Size: 655 Bytes

Versions: 35

Compression:

Stored size: 655 Bytes

Contents

# encoding: utf-8

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.
      #
      def assert_required_keys(required, provided)
        result = required.all? do |key|
          provided.has_deep_key? key
        end
        if !result
          raise Github::Error::RequiredParams.new(provided, required)
        end
        result
      end

    end # Required
  end # Validations
end # Github

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
github_api-0.11.2 lib/github_api/validations/required.rb
github_api-0.11.1 lib/github_api/validations/required.rb
github_api-0.11.0 lib/github_api/validations/required.rb
github_api-0.10.2 lib/github_api/validations/required.rb
github_api-0.10.1 lib/github_api/validations/required.rb
github_api-0.10.0 lib/github_api/validations/required.rb
github_api-0.9.7 lib/github_api/validations/required.rb
github_api-0.9.6 lib/github_api/validations/required.rb
github_api-0.9.5 lib/github_api/validations/required.rb
github_api-0.9.4 lib/github_api/validations/required.rb
github_api-0.9.3 lib/github_api/validations/required.rb
github_api-0.9.2 lib/github_api/validations/required.rb
github_api-0.9.1 lib/github_api/validations/required.rb
github_api-0.9.0 lib/github_api/validations/required.rb
github_api-0.8.11 lib/github_api/validations/required.rb
github_api-0.8.10 lib/github_api/validations/required.rb
github_api-0.8.9 lib/github_api/validations/required.rb
github_api-0.8.8 lib/github_api/validations/required.rb
github_api-0.8.7 lib/github_api/validations/required.rb
github_api-0.8.6 lib/github_api/validations/required.rb