Sha256: d719fecd6eb36634f50fe87462fff88cee2d9b64b5be066c960c41bc4d6890a9

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

module Euston
  class Command
    include ActiveModel::Validations

    def initialize body
      @headers = { :id => Uuid.generate,
                   :type => self.class.to_s.split('::').pop.underscore.to_sym }
      @body = body
    end

    def read_attribute_for_validation key
      @body[key]
    end

    def to_hash
      { :headers => @headers.merge(:version => version), :body => @body }
    end

    def id
      @headers[:id]
    end

    def version
      1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
euston-1.1.0 lib/euston/command.rb
euston-1.1.0-java lib/euston/command.rb