Class: ZohoCrm::Record::UpsertService
- Inherits:
-
BaseService
- Object
- BaseService
- ZohoCrm::Record::UpsertService
- Defined in:
- lib/zoho_crm/record/upsert_service.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#duplicate_check_fields ⇒ Object
readonly
Returns the value of attribute duplicate_check_fields.
-
#module_name ⇒ Object
readonly
Returns the value of attribute module_name.
-
#skip_feature_execution ⇒ Object
readonly
Returns the value of attribute skip_feature_execution.
-
#trigger ⇒ Object
readonly
Returns the value of attribute trigger.
Instance Method Summary collapse
-
#call ⇒ Object
Create a record.
-
#initialize(module_name:, data:, duplicate_check_fields: [], skip_feature_execution: [], trigger: []) ⇒ UpsertService
constructor
A new instance of UpsertService.
Constructor Details
#initialize(module_name:, data:, duplicate_check_fields: [], skip_feature_execution: [], trigger: []) ⇒ UpsertService
Returns a new instance of UpsertService.
12 13 14 15 16 17 18 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 12 def initialize(module_name:, data:, duplicate_check_fields: [], skip_feature_execution: [], trigger: []) @module_name = module_name @data = data.is_a?(Array) ? data : [data] @duplicate_check_fields = duplicate_check_fields @skip_feature_execution = skip_feature_execution @trigger = trigger end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 4 def data @data end |
#duplicate_check_fields ⇒ Object (readonly)
Returns the value of attribute duplicate_check_fields.
4 5 6 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 4 def duplicate_check_fields @duplicate_check_fields end |
#module_name ⇒ Object (readonly)
Returns the value of attribute module_name.
4 5 6 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 4 def module_name @module_name end |
#skip_feature_execution ⇒ Object (readonly)
Returns the value of attribute skip_feature_execution.
4 5 6 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 4 def skip_feature_execution @skip_feature_execution end |
#trigger ⇒ Object (readonly)
Returns the value of attribute trigger.
4 5 6 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 4 def trigger @trigger end |
Instance Method Details
#call ⇒ Object
Create a record.
www.zoho.com/crm/developer/docs/api/v7/upsert-records.html
Examples
service = ZohoCrm::Record::UpsertService.call(
module_name: 'Contacts',
data: {
'Email' => '[email protected]',
'First_Name' => 'Eric',
'Last_Name' => 'Cartman Theodore 2nd'
},
duplicate_check_fields: ['Email']
)
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
POST /crm/v7/:module_name/upsert
48 49 50 |
# File 'lib/zoho_crm/record/upsert_service.rb', line 48 def call connection.post("#{module_name}/upsert", **params) end |