Class: CycloneLariat::Messages::Abstract
- Inherits:
-
LunaPark::Entities::Attributable
- Object
- LunaPark::Entities::Attributable
- CycloneLariat::Messages::Abstract
show all
- Includes:
- LunaPark::Extensions::Validatable
- Defined in:
- lib/cyclone_lariat/messages/abstract.rb
Constant Summary
collapse
- KIND =
'unknown'
Instance Method Summary
collapse
Instance Method Details
#==(other) ⇒ Object
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 104
def ==(other)
kind == other.kind &&
uuid == other.uuid &&
publisher == other.publisher &&
type == other.type &&
client_error&.message == other.client_error&.message &&
version == other.version &&
sent_at.to_i == other.sent_at.to_i &&
received_at.to_i == other.received_at.to_i &&
processed_at.to_i == other.processed_at.to_i
end
|
#client_error_details=(details) ⇒ Object
93
94
95
96
97
98
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 93
def client_error_details=(details)
return unless details
@client_error ||= Errors::ClientError.new
@client_error.details = details
end
|
#client_error_message=(txt) ⇒ Object
86
87
88
89
90
91
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 86
def client_error_message=(txt)
return unless txt
@client_error ||= Errors::ClientError.new
@client_error.message = txt
end
|
#data ⇒ Object
50
51
52
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 50
def data
@data ||= {}
end
|
#deduplication_id=(value) ⇒ Object
78
79
80
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 78
def deduplication_id=(value)
@deduplication_id = wrap_string(value)
end
|
#fifo? ⇒ Boolean
100
101
102
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 100
def fifo?
!@group_id.nil?
end
|
#group_id=(value) ⇒ Object
74
75
76
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 74
def group_id=(value)
@group_id = wrap_string(value)
end
|
#kind ⇒ Object
26
27
28
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 26
def kind
KIND
end
|
#params ⇒ Object
46
47
48
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 46
def params
serialize
end
|
#processed? ⇒ Boolean
82
83
84
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 82
def processed?
!@processed_at.nil?
end
|
#processed_at=(value) ⇒ Object
66
67
68
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 66
def processed_at=(value)
@processed_at = wrap_time(value)
end
|
#received_at=(value) ⇒ Object
62
63
64
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 62
def received_at=(value)
@received_at = wrap_time(value)
end
|
#request_id=(value) ⇒ Object
70
71
72
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 70
def request_id=(value)
@request_id = wrap_string(value)
end
|
#sent_at=(value) ⇒ Object
58
59
60
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 58
def sent_at=(value)
@sent_at = wrap_time(value)
end
|
#serialize ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 30
def serialize
{
uuid: uuid,
publisher: publisher,
type: [kind, type].join('_'),
version: version,
data: data,
request_id: request_id,
sent_at: sent_at&.iso8601(3)
}.compact
end
|
#to_json(*args) ⇒ Object
42
43
44
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 42
def to_json(*args)
serialize.to_json(*args)
end
|
#validation ⇒ Object
22
23
24
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 22
def validation
super
end
|
#version=(value) ⇒ Object
54
55
56
|
# File 'lib/cyclone_lariat/messages/abstract.rb', line 54
def version=(value)
@version = Integer(value)
end
|