Class: Untied::Event
- Inherits:
-
Object
- Object
- Untied::Event
- Includes:
- ActiveModel::Serializers::JSON
- Defined in:
- lib/untied-consumer/event.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(attrs) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(attrs) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/untied-consumer/event.rb', line 9 def initialize(attrs) @config = { :name => "after_create", :payload => nil, :origin => nil }.merge(attrs) raise "You should inform the origin service" unless @config[:origin] @name = @config.delete(:name) @payload = @config.delete(:payload) @origin = @config.delete(:origin) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/untied-consumer/event.rb', line 7 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin.
7 8 9 |
# File 'lib/untied-consumer/event.rb', line 7 def origin @origin end |
#payload ⇒ Object
Returns the value of attribute payload.
7 8 9 |
# File 'lib/untied-consumer/event.rb', line 7 def payload @payload end |
Instance Method Details
#attributes ⇒ Object
23 24 25 |
# File 'lib/untied-consumer/event.rb', line 23 def attributes { "name" => @name, "origin" => @origin, "payload" => @payload } end |