lib/yao/resources/restfully_accessible.rb in yao-0.8.0 vs lib/yao/resources/restfully_accessible.rb in yao-0.9.0
- old
+ new
@@ -113,9 +113,18 @@
resource_from_json(res.body)
end
alias find get
+ # @param id_or_name_or_permalink [Stirng]
+ # @param query [Hash]
+ # @return [Yao::Resources::*]
+ def get!(id_or_name_or_permalink, query={})
+ get(id_or_name_or_permalink, query)
+ rescue Yao::ItemNotFound, Yao::NotFound
+ nil
+ end
+
def find_by_name(name, query={})
list(query.merge({"name" => name}))
end
# @param resource_params [Hash]