lib/atlas_rb/community.rb in atlas_rb-0.0.51 vs lib/atlas_rb/community.rb in atlas_rb-0.0.52
- old
+ new
@@ -8,11 +8,13 @@
JSON.parse(connection({}).get(ROUTE + id)&.body)["community"]
end
def self.create(id = nil, xml_path = nil)
result = JSON.parse(connection({ parent_id: id }).post(ROUTE)&.body)["community"]
- update(result["id"], xml_path) if xml_path.present?
- result
+ return unless xml_path.present?
+
+ update(result["id"], xml_path)
+ find(result["id"])
end
def self.destroy(id)
connection({}).delete(ROUTE + id)
end