Class: SalesforceArSync::SoapHandler::Delete

Inherits:
Base
  • Object
show all
Defined in:
lib/salesforce_ar_sync/soap_handler/delete.rb

Instance Attribute Summary

Attributes inherited from Base

#options, #sobjects, #xml_hashed

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#batch_process, #generate_response, #initialize, #valid?

Constructor Details

This class inherits a constructor from SalesforceArSync::SoapHandler::Base

Class Method Details

.delete_object(hash = {}) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
# File 'lib/salesforce_ar_sync/soap_handler/delete.rb', line 10

def self.delete_object(hash = {})
  raise ArgumentError, "Object_Id__c parameter required" if hash[:Object_Id__c].blank?
  raise ArgumentError, "Object_Type__c parameter required" if hash[:Object_Type__c].blank?
     
  object = hash[:Object_Type__c].constantize.find_by_salesforce_id(hash[:Object_Id__c])
  object.destroy if object
end

Instance Method Details

#process_notifications(priority = 90) ⇒ Object



4
5
6
7
8
# File 'lib/salesforce_ar_sync/soap_handler/delete.rb', line 4

def process_notifications(priority = 90)
  batch_process do |sobject|
    SalesforceArSync::SoapHandler::Delete.delay(:priority => priority, :run_at => 5.seconds.from_now).delete_object(sobject)
  end
end