lib/yao/resources/action.rb in yao-0.4.0 vs lib/yao/resources/action.rb in yao-0.4.1
- old
+ new
@@ -3,10 +3,10 @@
def action(id, query)
res = POST(action_path(id)) do |req|
req.body = query.to_json
req.headers['Content-Type'] = 'application/json'
end
- return_resource(resource_from_json(res.body))
+ res.body ? return_resource(resource_from_json(res.body)) : nil
end
private
def action_path(id)
[resources_name, id, "action"].join("/")