Sha256: c10f1243208aafbc6e1192f9826598f812a611dc3cd0835c25a493cc5f0165bb

Contents?: true

Size: 1.03 KB

Versions: 54

Compression:

Stored size: 1.03 KB

Contents

require 'json'
require_relative 'message'
require_relative 'request'

module Inferno
  module Web
    module Serializers
      class Result < Serializer
        identifier :id

        field :test_id, if: :field_present?
        field :test_group_id, if: :field_present?
        field :test_suite_id, if: :field_present?

        field :test_run_id
        field :test_session_id
        field :result
        field :result_message, if: :field_present?
        field :created_at
        field :updated_at
        field :optional?, name: :optional

        field :inputs do |result, _options|
          result.input_json.present? ? JSON.parse(result.input_json) : []
        end

        field :outputs do |result, _options|
          result.output_json.present? ? JSON.parse(result.output_json) : []
        end

        association :messages, blueprint: Message, if: :field_present?
        field :requests do |result, _options|
          Request.render_as_hash(result.requests.sort_by(&:index), view: :summary)
        end
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
inferno_core-0.4.29 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.28 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.27 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.26 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.25 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.24 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.23 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.22 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.21 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.20 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.19 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.18 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.17 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.16 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.15 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.14 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.13 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.12 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.11 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.4.10 lib/inferno/apps/web/serializers/result.rb