Class: GorgService::Message::ErrorLog
- Inherits:
-
Object
- Object
- GorgService::Message::ErrorLog
- Defined in:
- lib/gorg_service/message/error_log.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#sender ⇒ Object
Returns the value of attribute sender.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type: "info", id: SecureRandom.uuid, sender: GorgService.configuration.application_id, message: "", timestamp: DateTime.now, debug: {}) ⇒ ErrorLog
constructor
A new instance of ErrorLog.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(type: "info", id: SecureRandom.uuid, sender: GorgService.configuration.application_id, message: "", timestamp: DateTime.now, debug: {}) ⇒ ErrorLog
Returns a new instance of ErrorLog.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gorg_service/message/error_log.rb', line 13 def initialize( type: "info", id: SecureRandom.uuid, sender: GorgService.configuration.application_id, message: "", timestamp: DateTime.now, debug: {}) @type=type @id=id @sender=sender = = @debug=debug end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def debug @debug end |
#id ⇒ Object
Returns the value of attribute id.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def end |
#sender ⇒ Object
Returns the value of attribute sender.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def sender @sender end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/gorg_service/message/error_log.rb', line 11 def type @type end |
Class Method Details
.parse(obj) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/gorg_service/message/error_log.rb', line 43 def parse(obj) obj=JSON.parse(obj) unless obj.is_a? Hash obj=convert_keys_to_sym(obj) self.new( type: obj[:error_type], id: obj[:error_uuid], sender: obj[:error_sender], message: obj[:error_message], timestamp: DateTime.parse(obj[:timestamp]), debug: obj[:error_debug]) end |
Instance Method Details
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gorg_service/message/error_log.rb', line 27 def to_h h={"error_type" => type, "error_uuid" => id, "error_sender" => sender, "error_message" => , "timestamp" => .iso8601, } h["error_debug"]= debug if debug h end |
#to_json ⇒ Object
38 39 40 |
# File 'lib/gorg_service/message/error_log.rb', line 38 def to_json to_h.to_json end |