Sha256: db38179490c53915d573b238b8159aa06a059d17258d4a581fa56da6fe3f786c

Contents?: true

Size: 654 Bytes

Versions: 1

Compression:

Stored size: 654 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'representable/json'

module Untied
  class Event
    attr_accessor :name, :payload, :origin

    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
  end

  module EventRepresenter
    include Representable::JSON

    self.representation_wrap = true

    property :name
    property :payload
    property :origin
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
untied-publisher-0.0.4 lib/untied-publisher/event.rb