Sha256: 6c09b3997ec962bfabdeaff84d6e7ad121f3e7404647f40db6a9410f6fa92e7b
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require 'pony' module Qcourses class RegistrationNotification def initialize(employee, event) @employee = employee @event = event end def event_name @event.name end def inspect "RegistrationNotification(for: #{employee.name}, about: #{event.name})" end def ==(other) return false unless other.is_a? RegistrationNotification return other.employee.email == employee.email && other.event == event end protected attr_reader :employee, :event end class Postman FROM_ADDRESS = "info@qwan.it" NOTIFICATION_ADDRESS = "info@qwan.it" @@allow_delivery_failure = false def self.allow_delivery_failure @@allow_delivery_failure = true end def self.dont_allow_delivery_failure @@allow_delivery_failure = false end def self.deliver_registration_notification(registration_confirmation) deliver(from: FROM_ADDRESS, to: NOTIFICATION_ADDRESS, subject: "Course Registration for #{registration_confirmation.event_name}") end def self.deliver_registration_confirmation(addressee, registration_confirmation) deliver(from: FROM_ADDRESS, to: addressee, subject: "Thank you for your registration for #{registration_confirmation.event_name}") end def self.deliver(options) begin Pony.mail(options) rescue Exception => e raise e unless @@allow_delivery_failure end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
qcourses-0.1.11 | lib/qcourses/models/postman.rb |
qcourses-0.1.10 | lib/qcourses/models/postman.rb |
qcourses-0.1.9 | lib/qcourses/models/postman.rb |