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

- old
+ new

@@ -51,13 +51,12 @@ # @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" # Launch only if there are changes - if body && body["page"] - id = get_id(doc) - client.patch("/pages/#{CGI.escape(id)}", data: body) - end + 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 # @return [Ecoportal::API::V2::Page] the new page object.