lib/ecoportal/api/common/batch_operation.rb in ecoportal-api-0.9.5 vs lib/ecoportal/api/common/batch_operation.rb in ecoportal-api-0.9.6
- old
+ new
@@ -43,56 +43,56 @@
callback && callback.call(batch_response)
end
end
end
- def get(doc)
+ def get(doc, &block)
id = get_id(doc)
@operations << {
path: @base_path + "/" + CGI::escape(id),
method: "GET",
- callback: block_given? && Proc.new
+ callback: block_given? && block
}
end
- def update(doc)
+ def update(doc, &block)
id = get_id(doc)
body = get_body(doc)
@operations << {
path: @base_path + "/" + CGI::escape(id),
method: "PATCH",
body: body,
- callback: block_given? && Proc.new
+ callback: block_given? && block
}
end
- def upsert(doc)
+ def upsert(doc, &block)
id = get_id(doc)
body = get_body(doc)
@operations << {
path: @base_path + "/" + CGI::escape(id),
method: "POST",
body: body,
- callback: block_given? && Proc.new
+ callback: block_given? && block
}
end
- def delete(doc)
+ def delete(doc, &block)
id = get_id(doc)
@operations << {
path: @base_path + "/" + CGI::escape(id),
method: "DELETE",
- callback: block_given? && Proc.new
+ callback: block_given? && block
}
end
- def create(doc)
+ def create(doc, &block)
body = get_body(doc)
@operations << {
path: @base_path,
method: "POST",
body: body,
- callback: block_given? && Proc.new
+ callback: block_given? && block
}
end
private