Sha256: 375c8470fe6f6ea967ef1f8f2b9a77124394e699a6ae33d2abbb3795d09ca56c

Contents?: true

Size: 582 Bytes

Versions: 12

Compression:

Stored size: 582 Bytes

Contents

module CiviCrm
  module Actions
    module Update
      def update(attrs = {})
        attrs = attrs.reverse_merge(changes.transform_values(&:last))

        params = {
          'entity' => self.class.entity_class_name,
          'action' => 'create',
          'id' => id
        }.merge(attrs)

        response = CiviCrm::Client.request(:post, params)
        refresh_from(response.first.to_hash)

        @previously_changed = changes
        @changed_attributes.clear if @changed_attributes

        self
      end

      def save
        update()
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
civicrm-1.3.7 lib/civicrm/actions/update.rb
civicrm-1.3.6 lib/civicrm/actions/update.rb
civicrm-1.3.5 lib/civicrm/actions/update.rb
civicrm-1.3.4 lib/civicrm/actions/update.rb
civicrm-1.3.3 lib/civicrm/actions/update.rb
civicrm-1.3.2 lib/civicrm/actions/update.rb
civicrm-1.3.1 lib/civicrm/actions/update.rb
civicrm-1.2.5 lib/civicrm/actions/update.rb
civicrm-1.2.2 lib/civicrm/actions/update.rb
civicrm-1.2.1 lib/civicrm/actions/update.rb
civicrm-1.2.0 lib/civicrm/actions/update.rb
civicrm-1.1.1 lib/civicrm/actions/update.rb