Sha256: b7341fe7894e9c3bc6c07d2c4336fc5c0719a3adf2de252d5bc568ae32c40f46
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
require 'fitting/cover/json_schema' require 'json-schema' module Fitting class Cover class Response def initialize(response) @cover_json_schemas = Fitting::Cover::JSONSchema.new(response.json_schema) @json_schemas = @cover_json_schemas.json_schemas + [response.json_schema] @combinations = @cover_json_schemas.combinations @flags = @cover_json_schemas.json_schemas.map do |json_schema| JSON::Validator.validate(json_schema, response.body) end end attr_reader :json_schemas, :combinations, :flags def update(response) index = 0 @cover_json_schemas.json_schemas.map do |json_schema| flag = JSON::Validator.validate(json_schema, response.body) @flags[index] = @flags[index] || flag index += 1 end self end def to_hash { 'json_schemas' => json_schemas, 'combinations' => combinations, 'flags' => flags } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fitting-2.18.3 | lib/fitting/cover/response.rb |
fitting-2.18.2 | lib/fitting/cover/response.rb |
fitting-2.18.1 | lib/fitting/cover/response.rb |
fitting-2.18.0 | lib/fitting/cover/response.rb |