Sha256: d6c8b0a36b4bfe785815f2af85a96f8aadce86c795e5ff7c3987a82be4f0ff4d
Contents?: true
Size: 1.5 KB
Versions: 56
Compression:
Stored size: 1.5 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, :rollup def self.for_contact(contact, opts = {}) self.new(:contact => contact, :medium => opts[:medium], :address => opts[:address], :duration => opts[:duration], :rollup => opts[:rollup]) 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, 'rollup' => rollup, '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] @rollup = opts[:rollup] end end end end
Version data entries
56 entries across 56 versions & 1 rubygems