lib/ledger_sync/domains/operation/add.rb in ledger_sync-domains-1.0.5 vs lib/ledger_sync/domains/operation/add.rb in ledger_sync-domains-1.1.0
- old
+ new
@@ -5,10 +5,16 @@
module LedgerSync
module Domains
class Operation
class Add < Resource
+ class Contract < LedgerSync::Ledgers::Contract
+ params do
+ required(:data).value(:hash)
+ end
+ end
+
private
def operate
if resource.save
success
@@ -19,23 +25,23 @@
)
end
end
def resource
- @resource ||= resource_class.new(params)
+ @resource ||= resource_class.new(params[:data])
end
def success
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