Class: Rabbit::Receiving::Message
- Inherits:
-
Object
- Object
- Rabbit::Receiving::Message
- Defined in:
- lib/rabbit/receiving/message.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#compress ⇒ Object
Returns the value of attribute compress.
-
#data ⇒ Object
Returns the value of attribute data.
-
#event ⇒ Object
Returns the value of attribute event.
-
#group_id ⇒ Object
Returns the value of attribute group_id.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#original_message ⇒ Object
Returns the value of attribute original_message.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(group_id: nil, project_id: nil, message_id: nil, event: nil, data: nil, arguments: nil, original_message: nil, compress: false) ⇒ Message
constructor
A new instance of Message.
- #mark_as_malformed!(errors = "Error not specified") ⇒ Object
Constructor Details
#initialize(group_id: nil, project_id: nil, message_id: nil, event: nil, data: nil, arguments: nil, original_message: nil, compress: false) ⇒ Message
Returns a new instance of Message.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rabbit/receiving/message.rb', line 25 def initialize( group_id: nil, project_id: nil, message_id: nil, event: nil, data: nil, arguments: nil, original_message: nil, compress: false ) self.group_id = group_id self.project_id = project_id self. = self.event = event self.compress = compress self.data = data unless data.nil? self.arguments = arguments self. = end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def arguments @arguments end |
#compress ⇒ Object
Returns the value of attribute compress.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def compress @compress end |
#data ⇒ Object
Returns the value of attribute data.
9 10 11 |
# File 'lib/rabbit/receiving/message.rb', line 9 def data @data end |
#event ⇒ Object
Returns the value of attribute event.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def event @event end |
#group_id ⇒ Object
Returns the value of attribute group_id.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def group_id @group_id end |
#message_id ⇒ Object
Returns the value of attribute message_id.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def @message_id end |
#original_message ⇒ Object
Returns the value of attribute original_message.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def @original_message end |
#project_id ⇒ Object
Returns the value of attribute project_id.
7 8 9 |
# File 'lib/rabbit/receiving/message.rb', line 7 def project_id @project_id end |
Class Method Details
.build(message, arguments) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rabbit/receiving/message.rb', line 11 def self.build(, arguments) group_id, project_id = arguments.fetch(:app_id).split(".") new( group_id: group_id, project_id: project_id, event: arguments.fetch(:type), compress: arguments.dig(:headers, "compress") || false, data: , message_id: arguments.fetch(:message_id, nil), arguments: arguments, ) end |
Instance Method Details
#attributes ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rabbit/receiving/message.rb', line 57 def attributes { group_id: group_id, project_id: project_id, message_id: , event: event, data: data, arguments: arguments, original_message: , compress: compress, } end |
#mark_as_malformed!(errors = "Error not specified") ⇒ Object
53 54 55 |
# File 'lib/rabbit/receiving/message.rb', line 53 def mark_as_malformed!(errors = "Error not specified") MalformedMessage.raise!(self, errors, caller(1)) end |