Sha256: f13e323669f90ec8dd126cdef4f2c4b03b4ae368c4825fa99a577b87c633b74d

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

require 'json-schema'
module FDIC
  module BankFind
    module SchemaValidators
      class BaseValidator
        def schema_valid?
          JSON::Validator.validate(schema, response.parsed_response)
        end

        def schema_valid!
          JSON::Validator.validate!(schema, response.parsed_response)
          #JSON::Validator.validate! will return true if it is successful, or raise if there is an error. Swallow true and return nil otherwise
          nil
        end

        protected

        def response
          @response ||= Client.new.send(client_method, *client_method_arguments)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fdic-0.9.2 lib/fdic/bank_find/schema_validators/base_validator.rb