Sha256: 411a55ae777d3a3d788afcf2cb46072ca793bc09aaa4f81333d59457f2121927
Contents?: true
Size: 1.12 KB
Versions: 22
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby # 'Notification' refers to the template object created when an event occurs, # from which individual 'Message' objects are created, one for each # contact+media recipient. module Flapjack module Data class Message attr_accessor :medium, :address, :id, :duration, :contact, :notification def self.for_contact(opts = {}) self.new(:contact => opts[:contact]) end def id return @id if @id t = Time.now @id = self.object_id.to_i.to_s + '-' + t.to_i.to_s + '.' + t.tv_usec.to_s end def contents c = {'media' => medium, 'address' => address, 'id' => id} if contact c.merge('contact_id' => contact.id, 'contact_first_name' => contact.first_name, 'contact_last_name' => contact.last_name) end c['duration'] = duration if duration c.merge(notification.contents) if notification end private def initialize(opts = {}) @contact = opts[:contact] end end end end
Version data entries
22 entries across 22 versions & 1 rubygems