Class: Snowly::Validator
- Inherits:
-
Object
- Object
- Snowly::Validator
- Defined in:
- lib/snowly/validator.rb
Constant Summary collapse
- PROTOCOL_FILE_NAME =
'snowplow_protocol.json'
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#protocol_schema ⇒ Object
readonly
Returns the value of attribute protocol_schema.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
-
#initialize(query_string) ⇒ Validator
constructor
A new instance of Validator.
-
#valid? ⇒ true, false
If request is valid.
-
#validate ⇒ Object
Entry point for validation.
Constructor Details
#initialize(query_string) ⇒ Validator
11 12 13 14 15 |
# File 'lib/snowly/validator.rb', line 11 def initialize(query_string) @request = Request.new query_string @errors = [] @protocol_schema = load_protocol_schema end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/snowly/validator.rb', line 9 def errors @errors end |
#protocol_schema ⇒ Object (readonly)
Returns the value of attribute protocol_schema.
9 10 11 |
# File 'lib/snowly/validator.rb', line 9 def protocol_schema @protocol_schema end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
9 10 11 |
# File 'lib/snowly/validator.rb', line 9 def request @request end |
Instance Method Details
#valid? ⇒ true, false
If request is valid
19 20 21 |
# File 'lib/snowly/validator.rb', line 19 def valid? @errors == [] end |
#validate ⇒ Object
Entry point for validation.
24 25 26 27 28 |
# File 'lib/snowly/validator.rb', line 24 def validate validate_root validate_associated valid? end |