class Fitting::Cover::Response
Attributes
combinations[R]
flags[R]
json_schemas[R]
Public Class Methods
new(response)
click to toggle source
# File lib/fitting/cover/response.rb, line 7 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
Public Instance Methods
to_hash()
click to toggle source
# File lib/fitting/cover/response.rb, line 32 def to_hash { 'json_schemas' => json_schemas, 'combinations' => combinations, 'flags' => flags } end
update(response)
click to toggle source
# File lib/fitting/cover/response.rb, line 22 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