Class: ServiCraft::Destroy
- Inherits:
-
Object
- Object
- ServiCraft::Destroy
- Defined in:
- lib/servi_craft/destroy.rb
Overview
Destroy Record Service
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call(before_destroy: proc {}, after_successful_destroy: proc {}, after_failed_destroy: proc {}, finally: proc {}) ⇒ Object
-
#initialize(record) ⇒ Destroy
constructor
A new instance of Destroy.
Constructor Details
#initialize(record) ⇒ Destroy
Returns a new instance of Destroy.
10 11 12 13 |
# File 'lib/servi_craft/destroy.rb', line 10 def initialize(record) @record = record @response = ::EchoCraft::ServiceObjects::Destroy.new(@record) end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/servi_craft/destroy.rb', line 8 def response @response end |
Instance Method Details
#call(before_destroy: proc {}, after_successful_destroy: proc {}, after_failed_destroy: proc {}, finally: proc {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/servi_craft/destroy.rb', line 15 def call(before_destroy: proc {}, after_successful_destroy: proc {}, after_failed_destroy: proc {}, finally: proc {}) before_destroy.call process_record_destroy(after_successful_destroy: after_successful_destroy, after_failed_destroy: after_failed_destroy) finally.call @response rescue StandardError => e puts "#{e.class}: #{e.}" puts e.backtrace.join("\n") end |