lib/acfs/operation.rb in acfs-1.0.0.dev.1.b305 vs lib/acfs/operation.rb in acfs-1.0.0
- old
+ new
@@ -1,7 +1,6 @@
module Acfs
-
# @api private
#
# Describes a CRUD operation. Handle request creation and response
# processing as well as error handling and stubbing.
#
@@ -49,18 +48,19 @@
def location_args
location ? location.args : {}
end
def method
- { read: :get, list: :get, update: :put, create: :post, delete: :delete }[action]
+ {read: :get, list: :get, update: :put, create: :post, delete: :delete}[action]
end
def request
- request = ::Acfs::Request.new url, method: method, params: params, data: data
+ request = ::Acfs::Request.new url, method: method, params: params,
+ data: data, operation: self
request.on_complete do |response|
::ActiveSupport::Notifications.instrument 'acfs.operation.complete',
- operation: self,
- response: response
+ operation: self,
+ response: response
handle_failure response unless response.success?
callback.call response.data, response
end
request