Class: ZohoCrm::Record::DeleteService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/zoho_crm/record/delete_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name:, id:) ⇒ DeleteService

Returns a new instance of DeleteService.



12
13
14
15
# File 'lib/zoho_crm/record/delete_service.rb', line 12

def initialize(module_name:, id:)
  @module_name = module_name
  @id          = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/zoho_crm/record/delete_service.rb', line 4

def id
  @id
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



4
5
6
# File 'lib/zoho_crm/record/delete_service.rb', line 4

def module_name
  @module_name
end

Instance Method Details

#callObject

Delete a record.

www.zoho.com/crm/developer/docs/api/v7/delete-records.html

Examples

service = ZohoCrm::Record::DeleteService.call(module_name: 'Contacts', id: '')

service.success? # => true
service.errors # => #<ActiveModel::Errors []>

service.response # => #<Faraday::Response ...>
service.response.status # => 200
service.response.body # => {}

service.facade # => #<ZohoCrm::Record::Facade ...>
service.facade.attributes
service.attributes

DELETE /crm/v7/:module_name/:id



37
38
39
# File 'lib/zoho_crm/record/delete_service.rb', line 37

def call
  connection.delete("#{module_name}/#{id}")
end