Sha256: 49e57b0ea66b1007215b38dffd8c5d07c2b1a5abad661e4f46be62605117e74a

Contents?: true

Size: 945 Bytes

Versions: 13

Compression:

Stored size: 945 Bytes

Contents

require 'json'

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?
        association :requests, blueprint: Request, view: :summary, if: :field_present?
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
inferno_core-0.3.11 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.10 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.9 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.8 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.7 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.6 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.5 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.4 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.3 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.2 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.1 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.0 lib/inferno/apps/web/serializers/result.rb
inferno_core-0.3.0.rc1 lib/inferno/apps/web/serializers/result.rb