Class: Asdawqw::AsynchronousValidationModel
- Defined in:
- lib/asdawqw/models/asynchronous_validation_model.rb
Overview
Model for Validation messages
Instance Attribute Summary collapse
-
#product_id ⇒ Integer
Id of product in BookingPal.
-
#valid ⇒ Boolean
Is product valid.
-
#validation_errors ⇒ String
Error message - explanation what are problems if validation failed.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(product_id = nil, valid = nil, validation_errors = nil) ⇒ AsynchronousValidationModel
constructor
A new instance of AsynchronousValidationModel.
Methods inherited from BaseModel
Constructor Details
#initialize(product_id = nil, valid = nil, validation_errors = nil) ⇒ AsynchronousValidationModel
Returns a new instance of AsynchronousValidationModel.
30 31 32 33 34 35 36 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 30 def initialize(product_id = nil, valid = nil, validation_errors = nil) @product_id = product_id @validation_errors = validation_errors @valid = valid end |
Instance Attribute Details
#product_id ⇒ Integer
Id of product in BookingPal
11 12 13 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 11 def product_id @product_id end |
#valid ⇒ Boolean
Is product valid
19 20 21 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 19 def valid @valid end |
#validation_errors ⇒ String
Error message - explanation what are problems if validation failed.
15 16 17 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 15 def validation_errors @validation_errors end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 39 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash['productId'] valid = hash['valid'] validation_errors = hash['validationErrors'] # Create object from extracted values. AsynchronousValidationModel.new(product_id, valid, validation_errors) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 28 |
# File 'lib/asdawqw/models/asynchronous_validation_model.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['product_id'] = 'productId' @_hash['validation_errors'] = 'validationErrors' @_hash['valid'] = 'valid' @_hash end |