lib/ecoportal/api/v2/pages.rb in ecoportal-api-v2-0.8.10 vs lib/ecoportal/api/v2/pages.rb in ecoportal-api-v2-0.8.11

- old
+ new

@@ -45,15 +45,19 @@ end raise "Could not get page #{id} - Error #{response.status}: #{response.body}" end # Requests to update an existing page via api. + # @note It won't launch the update unless there are changes # @param doc [Hash, Page] data that at least contains an `id` (internal or external) of the target page. # @return [Response] an object with the api response. def update(doc) body = get_body(doc) # , level: "page" - id = get_id(doc) - client.patch("/pages/#{CGI.escape(id)}", data: body) + # Launch only if there are changes + if body && body["page"] + id = get_id(doc) + client.patch("/pages/#{CGI.escape(id)}", data: body) + end end # Gets a `new` non-existing page via api with all the ids initialized. # @param from [String, Hash, Page] template or `id` of the template # @return [Ecoportal::API::V2::Page] the new page object.