Module: RRRSpec::Server::JSONConstructor::TrialJSONConstructor

Extended by:
ActiveSupport::Concern
Includes:
ActiveModel::Serializers::JSON
Included in:
Persistence::Trial
Defined in:
lib/rrrspec/server/json_constructor.rb

Instance Method Summary collapse

Instance Method Details

#as_full_jsonObject



108
109
110
111
112
# File 'lib/rrrspec/server/json_constructor.rb', line 108

def as_full_json
  as_json(except: [:id, :task_id, :slave_id],
          include: { 'slave' => { only: :key }, 'task' => { only: :key } },
          methods: [:stdout, :stderr])
end

#as_json_for_result_pageObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/rrrspec/server/json_constructor.rb', line 114

def as_json_for_result_page
  {
    'id' => id,
    'key' => key,
    'task_id' => task_id,
    'slave_id' => slave_id,
    'started_at' => started_at,
    'finished_at' => finished_at,
    'status' => status,
    'passed' => passed,
    'pending' => pending,
    'failed' => failed,
  }
end

#as_short_jsonObject



104
105
106
# File 'lib/rrrspec/server/json_constructor.rb', line 104

def as_short_json
  as_full_json
end