Sha256: 913169df2fbd740077923b729db3146060886425c8802e8b5c0ee66b61b87b3a

Contents?: true

Size: 905 Bytes

Versions: 24

Compression:

Stored size: 905 Bytes

Contents

require 'fitting/records/unit/json_schema'

module Fitting
  class Records
    class Unit
      class Response
        def initialize(documented_response, tested_responses)
          @documented_response = documented_response
          @tested_responses = tested_responses
        end

        def status
          @status ||= @documented_response['status']
        end

        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

        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
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fitting-2.17.0 lib/fitting/records/unit/response.rb
fitting-2.16.1 lib/fitting/records/unit/response.rb
fitting-2.16.0 lib/fitting/records/unit/response.rb
fitting-2.15.0 lib/fitting/records/unit/response.rb
fitting-2.14.1 lib/fitting/records/unit/response.rb
fitting-2.14.0 lib/fitting/records/unit/response.rb
fitting-2.13.1 lib/fitting/records/unit/response.rb
fitting-2.13.0 lib/fitting/records/unit/response.rb
fitting-2.12.1 lib/fitting/records/unit/response.rb
fitting-2.12.0 lib/fitting/records/unit/response.rb
fitting-2.11.0 lib/fitting/records/unit/response.rb
fitting-2.10.0 lib/fitting/records/unit/response.rb
fitting-2.9.1 lib/fitting/records/unit/response.rb
fitting-2.9.0 lib/fitting/records/unit/response.rb
fitting-2.8.1 lib/fitting/records/unit/response.rb
fitting-2.8.0 lib/fitting/records/unit/response.rb
fitting-2.7.2 lib/fitting/records/unit/response.rb
fitting-2.7.1 lib/fitting/records/unit/response.rb
fitting-2.7.0 lib/fitting/records/unit/response.rb
fitting-2.6.0 lib/fitting/records/unit/response.rb