Module: JSONResponseVerification

Defined in:
lib/json_response_verification.rb

Overview

Include this module in WeaselDiesel to add response verification methods.

Instance Method Summary collapse

Instance Method Details

#verify(parsed_json_body) ⇒ Array<TrueClass, FalseClass, Array<String>> Also known as: validate_hash_response

Verifies the parsed body of a JSON response against the service’s response description.

Returns:

  • (Array<TrueClass, FalseClass, Array<String>>)

    True/false and an array of errors.



9
10
11
12
13
# File 'lib/json_response_verification.rb', line 9

def verify(parsed_json_body)
  errors = [verify_element(parsed_json_body, response.nodes.first)]
  errors.flatten!
  [errors.empty?, errors]
end