Class: Seahorse::Client::ParamValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/seahorse/client/param_validator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shape) ⇒ ParamValidator

Returns a new instance of ParamValidator.

Parameters:



13
14
15
# File 'lib/seahorse/client/param_validator.rb', line 13

def initialize(shape)
  @shape = shape || Seahorse::Model::Shapes::Structure.new
end

Class Method Details

.validate!(shape, params) ⇒ void

This method returns an undefined value.

Parameters:



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.

Parameters:

  • params (Hash)

Raises:

  • (ArgumentError)


19
20
21
22
23
# File 'lib/seahorse/client/param_validator.rb', line 19

def validate!(params)
  errors = []
  shape(@shape, params, errors, context = 'params')
  raise ArgumentError, error_messages(errors) unless errors.empty?
end