module Roqua module CoreApi # @api private class UpdatePerson < Base model :session, class: Sessions::AuthSession model :person, class: Models::Person # Saves the person attributes to server. # Returns true on success, false on validation errors. # Adds errors to person object based on I18n errors.messages. # Raises on other errors. def execute response = session.patch "/people/#{person.id}", person: person.serializable_hash if response.code == 422 errors_to_object(response, person) false else true end end end end end