Module: SmsOnRails::ActsAsDeliverable::InstanceMethods
- Defined in:
- lib/sms_on_rails/activerecord_extensions/acts_as_deliverable.rb
Instance Method Summary collapse
-
#deliver(options = {}) ⇒ Object
Return true if delivery was successful If unsuccessful, only raise fatal exceptions, and return false otherwise === Options
fatal_exception
- specify the fatal exception Class to throw. -
#deliver!(options = {}) ⇒ Object
Deliver and mark the status fields approriately.
-
#deliver_message(options = {}) ⇒ Object
Deliver message should be overridden by the class to perform any functionality.
- #delivered? ⇒ Boolean
Instance Method Details
#deliver(options = {}) ⇒ Object
Return true if delivery was successful If unsuccessful, only raise fatal exceptions, and return false otherwise
Options
fatal_exception
- specify the fatal exception Class to throw. To dismiss all exceptions, set to nil. Defaults to acts_as_deliverable_options specified error
- add an error to the objects base if delivery failed
51 52 53 54 55 56 57 58 59 |
# File 'lib/sms_on_rails/activerecord_extensions/acts_as_deliverable.rb', line 51 def deliver(={}) deliver!() rescue Exception => exc log_delivery_error(exc) fatal_exception = .merge()[:fatal_exception] raise exc if fatal_exception && exc.is_a?(fatal_exception) self.errors.add_to_base((exc, )) false end |
#deliver!(options = {}) ⇒ Object
Deliver and mark the status fields approriately
62 63 64 |
# File 'lib/sms_on_rails/activerecord_extensions/acts_as_deliverable.rb', line 62 def deliver!(={}) lock_record_and_execute { () } end |
#deliver_message(options = {}) ⇒ Object
Deliver message should be overridden by the class to perform any functionality
70 71 72 |
# File 'lib/sms_on_rails/activerecord_extensions/acts_as_deliverable.rb', line 70 def (={}) raise([:fatal_exception]||Exception).new "Overwrite deliver_message in base class to perform the actual delivery" end |
#delivered? ⇒ Boolean
66 |
# File 'lib/sms_on_rails/activerecord_extensions/acts_as_deliverable.rb', line 66 def delivered?; already_processed?; end |