Sha256: 3f0f0d8f2197ba24333497e5010760957ad4b4a7ca82c5c84e759ea9d505e33e

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

module Roqua
  module CoreApi
    # @api private
    class UpdatePerson < Base
      model :session, class: Sessions::OAuthSession
      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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roqua-core-api-0.0.35 lib/roqua/core_api/update_person.rb
roqua-core-api-0.0.32 lib/roqua/core_api/update_person.rb
roqua-core-api-0.0.31 lib/roqua/core_api/update_person.rb
roqua-core-api-0.0.30 lib/roqua/core_api/update_person.rb