diff --git a/lib/microsoft_graph/base_entity.rb b/lib/microsoft_graph/base_entity.rb index f783d1bb07..2b268a6ea7 100644 --- a/lib/microsoft_graph/base_entity.rb +++ b/lib/microsoft_graph/base_entity.rb @@ -87,6 +87,22 @@ def save! true end + # update entity by specified hash + def update_attributes(raw:) + raise NoAssociationError unless parent + raise_no_graph_error! unless graph + if persisted? + graph.service.patch(path, raw.to_json) + else + initialize_serialized_properties( + graph.service.post(parent.path, to_json(convert_to_camel_case: true)) + ) + @persisted = true + end + mark_clean + true + end + def save save! rescue OData::HTTPError