lib/ecoportal/api/v2/pages.rb in ecoportal-api-v2-2.0.4 vs lib/ecoportal/api/v2/pages.rb in ecoportal-api-v2-2.0.5

- old
+ new

@@ -55,14 +55,20 @@ # 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 [Ecoportal::API::Common::Response] an object with the api response. def update(doc) + if doc.is_a?(Ecoportal::API::V2::Pages::PageStage) + stage_id = doc.current_stage_id + return stages.update(doc, stage_id: stage_id) + end + body = get_body(doc) # , level: "page" # Launch only if there are changes raise "Missing page object" unless body && body["page"] id = get_id(doc) + client.patch("/pages/#{CGI.escape(id)}", data: body) 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