Module: ErpIntegration::Resources::Validations
- Included in:
- ErpIntegration::Resource
- Defined in:
- lib/erp_integration/resources/validations.rb
Instance Method Summary collapse
-
#errors ⇒ ErpIntegration::Resources::Errors
Exposes all errors related to an ‘ErpIntegration::Resource`.
-
#valid? ⇒ Boolean
Checks whether an resource is considered valid or not.
-
#validate_with(*error_messages) ⇒ Boolean
Validates the resource by checking the given error messages.
Instance Method Details
#errors ⇒ ErpIntegration::Resources::Errors
Exposes all errors related to an ‘ErpIntegration::Resource`.
9 10 11 |
# File 'lib/erp_integration/resources/validations.rb', line 9 def errors @errors ||= Resources::Errors.new end |
#valid? ⇒ Boolean
Checks whether an resource is considered valid or not.
16 17 18 |
# File 'lib/erp_integration/resources/validations.rb', line 16 def valid? errors.none? end |
#validate_with(*error_messages) ⇒ Boolean
Validates the resource by checking the given error messages.
24 25 26 27 28 29 30 31 32 |
# File 'lib/erp_integration/resources/validations.rb', line 24 def validate_with(*) errors.clear .flatten.compact.each do || errors.add() end valid? end |