Module: RRRSpec::Server::JSONConstructor::SlaveJSONConstructor

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

Instance Method Summary collapse

Instance Method Details

#as_full_jsonObject



169
170
171
172
173
# File 'lib/rrrspec/server/json_constructor.rb', line 169

def as_full_json
  as_json(except: [:id, :taskset_id],
          include: { 'trials' => { only: :key } },
          methods: [:log])
end

#as_json_for_result_pageObject



175
176
177
178
179
180
181
182
183
# File 'lib/rrrspec/server/json_constructor.rb', line 175

def as_json_for_result_page
  {
    'id' => id,
    'name' => key,
    'status' => status,
    'trials' => trials.map { |trial| { id: trial.id, key: trial.key } },
    'log' => log.to_s,
  }
end

#as_short_jsonObject



165
166
167
# File 'lib/rrrspec/server/json_constructor.rb', line 165

def as_short_json
  as_full_json
end