Module: RRRSpec::Server::JSONConstructor::WorkerLogJSONConstructor

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

Instance Method Summary collapse

Instance Method Details

#as_full_jsonObject



138
139
140
141
142
# File 'lib/rrrspec/server/json_constructor.rb', line 138

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

#as_json_for_result_pageObject



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/rrrspec/server/json_constructor.rb', line 148

def as_json_for_result_page
  {
    'id' => id,
    'worker_name' => worker_key,
    'started_at' => started_at,
    'rsync_finished_at' => rsync_finished_at,
    'setup_finished_at' => setup_finished_at,
    'rspec_finished_at' => finished_at,
    'log' => log.to_s,
  }
end

#as_short_jsonObject



134
135
136
# File 'lib/rrrspec/server/json_constructor.rb', line 134

def as_short_json
  as_full_json
end

#workerObject



144
145
146
# File 'lib/rrrspec/server/json_constructor.rb', line 144

def worker
  { 'key' => worker_key }
end