Class: Qcourses::Postman
- Inherits:
-
Object
- Object
- Qcourses::Postman
- Defined in:
- lib/qcourses/models/postman.rb
Constant Summary collapse
- FROM_ADDRESS =
"[email protected]"
- NOTIFICATION_ADDRESS =
"[email protected]"
- @@allow_delivery_failure =
false
Class Method Summary collapse
- .allow_delivery_failure ⇒ Object
- .deliver(options) ⇒ Object
- .deliver_registration_confirmation(addressee, registration_confirmation) ⇒ Object
- .deliver_registration_notification(registration_confirmation) ⇒ Object
- .dont_allow_delivery_failure ⇒ Object
Class Method Details
.allow_delivery_failure ⇒ Object
27 28 29 |
# File 'lib/qcourses/models/postman.rb', line 27 def self.allow_delivery_failure @@allow_delivery_failure = true end |
.deliver(options) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/qcourses/models/postman.rb', line 42 def self.deliver() begin Pony.mail() rescue Exception => e raise e unless @@allow_delivery_failure end end |
.deliver_registration_confirmation(addressee, registration_confirmation) ⇒ Object
37 38 39 40 41 |
# File 'lib/qcourses/models/postman.rb', line 37 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 |
.deliver_registration_notification(registration_confirmation) ⇒ Object
33 34 35 36 |
# File 'lib/qcourses/models/postman.rb', line 33 def self.deliver_registration_notification(registration_confirmation) deliver(from: FROM_ADDRESS, to: NOTIFICATION_ADDRESS, subject: "Course Registration for #{registration_confirmation.event_name}") end |
.dont_allow_delivery_failure ⇒ Object
30 31 32 |
# File 'lib/qcourses/models/postman.rb', line 30 def self.dont_allow_delivery_failure @@allow_delivery_failure = false end |