Class: ZohoCrm::Record::UpdateService

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name:, data:) ⇒ UpdateService

Returns a new instance of UpdateService.



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

def initialize(module_name:, data:)
  @module_name = module_name
  @data        = data.is_a?(Array) ? data : [data]
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



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

def module_name
  @module_name
end

Instance Method Details

#callObject

Create a record.

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

Examples

service = ZohoCrm::Record::UpdateService.call(
  module_name: 'Contacts',
  data: {
    'id' => '',
    'First_Name' => 'Eric Theodore'
  }
)

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

PUT /crm/v7/:module_name



43
44
45
# File 'lib/zoho_crm/record/update_service.rb', line 43

def call
  connection.put(module_name, **params)
end