Class: Seahorse::Client::ParamValidator
- Inherits:
-
Object
- Object
- Seahorse::Client::ParamValidator
- Defined in:
- lib/seahorse/client/param_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(shape, options = {}) ⇒ ParamValidator
constructor
A new instance of ParamValidator.
- #validate!(params) ⇒ void
Constructor Details
#initialize(shape, options = {}) ⇒ ParamValidator
Returns a new instance of ParamValidator.
14 15 16 17 |
# File 'lib/seahorse/client/param_validator.rb', line 14 def initialize(shape, = {}) @shape = shape || Seahorse::Model::Shapes::Structure.new @validate_required = [:validate_required] != false end |
Class Method Details
.validate!(shape, params) ⇒ void
This method returns an undefined value.
8 9 10 |
# File 'lib/seahorse/client/param_validator.rb', line 8 def self.validate!(shape, params) new(shape).validate!(params) end |
Instance Method Details
#validate!(params) ⇒ void
This method returns an undefined value.
21 22 23 24 25 |
# File 'lib/seahorse/client/param_validator.rb', line 21 def validate!(params) errors = [] shape(@shape, params, errors, context = 'params') raise ArgumentError, (errors) unless errors.empty? end |