Sha256: f265290af43f70d27b434be4b55d027135b8f001ec16d158f5132185ae5ecd40

Contents?: true

Size: 654 Bytes

Versions: 11

Compression:

Stored size: 654 Bytes

Contents

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

11 entries across 11 versions & 1 rubygems

Version Path
roqua-core-api-0.7.0 lib/roqua/core_api/update_person.rb
roqua-core-api-0.6.0 lib/roqua/core_api/update_person.rb
roqua-core-api-0.5.0 lib/roqua/core_api/update_person.rb
roqua-core-api-0.4.0 lib/roqua/core_api/update_person.rb
roqua-core-api-0.3.1 lib/roqua/core_api/update_person.rb
roqua-core-api-0.3.0 lib/roqua/core_api/update_person.rb
roqua-core-api-0.2.4 lib/roqua/core_api/update_person.rb
roqua-core-api-0.2.3 lib/roqua/core_api/update_person.rb
roqua-core-api-0.2.2 lib/roqua/core_api/update_person.rb
roqua-core-api-0.2.1 lib/roqua/core_api/update_person.rb
roqua-core-api-0.2.0 lib/roqua/core_api/update_person.rb