Class: SalesforceArSync::SoapHandler::Delete
- 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, deletion_map, #generate_response, #initialize, namespaced, #valid?
Constructor Details
This class inherits a constructor from SalesforceArSync::SoapHandler::Base
Class Method Details
.delete_object(hash = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# 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[namespaced(:Object_Id__c)].blank? raise ArgumentError, 'Object_Type__c parameter required' if hash[namespaced(:Object_Type__c)].blank? raise Exception, "Deletion failed: No class found for #{hash[namespaced(:Object_Type__c)]}" unless deletion_map(hash[namespaced(:Object_Type__c)]).safe_constantize object = deletion_map(hash[namespaced(:Object_Type__c)]).safe_constantize.try(:find_by_salesforce_id, hash[namespaced(:Object_Id__c)]) object.destroy if object && object.ar_sync_inbound_delete? 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 |