lib/cyclone_lariat/abstract/message.rb in cyclone_lariat-0.3.1 vs lib/cyclone_lariat/abstract/message.rb in cyclone_lariat-0.3.2
- old
+ new
@@ -7,18 +7,13 @@
module Abstract
class Message < LunaPark::Entities::Attributable
attr :uuid, String, :new
attr :publisher, String, :new
attr :type, String, :new
- attr :client_error
- attr :version
- attr :data
+ attrs :client_error, :version, :data,
+ :sent_at, :processed_at, :received_at
- attr_reader :sent_at,
- :processed_at,
- :received_at
-
def kind
raise LunaPark::Errors::AbstractMethod
end
def version=(value)
@@ -35,10 +30,14 @@
def processed_at=(value)
@processed_at = wrap_time(value)
end
+ def processed?
+ !@processed_at.nil?
+ end
+
def client_error_message=(txt)
return unless txt
@client_error ||= Errors::ClientError.new
@client_error.message = txt
@@ -75,10 +74,10 @@
def wrap_time(value)
case value
when String then Time.parse(value)
when Time then value
when NilClass then nil
- else raise Argumentevent.rbError, "Unknown type `#{value.class}`"
+ else raise ArgumentError, "Unknown type `#{value.class}`"
end
end
end
end
end