Class: Zaikio::Warehouse::TransferRequest
- Defined in:
- lib/zaikio/warehouse/transfer_request.rb
Defined Under Namespace
Classes: CanNotBeCanceled
Instance Method Summary collapse
Methods inherited from Base
disable_http_methods, readonly!, request
Instance Method Details
#cancel(params = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/zaikio/warehouse/transfer_request.rb', line 26 def cancel(params = {}) response = if material_requirement.id # cancelation_reference, cancelation_reference_link self.class.send(:send_request, :post, "material_requirements/#{material_requirement.id}/transfer_requests/#{id}/cancel", params) else self.class.send(:send_request, :post, "transfer_request_cancelations/#{id}", transfer_request_cancelation: params) end raise CanNotBeCanceled, response.body if (200..201).exclude?(response.status) Spyke::Result.new_from_response(response) end |