ZOHOCRMSDK2_0 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/src/ZOHOCRMSDK2_0.rb +6 -0
  3. data/src/com/zoho/api/authenticator/oauth_token.rb +86 -32
  4. data/src/com/zoho/api/authenticator/store/db_store.rb +71 -29
  5. data/src/com/zoho/api/authenticator/store/file_store.rb +95 -24
  6. data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
  7. data/src/com/zoho/api/logger/sdk_logger.rb +19 -9
  8. data/src/com/zoho/crm/api/contact_roles/api_exception.rb +4 -0
  9. data/src/com/zoho/crm/api/contact_roles/contact_role_wrapper.rb +61 -0
  10. data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +118 -0
  11. data/src/com/zoho/crm/api/contact_roles/record_action_handler.rb +10 -0
  12. data/src/com/zoho/crm/api/contact_roles/record_action_wrapper.rb +63 -0
  13. data/src/com/zoho/crm/api/contact_roles/record_body_wrapper.rb +61 -0
  14. data/src/com/zoho/crm/api/contact_roles/record_response_handler.rb +10 -0
  15. data/src/com/zoho/crm/api/contact_roles/record_response_wrapper.rb +84 -0
  16. data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
  17. data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
  18. data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
  19. data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
  20. data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
  21. data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
  22. data/src/com/zoho/crm/api/initializer.rb +44 -16
  23. data/src/com/zoho/crm/api/record/record_operations.rb +198 -1
  24. data/src/com/zoho/crm/api/related_records/related_records_operations.rb +299 -40
  25. data/src/com/zoho/crm/api/request_proxy.rb +3 -4
  26. data/src/com/zoho/crm/api/sdk_config.rb +2 -68
  27. data/src/com/zoho/crm/api/util/api_http_connector.rb +6 -6
  28. data/src/com/zoho/crm/api/util/constants.rb +113 -16
  29. data/src/com/zoho/crm/api/util/converter.rb +21 -4
  30. data/src/com/zoho/crm/api/util/data_type_converter.rb +8 -2
  31. data/src/com/zoho/crm/api/util/form_data_converter.rb +4 -16
  32. data/src/com/zoho/crm/api/util/json_converter.rb +7 -9
  33. data/src/com/zoho/crm/api/util/module_fields_handler.rb +1 -1
  34. data/src/com/zoho/crm/api/util/utility.rb +197 -82
  35. data/src/resources/JSONDetails.json +1 -1
  36. data/src/version.rb +2 -2
  37. metadata +8 -2
@@ -13,29 +13,33 @@ module RelatedRecords
13
13
 
14
14
  # Creates an instance of RelatedRecordsOperations with the given parameters
15
15
  # @param related_list_api_name [String] A String
16
- # @param record_id [Integer] A Integer
17
16
  # @param module_api_name [String] A String
18
- def initialize(related_list_api_name, record_id, module_api_name)
17
+ # @param x_external [String] A String
18
+ def initialize(related_list_api_name, module_api_name, x_external=nil)
19
19
  if !related_list_api_name.is_a? String
20
20
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: related_list_api_name EXPECTED TYPE: String', nil, nil)
21
21
  end
22
- if !record_id.is_a? Integer
23
- raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
24
- end
25
22
  if !module_api_name.is_a? String
26
23
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: module_api_name EXPECTED TYPE: String', nil, nil)
27
24
  end
25
+ if x_external!=nil and !x_external.is_a? String
26
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: x_external EXPECTED TYPE: String', nil, nil)
27
+ end
28
28
  @related_list_api_name = related_list_api_name
29
- @record_id = record_id
30
29
  @module_api_name = module_api_name
30
+ @x_external = x_external
31
31
  end
32
32
 
33
33
  # The method to get related records
34
+ # @param record_id [Integer] A Integer
34
35
  # @param param_instance [ParameterMap] An instance of ParameterMap
35
36
  # @param header_instance [HeaderMap] An instance of HeaderMap
36
37
  # @return An instance of APIResponse
37
38
  # @raise SDKException
38
- def get_related_records(param_instance=nil, header_instance=nil)
39
+ def get_related_records(record_id, param_instance=nil, header_instance=nil)
40
+ if !record_id.is_a? Integer
41
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
42
+ end
39
43
  if param_instance!=nil and !param_instance.is_a? ParameterMap
40
44
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', nil, nil)
41
45
  end
@@ -47,12 +51,13 @@ module RelatedRecords
47
51
  api_path = api_path + '/crm/v2/'
48
52
  api_path = api_path + @module_api_name.to_s
49
53
  api_path = api_path + '/'
50
- api_path = api_path + @record_id.to_s
54
+ api_path = api_path + record_id.to_s
51
55
  api_path = api_path + '/'
52
56
  api_path = api_path + @related_list_api_name.to_s
53
57
  handler_instance.api_path = api_path
54
58
  handler_instance.http_method = Constants::REQUEST_METHOD_GET
55
59
  handler_instance.category_method = 'READ'
60
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsHeader'), @x_external)
56
61
  handler_instance.param = param_instance
57
62
  handler_instance.header = header_instance
58
63
  Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
@@ -61,10 +66,14 @@ module RelatedRecords
61
66
  end
62
67
 
63
68
  # The method to update related records
69
+ # @param record_id [Integer] A Integer
64
70
  # @param request [BodyWrapper] An instance of BodyWrapper
65
71
  # @return An instance of APIResponse
66
72
  # @raise SDKException
67
- def update_related_records(request)
73
+ def update_related_records(record_id, request)
74
+ if !record_id.is_a? Integer
75
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
76
+ end
68
77
  if request!=nil and !request.is_a? BodyWrapper
69
78
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
70
79
  end
@@ -73,7 +82,7 @@ module RelatedRecords
73
82
  api_path = api_path + '/crm/v2/'
74
83
  api_path = api_path + @module_api_name.to_s
75
84
  api_path = api_path + '/'
76
- api_path = api_path + @record_id.to_s
85
+ api_path = api_path + record_id.to_s
77
86
  api_path = api_path + '/'
78
87
  api_path = api_path + @related_list_api_name.to_s
79
88
  handler_instance.api_path = api_path
@@ -82,16 +91,117 @@ module RelatedRecords
82
91
  handler_instance.content_type = 'application/json'
83
92
  handler_instance.request = request
84
93
  handler_instance.mandatory_checker = true
94
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.UpdateRelatedRecordsHeader'), @x_external)
85
95
  Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
86
96
  require_relative 'action_handler'
87
97
  handler_instance.api_call(ActionHandler.name, 'application/json')
88
98
  end
89
99
 
90
100
  # The method to delink records
101
+ # @param record_id [Integer] A Integer
102
+ # @param param_instance [ParameterMap] An instance of ParameterMap
103
+ # @return An instance of APIResponse
104
+ # @raise SDKException
105
+ def delink_records(record_id, param_instance=nil)
106
+ if !record_id.is_a? Integer
107
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
108
+ end
109
+ if param_instance!=nil and !param_instance.is_a? ParameterMap
110
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', nil, nil)
111
+ end
112
+ handler_instance = Handler::CommonAPIHandler.new
113
+ api_path = ''
114
+ api_path = api_path + '/crm/v2/'
115
+ api_path = api_path + @module_api_name.to_s
116
+ api_path = api_path + '/'
117
+ api_path = api_path + record_id.to_s
118
+ api_path = api_path + '/'
119
+ api_path = api_path + @related_list_api_name.to_s
120
+ handler_instance.api_path = api_path
121
+ handler_instance.http_method = Constants::REQUEST_METHOD_DELETE
122
+ handler_instance.category_method = Constants::REQUEST_METHOD_DELETE
123
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.DelinkRecordsHeader'), @x_external)
124
+ handler_instance.param = param_instance
125
+ require_relative 'action_handler'
126
+ handler_instance.api_call(ActionHandler.name, 'application/json')
127
+ end
128
+
129
+ # The method to get related records using external id
130
+ # @param external_value [String] A String
131
+ # @param param_instance [ParameterMap] An instance of ParameterMap
132
+ # @param header_instance [HeaderMap] An instance of HeaderMap
133
+ # @return An instance of APIResponse
134
+ # @raise SDKException
135
+ def get_related_records_using_external_id(external_value, param_instance=nil, header_instance=nil)
136
+ if !external_value.is_a? String
137
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
138
+ end
139
+ if param_instance!=nil and !param_instance.is_a? ParameterMap
140
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', nil, nil)
141
+ end
142
+ if header_instance!=nil and !header_instance.is_a? HeaderMap
143
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
144
+ end
145
+ handler_instance = Handler::CommonAPIHandler.new
146
+ api_path = ''
147
+ api_path = api_path + '/crm/v2/'
148
+ api_path = api_path + @module_api_name.to_s
149
+ api_path = api_path + '/'
150
+ api_path = api_path + external_value.to_s
151
+ api_path = api_path + '/'
152
+ api_path = api_path + @related_list_api_name.to_s
153
+ handler_instance.api_path = api_path
154
+ handler_instance.http_method = Constants::REQUEST_METHOD_GET
155
+ handler_instance.category_method = 'READ'
156
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsUsingExternalIDHeader'), @x_external)
157
+ handler_instance.param = param_instance
158
+ handler_instance.header = header_instance
159
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
160
+ require_relative 'response_handler'
161
+ handler_instance.api_call(ResponseHandler.name, 'application/json')
162
+ end
163
+
164
+ # The method to update related records using external id
165
+ # @param external_value [String] A String
166
+ # @param request [BodyWrapper] An instance of BodyWrapper
167
+ # @return An instance of APIResponse
168
+ # @raise SDKException
169
+ def update_related_records_using_external_id(external_value, request)
170
+ if !external_value.is_a? String
171
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
172
+ end
173
+ if request!=nil and !request.is_a? BodyWrapper
174
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
175
+ end
176
+ handler_instance = Handler::CommonAPIHandler.new
177
+ api_path = ''
178
+ api_path = api_path + '/crm/v2/'
179
+ api_path = api_path + @module_api_name.to_s
180
+ api_path = api_path + '/'
181
+ api_path = api_path + external_value.to_s
182
+ api_path = api_path + '/'
183
+ api_path = api_path + @related_list_api_name.to_s
184
+ handler_instance.api_path = api_path
185
+ handler_instance.http_method = Constants::REQUEST_METHOD_PUT
186
+ handler_instance.category_method = 'UPDATE'
187
+ handler_instance.content_type = 'application/json'
188
+ handler_instance.request = request
189
+ handler_instance.mandatory_checker = true
190
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.UpdateRelatedRecordsUsingExternalIDHeader'), @x_external)
191
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
192
+ require_relative 'action_handler'
193
+ handler_instance.api_call(ActionHandler.name, 'application/json')
194
+ end
195
+
196
+ # The method to delete related records using external id
197
+ # @param external_value [String] A String
91
198
  # @param param_instance [ParameterMap] An instance of ParameterMap
92
199
  # @return An instance of APIResponse
93
200
  # @raise SDKException
94
- def delink_records(param_instance=nil)
201
+ def delete_related_records_using_external_id(external_value, param_instance=nil)
202
+ if !external_value.is_a? String
203
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
204
+ end
95
205
  if param_instance!=nil and !param_instance.is_a? ParameterMap
96
206
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', nil, nil)
97
207
  end
@@ -100,26 +210,32 @@ module RelatedRecords
100
210
  api_path = api_path + '/crm/v2/'
101
211
  api_path = api_path + @module_api_name.to_s
102
212
  api_path = api_path + '/'
103
- api_path = api_path + @record_id.to_s
213
+ api_path = api_path + external_value.to_s
104
214
  api_path = api_path + '/'
105
215
  api_path = api_path + @related_list_api_name.to_s
106
216
  handler_instance.api_path = api_path
107
217
  handler_instance.http_method = Constants::REQUEST_METHOD_DELETE
108
218
  handler_instance.category_method = Constants::REQUEST_METHOD_DELETE
219
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.DeleteRelatedRecordsUsingExternalIDHeader'), @x_external)
109
220
  handler_instance.param = param_instance
221
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
110
222
  require_relative 'action_handler'
111
223
  handler_instance.api_call(ActionHandler.name, 'application/json')
112
224
  end
113
225
 
114
226
  # The method to get related record
115
227
  # @param related_record_id [Integer] A Integer
228
+ # @param record_id [Integer] A Integer
116
229
  # @param header_instance [HeaderMap] An instance of HeaderMap
117
230
  # @return An instance of APIResponse
118
231
  # @raise SDKException
119
- def get_related_record(related_record_id, header_instance=nil)
232
+ def get_related_record(related_record_id, record_id, header_instance=nil)
120
233
  if !related_record_id.is_a? Integer
121
234
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: related_record_id EXPECTED TYPE: Integer', nil, nil)
122
235
  end
236
+ if !record_id.is_a? Integer
237
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
238
+ end
123
239
  if header_instance!=nil and !header_instance.is_a? HeaderMap
124
240
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
125
241
  end
@@ -128,7 +244,7 @@ module RelatedRecords
128
244
  api_path = api_path + '/crm/v2/'
129
245
  api_path = api_path + @module_api_name.to_s
130
246
  api_path = api_path + '/'
131
- api_path = api_path + @record_id.to_s
247
+ api_path = api_path + record_id.to_s
132
248
  api_path = api_path + '/'
133
249
  api_path = api_path + @related_list_api_name.to_s
134
250
  api_path = api_path + '/'
@@ -136,6 +252,7 @@ module RelatedRecords
136
252
  handler_instance.api_path = api_path
137
253
  handler_instance.http_method = Constants::REQUEST_METHOD_GET
138
254
  handler_instance.category_method = 'READ'
255
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordHeader'), @x_external)
139
256
  handler_instance.header = header_instance
140
257
  Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
141
258
  require_relative 'response_handler'
@@ -144,26 +261,26 @@ module RelatedRecords
144
261
 
145
262
  # The method to update related record
146
263
  # @param related_record_id [Integer] A Integer
264
+ # @param record_id [Integer] A Integer
147
265
  # @param request [BodyWrapper] An instance of BodyWrapper
148
- # @param header_instance [HeaderMap] An instance of HeaderMap
149
266
  # @return An instance of APIResponse
150
267
  # @raise SDKException
151
- def update_related_record(related_record_id, request, header_instance=nil)
268
+ def update_related_record(related_record_id, record_id, request)
152
269
  if !related_record_id.is_a? Integer
153
270
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: related_record_id EXPECTED TYPE: Integer', nil, nil)
154
271
  end
272
+ if !record_id.is_a? Integer
273
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
274
+ end
155
275
  if request!=nil and !request.is_a? BodyWrapper
156
276
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
157
277
  end
158
- if header_instance!=nil and !header_instance.is_a? HeaderMap
159
- raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
160
- end
161
278
  handler_instance = Handler::CommonAPIHandler.new
162
279
  api_path = ''
163
280
  api_path = api_path + '/crm/v2/'
164
281
  api_path = api_path + @module_api_name.to_s
165
282
  api_path = api_path + '/'
166
- api_path = api_path + @record_id.to_s
283
+ api_path = api_path + record_id.to_s
167
284
  api_path = api_path + '/'
168
285
  api_path = api_path + @related_list_api_name.to_s
169
286
  api_path = api_path + '/'
@@ -173,7 +290,7 @@ module RelatedRecords
173
290
  handler_instance.category_method = 'UPDATE'
174
291
  handler_instance.content_type = 'application/json'
175
292
  handler_instance.request = request
176
- handler_instance.header = header_instance
293
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.UpdateRelatedRecordHeader'), @x_external)
177
294
  Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
178
295
  require_relative 'action_handler'
179
296
  handler_instance.api_call(ActionHandler.name, 'application/json')
@@ -181,22 +298,22 @@ module RelatedRecords
181
298
 
182
299
  # The method to delink record
183
300
  # @param related_record_id [Integer] A Integer
184
- # @param header_instance [HeaderMap] An instance of HeaderMap
301
+ # @param record_id [Integer] A Integer
185
302
  # @return An instance of APIResponse
186
303
  # @raise SDKException
187
- def delink_record(related_record_id, header_instance=nil)
304
+ def delink_record(related_record_id, record_id)
188
305
  if !related_record_id.is_a? Integer
189
306
  raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: related_record_id EXPECTED TYPE: Integer', nil, nil)
190
307
  end
191
- if header_instance!=nil and !header_instance.is_a? HeaderMap
192
- raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
308
+ if !record_id.is_a? Integer
309
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: record_id EXPECTED TYPE: Integer', nil, nil)
193
310
  end
194
311
  handler_instance = Handler::CommonAPIHandler.new
195
312
  api_path = ''
196
313
  api_path = api_path + '/crm/v2/'
197
314
  api_path = api_path + @module_api_name.to_s
198
315
  api_path = api_path + '/'
199
- api_path = api_path + @record_id.to_s
316
+ api_path = api_path + record_id.to_s
200
317
  api_path = api_path + '/'
201
318
  api_path = api_path + @related_list_api_name.to_s
202
319
  api_path = api_path + '/'
@@ -204,11 +321,122 @@ module RelatedRecords
204
321
  handler_instance.api_path = api_path
205
322
  handler_instance.http_method = Constants::REQUEST_METHOD_DELETE
206
323
  handler_instance.category_method = Constants::REQUEST_METHOD_DELETE
324
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.DelinkRecordHeader'), @x_external)
325
+ require_relative 'action_handler'
326
+ handler_instance.api_call(ActionHandler.name, 'application/json')
327
+ end
328
+
329
+ # The method to get related record using external id
330
+ # @param external_field_value [String] A String
331
+ # @param external_value [String] A String
332
+ # @param header_instance [HeaderMap] An instance of HeaderMap
333
+ # @return An instance of APIResponse
334
+ # @raise SDKException
335
+ def get_related_record_using_external_id(external_field_value, external_value, header_instance=nil)
336
+ if !external_field_value.is_a? String
337
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: String', nil, nil)
338
+ end
339
+ if !external_value.is_a? String
340
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
341
+ end
342
+ if header_instance!=nil and !header_instance.is_a? HeaderMap
343
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
344
+ end
345
+ handler_instance = Handler::CommonAPIHandler.new
346
+ api_path = ''
347
+ api_path = api_path + '/crm/v2/'
348
+ api_path = api_path + @module_api_name.to_s
349
+ api_path = api_path + '/'
350
+ api_path = api_path + external_value.to_s
351
+ api_path = api_path + '/'
352
+ api_path = api_path + @related_list_api_name.to_s
353
+ api_path = api_path + '/'
354
+ api_path = api_path + external_field_value.to_s
355
+ handler_instance.api_path = api_path
356
+ handler_instance.http_method = Constants::REQUEST_METHOD_GET
357
+ handler_instance.category_method = 'READ'
358
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordUsingExternalIDHeader'), @x_external)
207
359
  handler_instance.header = header_instance
360
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
361
+ require_relative 'response_handler'
362
+ handler_instance.api_call(ResponseHandler.name, 'application/json')
363
+ end
364
+
365
+ # The method to update related record using external id
366
+ # @param external_field_value [String] A String
367
+ # @param external_value [String] A String
368
+ # @param request [BodyWrapper] An instance of BodyWrapper
369
+ # @return An instance of APIResponse
370
+ # @raise SDKException
371
+ def update_related_record_using_external_id(external_field_value, external_value, request)
372
+ if !external_field_value.is_a? String
373
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: String', nil, nil)
374
+ end
375
+ if !external_value.is_a? String
376
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
377
+ end
378
+ if request!=nil and !request.is_a? BodyWrapper
379
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
380
+ end
381
+ handler_instance = Handler::CommonAPIHandler.new
382
+ api_path = ''
383
+ api_path = api_path + '/crm/v2/'
384
+ api_path = api_path + @module_api_name.to_s
385
+ api_path = api_path + '/'
386
+ api_path = api_path + external_value.to_s
387
+ api_path = api_path + '/'
388
+ api_path = api_path + @related_list_api_name.to_s
389
+ api_path = api_path + '/'
390
+ api_path = api_path + external_field_value.to_s
391
+ handler_instance.api_path = api_path
392
+ handler_instance.http_method = Constants::REQUEST_METHOD_PUT
393
+ handler_instance.category_method = 'UPDATE'
394
+ handler_instance.content_type = 'application/json'
395
+ handler_instance.request = request
396
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.UpdateRelatedRecordUsingExternalIDHeader'), @x_external)
397
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
398
+ require_relative 'action_handler'
399
+ handler_instance.api_call(ActionHandler.name, 'application/json')
400
+ end
401
+
402
+ # The method to delete related record using external id
403
+ # @param external_field_value [String] A String
404
+ # @param external_value [String] A String
405
+ # @return An instance of APIResponse
406
+ # @raise SDKException
407
+ def delete_related_record_using_external_id(external_field_value, external_value)
408
+ if !external_field_value.is_a? String
409
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_field_value EXPECTED TYPE: String', nil, nil)
410
+ end
411
+ if !external_value.is_a? String
412
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: external_value EXPECTED TYPE: String', nil, nil)
413
+ end
414
+ handler_instance = Handler::CommonAPIHandler.new
415
+ api_path = ''
416
+ api_path = api_path + '/crm/v2/'
417
+ api_path = api_path + @module_api_name.to_s
418
+ api_path = api_path + '/'
419
+ api_path = api_path + external_value.to_s
420
+ api_path = api_path + '/'
421
+ api_path = api_path + @related_list_api_name.to_s
422
+ api_path = api_path + '/'
423
+ api_path = api_path + external_field_value.to_s
424
+ handler_instance.api_path = api_path
425
+ handler_instance.http_method = Constants::REQUEST_METHOD_DELETE
426
+ handler_instance.category_method = Constants::REQUEST_METHOD_DELETE
427
+ handler_instance.add_header(Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.DeleteRelatedRecordUsingExternalIDHeader'), @x_external)
428
+ Util::Utility.get_related_lists(@related_list_api_name, @module_api_name, handler_instance)
208
429
  require_relative 'action_handler'
209
430
  handler_instance.api_call(ActionHandler.name, 'application/json')
210
431
  end
211
432
 
433
+ class GetRelatedRecordsHeader
434
+ @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsHeader')
435
+ def self.If_modified_since
436
+ @@If_modified_since
437
+ end
438
+ end
439
+
212
440
  class GetRelatedRecordsParam
213
441
  @@page = Param.new('page', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsParam')
214
442
  def self.page
@@ -220,19 +448,45 @@ module RelatedRecords
220
448
  end
221
449
  end
222
450
 
223
- class GetRelatedRecordsHeader
224
- @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsHeader')
451
+ class UpdateRelatedRecordsHeader
452
+ end
453
+
454
+ class DelinkRecordsHeader
455
+ end
456
+
457
+ class DelinkRecordsParam
458
+ @@ids = Param.new('ids', 'com.zoho.crm.api.RelatedRecords.DelinkRecordsParam')
459
+ def self.ids
460
+ @@ids
461
+ end
462
+ end
463
+
464
+ class GetRelatedRecordsUsingExternalIDHeader
465
+ @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsUsingExternalIDHeader')
225
466
  def self.If_modified_since
226
467
  @@If_modified_since
227
468
  end
228
- @@X_external = Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsHeader')
229
- def self.X_external
230
- @@X_external
469
+ end
470
+
471
+ class GetRelatedRecordsUsingExternalIDParam
472
+ @@page = Param.new('page', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsUsingExternalIDParam')
473
+ def self.page
474
+ @@page
475
+ end
476
+ @@per_page = Param.new('per_page', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordsUsingExternalIDParam')
477
+ def self.per_page
478
+ @@per_page
231
479
  end
232
480
  end
233
481
 
234
- class DelinkRecordsParam
235
- @@ids = Param.new('ids', 'com.zoho.crm.api.RelatedRecords.DelinkRecordsParam')
482
+ class UpdateRelatedRecordsUsingExternalIDHeader
483
+ end
484
+
485
+ class DeleteRelatedRecordsUsingExternalIDHeader
486
+ end
487
+
488
+ class DeleteRelatedRecordsUsingExternalIDParam
489
+ @@ids = Param.new('ids', 'com.zoho.crm.api.RelatedRecords.DeleteRelatedRecordsUsingExternalIDParam')
236
490
  def self.ids
237
491
  @@ids
238
492
  end
@@ -246,18 +500,23 @@ module RelatedRecords
246
500
  end
247
501
 
248
502
  class UpdateRelatedRecordHeader
249
- @@X_external = Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.UpdateRelatedRecordHeader')
250
- def self.X_external
251
- @@X_external
252
- end
253
503
  end
254
504
 
255
505
  class DelinkRecordHeader
256
- @@X_external = Header.new('X-EXTERNAL', 'com.zoho.crm.api.RelatedRecords.DelinkRecordHeader')
257
- def self.X_external
258
- @@X_external
506
+ end
507
+
508
+ class GetRelatedRecordUsingExternalIDHeader
509
+ @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.RelatedRecords.GetRelatedRecordUsingExternalIDHeader')
510
+ def self.If_modified_since
511
+ @@If_modified_since
259
512
  end
260
513
  end
261
514
 
515
+ class UpdateRelatedRecordUsingExternalIDHeader
516
+ end
517
+
518
+ class DeleteRelatedRecordUsingExternalIDHeader
519
+ end
520
+
262
521
  end
263
522
  end