Skip to content

Instantly share code, notes, and snippets.

@uglyog
Created May 16, 2014 01:14
Show Gist options
  • Save uglyog/df0665782137cdaa0772 to your computer and use it in GitHub Desktop.
Save uglyog/df0665782137cdaa0772 to your computer and use it in GitHub Desktop.
require 'securerandom'
class Event
attr_accessor :event_id, :timestamp, :host, :remote_address, :event_type, :user
def initialize
@event_id = SecureRandom.uuid
@timestamp = Time.now
end
def to_hash
{
eventId: @event_id,
timestamp: @timestamp.gmtime,
host: @host,
remoteAddress: @remote_address,
eventType: @event_type,
user: @user
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment