Ruby allows you to do nice things like take an object serialize it to json send it somewhere like across the wire and reconstitute it.

Reconstitute the object

klass = message.keys[0].camelize.constantize

New instance of the klass

event = klass.new

Attributes of the class

attributes = event.attributes

Attributes and values from the message

attribute_values = message[message.keys[0]]

Copy the attribute values from the message into the object

event.attributes.each {|attr| event.send("#{attr[0]}=", attribute_values["#{attr[0]}"])}