Sha256: 2433d87f966fa29bcfd237ec0483e30ec952c684270069645c44b11ab806cfed

Contents?: true

Size: 753 Bytes

Versions: 2

Compression:

Stored size: 753 Bytes

Contents

module CiviCrm
  module Actions
    module Destroy
      def delete
        params = {
          'entity' => self.class.entity_class_name,
          'action' => 'delete',
          'id' => id
        }

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

        if response < 1
          raise Error, "Couldn't delete #{entity_class_name}##{id}"
        end
      end

      def delete!
        params = {
          'entity' => self.class.entity_class_name,
          'action' => 'delete',
          'skip_undelete' => 1,
          'id' => id
        }

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

        if response < 1
          raise Error, "Couldn't delete #{entity_class_name}##{id}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
civicrm-1.2.1 lib/civicrm/actions/destroy.rb
civicrm-1.2.0 lib/civicrm/actions/destroy.rb