blob: 4054a4cef37b6486e0255dfcc113c32b877794ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
module JobConcern
extend ActiveSupport::Concern
extend ActiveModel::Naming
extend ActiveModel::Translation
include ActiveModel::Model
included do
attr_reader :datas
end
module ClassMethods
end
def links
{}.tap do |links|
datas['links'].each do |link|
links[link["rel"]] = link["href"]
end
end
end
def started?
status == "started"
end
def aborted?
status == "aborted"
end
def cache_key
"#{id}_#{status}"
end
def cache_expiration
started? ? 10.seconds : 1.hours
end
def id
datas.id
end
def status
datas.status.downcase
end
def referential_name
datas.referential
end
def name
datas.action_parameters.name
end
def user_name
datas.action_parameters.user_name
end
def created_at
Time.at(datas.created.to_i / 1000) if datas.created
end
def updated_at
Time.at(datas.updated.to_i / 1000) if datas.updated
end
def format
datas.type
end
def organisation_name
datas.action_parameters.organisation_name
end
def no_save
datas.action_parameters.no_save
end
alias_method :no_save?, :no_save
def clean_repository
datas.action_parameters.clean_repository
end
end
|