Class: Untied::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/untied-publisher/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ Event

Returns a new instance of Event.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/untied-publisher/event.rb', line 7

def initialize(attrs)
  @config = {
    :name => "after_create",
    :payload => nil,
    :origin => nil,
    :payload_representer => nil
  }.merge(attrs)

  raise "You should inform the origin service" unless @config[:origin]

  @name = @config.delete(:name)
  @payload = represent(@config.delete(:payload))
  @origin = @config.delete(:origin)

  self.extend(Publisher::EventRepresenter)
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/untied-publisher/event.rb', line 5

def name
  @name
end

#originObject

Returns the value of attribute origin.



5
6
7
# File 'lib/untied-publisher/event.rb', line 5

def origin
  @origin
end

#payloadObject

Returns the value of attribute payload.



5
6
7
# File 'lib/untied-publisher/event.rb', line 5

def payload
  @payload
end