Sha256: 56434ada57946c76aaa4825e393a97c08bc11c0c665dd9dba4df3439a41f6f05
Contents?: true
Size: 1.37 KB
Versions: 7
Compression:
Stored size: 1.37 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. require 'flapjack/data/contact' module Flapjack module Data class Message attr_reader :medium, :address, :duration, :contact def self.for_contact(contact, opts = {}) self.new(:contact => contact, :medium => opts[:medium], :address => opts[:address], :duration => opts[:duration]) end def id return @id if @id t = Time.now # FIXME: consider using a UUID here # this is planned to be used as part of alert history keys @id = "#{self.object_id.to_i}-#{t.to_i}.#{t.tv_usec}" end def contents c = {'media' => medium, 'address' => address, 'id' => id, 'contact_id' => contact.id, 'contact_first_name' => contact.first_name, 'contact_last_name' => contact.last_name} c['duration'] = duration if duration c end private def initialize(opts = {}) @contact = opts[:contact] @medium = opts[:medium] @address = opts[:address] @duration = opts[:duration] end end end end
Version data entries
7 entries across 7 versions & 1 rubygems