class Fitting::Records::Unit::Response

Public Class Methods

new(documented_response, tested_responses) click to toggle source
# File lib/fitting/records/unit/response.rb, line 7
def initialize(documented_response, tested_responses)
  @documented_response = documented_response
  @tested_responses = tested_responses
end

Public Instance Methods

json_schemas() click to toggle source
# File lib/fitting/records/unit/response.rb, line 16
def json_schemas
  @json_schemas ||= @documented_response['json_schemas'].inject([]) do |res, documented_json_schema|
    res.push(Fitting::Records::Unit::JsonSchema.new(documented_json_schema, tested_bodies))
  end
end
status() click to toggle source
# File lib/fitting/records/unit/response.rb, line 12
def status
  @status ||= @documented_response['status']
end
tested_bodies() click to toggle source
# File lib/fitting/records/unit/response.rb, line 22
def tested_bodies
  @tested_bodies ||= @tested_responses.inject([]) do |res, tested_response|
    next res unless status == tested_response.status.to_s
    res.push(tested_response.body)
  end
end