3
3
module Travis::API::V3
4
4
class Renderer::Job < ModelRenderer
5
5
representation(:minimal, :id)
6
- representation(:standard, *representations[:minimal], :allow_failure, :number, :state, :started_at, :finished_at, :build, :queue, :repository, :commit, :owner, :stage, :created_at, :updated_at, :private)
6
+ representation(:standard, *representations[:minimal], :allow_failure, :number, :state, :started_at, :finished_at, :build, :queue, :repository, :commit, :owner, :stage, :created_at, :updated_at, :private, :restarted_at, :restarted_by )
7
7
representation(:active, *representations[:standard])
8
8
9
9
# TODO: I don't want to config be visible in the regular representation
10
10
# as I want it to be visible only after adding include=job.config
11
11
# we probably need to have a better way of doing this
12
- representation(:with_config, *representations[:minimal], :allow_failure, :number, :state, :started_at, :finished_at, :build, :queue, :repository, :commit, :owner, :stage, :created_at, :updated_at, :config)
12
+ representation(:with_config, *representations[:minimal], :allow_failure, :number, :state, :started_at, :finished_at, :build, :queue, :repository, :commit, :owner, :stage, :created_at, :updated_at, :restarted_at, :restarted_by, : config)
13
13
14
14
hidden_representations(:with_config)
15
15
hidden_representations(:active)
@@ -26,6 +26,16 @@ def updated_at
26
26
json_format_time_with_ms(model.updated_at)
27
27
end
28
28
29
+ def restarted_by
30
+ return nil unless restarter = model.restarter
31
+ {
32
+ '@type' => 'user',
33
+ '@representation' => 'minimal'.freeze,
34
+ 'id' => restarter.id,
35
+ 'login' => restarter.login
36
+ }
37
+ end
38
+
29
39
def config
30
40
if include_config?
31
41
ConfigObfuscator.new(model.config, model.repository.key).obfuscate
0 commit comments