lib/ledger_sync/domains/operation/update.rb in ledger_sync-domains-1.0.5 vs lib/ledger_sync/domains/operation/update.rb in ledger_sync-domains-1.1.0
- old
+ new
@@ -9,19 +9,20 @@
class Update < Resource
class Contract < LedgerSync::Ledgers::Contract
params do
required(:id).filled(:integer)
required(:limit).value(:hash)
+ required(:data).value(:hash)
end
end
private
def operate
return failure('Resource not found') unless resource
- if resource.update(params.except(:id))
+ if resource.update(params[:data])
success
else
failure(
'Please review the problems below:',
data: serialize(resource: resource)
@@ -37,14 +38,14 @@
super(resource)
end
def failure(message, data: nil)
super(
- LedgerSync::Error::OperationError.new(
- operation: self,
- message: message,
- response: data
- )
+ LedgerSync::Error::OperationError.new(
+ operation: self,
+ message: message,
+ response: data
+ )
)
end
end
end
end