Module: Github::Validations::Required
- Included in:
- Github::Validations
- Defined in:
- lib/github_api2/validations/required.rb
Instance Method Summary collapse
-
#assert_required_keys(*required, provided) ⇒ Object
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.
Instance Method Details
#assert_required_keys(*required, provided) ⇒ Object
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.
14 15 16 17 18 |
# File 'lib/github_api2/validations/required.rb', line 14 def assert_required_keys(*required, provided) required.flatten.all? { |key| provided.deep_key?(key.to_s) } || (raise Github::Error::RequiredParams.new(provided, required)) end |