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.
- checksums.yaml +4 -4
- data/src/ZOHOCRMSDK2_0.rb +6 -0
- data/src/com/zoho/api/authenticator/oauth_token.rb +86 -32
- data/src/com/zoho/api/authenticator/store/db_store.rb +71 -29
- data/src/com/zoho/api/authenticator/store/file_store.rb +95 -24
- data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
- data/src/com/zoho/api/logger/sdk_logger.rb +19 -9
- data/src/com/zoho/crm/api/contact_roles/api_exception.rb +4 -0
- data/src/com/zoho/crm/api/contact_roles/contact_role_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +118 -0
- data/src/com/zoho/crm/api/contact_roles/record_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/contact_roles/record_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/contact_roles/record_body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/contact_roles/record_response_handler.rb +10 -0
- data/src/com/zoho/crm/api/contact_roles/record_response_wrapper.rb +84 -0
- data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
- data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/initializer.rb +44 -16
- data/src/com/zoho/crm/api/record/record_operations.rb +198 -1
- data/src/com/zoho/crm/api/related_records/related_records_operations.rb +299 -40
- data/src/com/zoho/crm/api/request_proxy.rb +3 -4
- data/src/com/zoho/crm/api/sdk_config.rb +2 -68
- data/src/com/zoho/crm/api/util/api_http_connector.rb +6 -6
- data/src/com/zoho/crm/api/util/constants.rb +113 -16
- data/src/com/zoho/crm/api/util/converter.rb +21 -4
- data/src/com/zoho/crm/api/util/data_type_converter.rb +8 -2
- data/src/com/zoho/crm/api/util/form_data_converter.rb +4 -16
- data/src/com/zoho/crm/api/util/json_converter.rb +7 -9
- data/src/com/zoho/crm/api/util/module_fields_handler.rb +1 -1
- data/src/com/zoho/crm/api/util/utility.rb +197 -82
- data/src/resources/JSONDetails.json +1 -1
- data/src/version.rb +2 -2
- metadata +8 -2
@@ -1,16 +1,15 @@
|
|
1
1
|
require_relative 'util/constants'
|
2
2
|
|
3
3
|
class RequestProxy
|
4
|
-
|
5
|
-
def initialize(host
|
4
|
+
attr_reader :host , :port ,:user_name ,:password
|
5
|
+
def initialize(host:, port:, user_name:, password:"")
|
6
|
+
|
6
7
|
raise SDKException.new(Constants::REQUEST_PROXY_ERROR, Constants::HOST_ERROR_MESSAGE) if host.nil?
|
7
8
|
|
8
9
|
raise SDKException.new(Constants::REQUEST_PROXY_ERROR, Constants::PORT_ERROR_MESSAGE) if port.nil?
|
9
|
-
|
10
10
|
@host = host
|
11
11
|
@port = port
|
12
12
|
@user_name = user_name
|
13
13
|
@password = password
|
14
|
-
@password = '' if password.nil?
|
15
14
|
end
|
16
15
|
end
|
@@ -1,49 +1,7 @@
|
|
1
1
|
class SDKConfig
|
2
|
-
|
3
|
-
def initialize
|
4
|
-
@auto_refresh_fields = false
|
5
|
-
@pick_list_validation = true
|
6
|
-
@open_timeout = 60
|
7
|
-
@read_timeout = 60
|
8
|
-
@write_timeout = 60
|
9
|
-
@keep_alive_timeout = 2
|
10
|
-
end
|
2
|
+
attr_reader :auto_refresh_fields , :pick_list_validation ,:open_timeout ,:read_timeout ,:write_timeout ,:keep_alive_timeout
|
11
3
|
|
12
|
-
|
13
|
-
@auto_refresh_fields = auto_refresh_fields
|
14
|
-
self
|
15
|
-
end
|
16
|
-
|
17
|
-
def pick_list_validation(pick_list_validation)
|
18
|
-
@pick_list_validation = pick_list_validation
|
19
|
-
self
|
20
|
-
end
|
21
|
-
|
22
|
-
def open_timeout(open_timeout)
|
23
|
-
@open_timeout = open_timeout
|
24
|
-
self
|
25
|
-
end
|
26
|
-
|
27
|
-
def read_timeout(read_timeout)
|
28
|
-
@read_timeout = read_timeout
|
29
|
-
self
|
30
|
-
end
|
31
|
-
|
32
|
-
def write_timeout(write_timeout)
|
33
|
-
@write_timeout = write_timeout
|
34
|
-
self
|
35
|
-
end
|
36
|
-
|
37
|
-
def keep_alive_timeout(keep_alive_timeout)
|
38
|
-
@keep_alive_timeout = keep_alive_timeout
|
39
|
-
self
|
40
|
-
end
|
41
|
-
|
42
|
-
def build
|
43
|
-
SDKConfig.new(@auto_refresh_fields, @pick_list_validation,@open_timeout,@read_timeout,@write_timeout,@keep_alive_timeout)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
def initialize(auto_refresh_fields, pick_list_validation,open_timeout,read_timeout,write_timeout,keep_alive_timeout)
|
4
|
+
def initialize(auto_refresh_fields: false, pick_list_validation: true,open_timeout: 60,read_timeout: 60,write_timeout: 60,keep_alive_timeout: 2)
|
47
5
|
@auto_refresh_fields = auto_refresh_fields
|
48
6
|
@pick_list_validation = pick_list_validation
|
49
7
|
@open_timeout = open_timeout
|
@@ -51,28 +9,4 @@ class SDKConfig
|
|
51
9
|
@write_timeout = write_timeout
|
52
10
|
@keep_alive_timeout = keep_alive_timeout
|
53
11
|
end
|
54
|
-
|
55
|
-
def auto_refresh_fields
|
56
|
-
@auto_refresh_fields
|
57
|
-
end
|
58
|
-
|
59
|
-
def pick_list_validation
|
60
|
-
@pick_list_validation
|
61
|
-
end
|
62
|
-
|
63
|
-
def open_timeout
|
64
|
-
@open_timeout
|
65
|
-
end
|
66
|
-
|
67
|
-
def read_timeout
|
68
|
-
@read_timeout
|
69
|
-
end
|
70
|
-
|
71
|
-
def write_timeout
|
72
|
-
@write_timeout
|
73
|
-
end
|
74
|
-
|
75
|
-
def keep_alive_timeout
|
76
|
-
@keep_alive_timeout
|
77
|
-
end
|
78
12
|
end
|
@@ -24,7 +24,7 @@ module Util
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def set_content_type_header
|
27
|
-
Constants::
|
27
|
+
Constants::SET_CONTENT_TYPE_HEADER.each do |content_type|
|
28
28
|
if @url.include? content_type
|
29
29
|
@headers[Constants::CONTENT_TYPE] = @content_type
|
30
30
|
break
|
@@ -49,7 +49,6 @@ module Util
|
|
49
49
|
http = nil
|
50
50
|
initializer = Initializer.get_initializer
|
51
51
|
request_proxy = initializer.request_proxy
|
52
|
-
|
53
52
|
if request_proxy.nil?
|
54
53
|
http = Net::HTTP.new(url.host, url.port)
|
55
54
|
else
|
@@ -97,16 +96,17 @@ module Util
|
|
97
96
|
|
98
97
|
def to_s
|
99
98
|
req_headers = @headers.clone
|
100
|
-
req_headers
|
99
|
+
req_headers[Constants::AUTHORIZATION] = Constants::CANT_DISCLOSE
|
101
100
|
@request_method + ' - ' + Constants::URL + ' = ' + @url + ', ' + Constants::HEADERS + ' = ' + req_headers.to_s + ', ' + Constants::PARAMS + ' = ' + @parameters.to_s
|
102
101
|
end
|
103
102
|
|
104
103
|
def proxy_log(request_proxy)
|
104
|
+
proxy_log = Constants::PROXY_SETTINGS + Constants::PROXY_HOST + request_proxy.host + " , "
|
105
|
+
proxy_log += Constants::PROXY_PORT + request_proxy.port.to_s
|
105
106
|
if request_proxy.user_name.nil?
|
106
|
-
|
107
|
-
else
|
108
|
-
'Proxy settings - Host : ' + request_proxy.host + ' , Port : ' + request_proxy.port.to_s + ' , Proxy User : ' + request_proxy.user_name
|
107
|
+
proxy_log += " , " + Constants::PROXY_USER + request_proxy.user_name
|
109
108
|
end
|
109
|
+
proxy_log
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -26,6 +26,8 @@ class Constants
|
|
26
26
|
|
27
27
|
RESPONSECODE_BAD_REQUEST = 400
|
28
28
|
|
29
|
+
JSON_DETAILS_ERROR = "ERROR IN READING JSONDETAILS FILE"
|
30
|
+
|
29
31
|
RESPONSECODE_AUTHORIZATION_ERROR = 401
|
30
32
|
|
31
33
|
RESPONSECODE_FORBIDDEN = 403
|
@@ -94,17 +96,73 @@ class Constants
|
|
94
96
|
|
95
97
|
HTTP = 'http'
|
96
98
|
|
99
|
+
DEFAULT_MODULENAME_VS_APINAME = {
|
100
|
+
|
101
|
+
"leads" => "Leads",
|
102
|
+
|
103
|
+
"contacts" => "Contacts",
|
104
|
+
|
105
|
+
"accounts" => "Accounts",
|
106
|
+
|
107
|
+
"deals" => "Deals",
|
108
|
+
|
109
|
+
"tasks" => "Tasks",
|
110
|
+
|
111
|
+
"events" => "Events",
|
112
|
+
|
113
|
+
"activities" => "Activities",
|
114
|
+
|
115
|
+
"calls" => "Calls",
|
116
|
+
|
117
|
+
"products" => "Products",
|
118
|
+
|
119
|
+
"quotes" => "Quotes",
|
120
|
+
|
121
|
+
"sales_orders" => "Sales_Orders",
|
122
|
+
|
123
|
+
"purchase_orders" => "Purchase_Orders",
|
124
|
+
|
125
|
+
"invoices" => "Invoices",
|
126
|
+
|
127
|
+
"campaigns" => "Campaigns",
|
128
|
+
|
129
|
+
"vendors" => "Vendors",
|
130
|
+
|
131
|
+
"price_books" => "Price_Books",
|
132
|
+
|
133
|
+
"cases" => "Cases",
|
134
|
+
|
135
|
+
"solutions" => "Solutions",
|
136
|
+
|
137
|
+
"visits" => "Visits",
|
138
|
+
|
139
|
+
"approvals" => "Approvals",
|
140
|
+
|
141
|
+
"notes" => "Notes",
|
142
|
+
|
143
|
+
"attachments" => "Attachments",
|
144
|
+
|
145
|
+
"actions_performed" => "Actions_Performed",
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
USER_AGENT = "Mozilla/5.0"
|
150
|
+
|
151
|
+
USER_AGENT_KEY = "user-agent"
|
152
|
+
|
97
153
|
CONTENT_API_URL = 'content.zohoapis.com'
|
98
154
|
|
99
155
|
INVALID_URL_ERROR = 'Invalid URI Error'
|
100
156
|
|
101
157
|
ZOHO_SDK = 'X-ZOHO-SDK'
|
102
158
|
|
103
|
-
SDK_VERSION = '
|
159
|
+
SDK_VERSION = '2.0.0'
|
104
160
|
|
105
161
|
ZOHO_API_VERSION = '2.0'
|
106
162
|
|
107
|
-
|
163
|
+
SET_CONTENT_TYPE_HEADER = ['/crm/bulk/v2/read', '/crm/bulk/v2/write']
|
164
|
+
|
165
|
+
RESOURCE_PATH_INVALID_ERROR_MESSAGE = "Resource Path MUST be a valid directory."
|
108
166
|
|
109
167
|
IS_GENERATE_REQUEST_BODY =[REQUEST_METHOD_POST,REQUEST_METHOD_PUT,REQUEST_METHOD_PATCH]
|
110
168
|
|
@@ -114,9 +172,7 @@ class Constants
|
|
114
172
|
|
115
173
|
CRM = "crm"
|
116
174
|
|
117
|
-
|
118
|
-
|
119
|
-
PHOTO_SUPPORTED_MODULES = ["leads", "contacts", "accounts", "products", "vendors"]
|
175
|
+
PHOTO_SUPPORTED_MODULES = ["leads", "contacts", "accounts", "products", "vendors", "deals", "cases", "solutions"]
|
120
176
|
|
121
177
|
PARAMETER_NULL_ERROR = 'NULL PARAMETER ERROR'
|
122
178
|
|
@@ -144,9 +200,9 @@ class Constants
|
|
144
200
|
|
145
201
|
NULL_VALUE_ERROR_MESSAGE = ' MUST NOT be null'
|
146
202
|
|
147
|
-
PARAM_INSTANCE_NULL_ERROR = 'Param
|
203
|
+
PARAM_INSTANCE_NULL_ERROR = 'Param Instance MUST NOT be null'
|
148
204
|
|
149
|
-
HEADER_INSTANCE_NULL_ERROR = 'Header
|
205
|
+
HEADER_INSTANCE_NULL_ERROR = 'Header Instance MUST NOT be null'
|
150
206
|
|
151
207
|
SDK_UNINITIALIZATION_ERROR = 'SDK UNINITIALIZED ERROR'
|
152
208
|
|
@@ -170,6 +226,16 @@ class Constants
|
|
170
226
|
|
171
227
|
EXPIRY_TIME = 'expiry_time'
|
172
228
|
|
229
|
+
PROXY_SETTINGS = "Proxy settings - "
|
230
|
+
|
231
|
+
PROXY_HOST = "Host: "
|
232
|
+
|
233
|
+
PROXY_PORT = "Port: "
|
234
|
+
|
235
|
+
PROXY_USER = "User: "
|
236
|
+
|
237
|
+
PROXY_DOMAIN = "Domain: "
|
238
|
+
|
173
239
|
USER_MAIL_NULL_ERROR = 'USER MAIL NULL ERROR'
|
174
240
|
|
175
241
|
USER_MAIL_NULL_ERROR_MESSAGE = 'User Mail MUST NOT be null. Use setUserMail() to set value.'
|
@@ -180,6 +246,10 @@ class Constants
|
|
180
246
|
|
181
247
|
GET_TOKEN_DB_ERROR = 'Exception in get_token - DBStore:'
|
182
248
|
|
249
|
+
GET_TOKEN_BY_ID_DB_ERROR = "Exception in getTokenById - DBStore : Given ID is invalid"
|
250
|
+
|
251
|
+
GET_TOKEN_BY_ID_FILE_ERROR = "Exception in getTokenById - FileStore : Given ID is invalid"
|
252
|
+
|
183
253
|
GET_TOKENS_DB_ERROR = 'Exception in get_tokens - DBStore:'
|
184
254
|
|
185
255
|
DELETE_TOKEN_DB_ERROR = 'Exception in delete_token - DBStore:'
|
@@ -190,6 +260,8 @@ class Constants
|
|
190
260
|
|
191
261
|
GET_TOKEN_FILE_ERROR = 'Exception in get_token - FileStore:'
|
192
262
|
|
263
|
+
LOGGER_INITIALIZATION_ERROR = "Exception in Logger Initialization : "
|
264
|
+
|
193
265
|
REFRESH_SINGLE_MODULE_FIELDS_ERROR = 'Exception in refreshing fields of module : '
|
194
266
|
|
195
267
|
REFRESH_ALL_MODULE_FIELDS_ERROR = 'Exception in refreshing fields of all modules : '
|
@@ -216,8 +288,6 @@ class Constants
|
|
216
288
|
|
217
289
|
DELETE_TOKENS_FILE_ERROR = 'Exception in delete_tokens - FileStore:'
|
218
290
|
|
219
|
-
SDK_LOGGER_INITIALIZE = 'Exception in Logger Initialization'
|
220
|
-
|
221
291
|
DELETE_MODULE_FROM_FIELDFILE_ERROR = 'Exception in deleting module from Fields file'
|
222
292
|
|
223
293
|
DELETE_FIELD_FILE_ERROR = 'Exception in deleting Current User Fields file'
|
@@ -232,7 +302,19 @@ class Constants
|
|
232
302
|
|
233
303
|
GIVEN_VALUE = "given-value"
|
234
304
|
|
235
|
-
|
305
|
+
GENERATED_TYPE = "generated_type"
|
306
|
+
|
307
|
+
GENERATED_TYPE_CUSTOM = "custom"
|
308
|
+
|
309
|
+
UPLOAD_PHOTO_UNSUPPORTED_MESSAGE = "Photo Upload Operation is not supported by the module: "
|
310
|
+
|
311
|
+
SDK_MODULE_METADATA = "SDK-MODULE-METADATA"
|
312
|
+
|
313
|
+
INVALID_MODULE_API_NAME_ERROR = "INVALID MODULE API NAME ERROR"
|
314
|
+
|
315
|
+
PROVIDE_VALID_MODULE_API_NAME = "PROVIDE VALID MODULE API NAME: "
|
316
|
+
|
317
|
+
UPLOAD_PHOTO_UNSUPPORTED_ERROR = "UPLOAD PHOTO UNSUPPORTED MODULE"
|
236
318
|
|
237
319
|
INVALID_MODULE = "INVALID_MODULE"
|
238
320
|
|
@@ -263,6 +345,8 @@ class Constants
|
|
263
345
|
REQUEST_CATEGORY_UPDATE = 'UPDATE'
|
264
346
|
|
265
347
|
MODULEPACKAGENAME = 'modulePackageName'
|
348
|
+
|
349
|
+
MYSQL_TABLE_NAME = "oauthtoken"
|
266
350
|
|
267
351
|
INITIALIZATION_SUCCESSFUL = 'Initialization successful'
|
268
352
|
|
@@ -495,19 +579,23 @@ class Constants
|
|
495
579
|
HOST_ERROR_MESSAGE = 'Host MUST NOT be null.'
|
496
580
|
|
497
581
|
PORT_ERROR_MESSAGE = 'Port MUST NOT be null.'
|
582
|
+
|
583
|
+
REQUEST_PROXY_ERROR_MESSAGE = "request_proxy must be instance of Request Proxy"
|
584
|
+
|
585
|
+
USER_SIGNATURE_ERROR_MESSAGE = "user must be instance of UserSignature."
|
498
586
|
|
499
|
-
|
500
|
-
|
501
|
-
ENVIRONMENT_ERROR_MESSAGE = "Environment MUST NOT be null."
|
587
|
+
ENVIRONMENT_ERROR_MESSAGE = "environment must be instance of Environment."
|
502
588
|
|
503
|
-
|
589
|
+
SDK_CONFIG_ERROR_MESSAGE = "sdk_config must be instance of sdkConfig."
|
504
590
|
|
505
|
-
TOKEN_ERROR_MESSAGE = "
|
591
|
+
TOKEN_ERROR_MESSAGE = "token must be instance of Token."
|
506
592
|
|
507
|
-
|
593
|
+
STORE_ERROR_MESSAGE = "store must be instance of Store."
|
508
594
|
|
509
595
|
INITIALIZATION_EXCEPTION = 'Exception in initialization'
|
510
596
|
|
597
|
+
SWITCH_USER_EXCEPTION = 'Exception in Switch user'
|
598
|
+
|
511
599
|
SWITCH_USER_ERROR = "SWITCH USER ERROR"
|
512
600
|
|
513
601
|
EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
@@ -535,4 +623,13 @@ class Constants
|
|
535
623
|
PICKLIST = 'picklist'
|
536
624
|
|
537
625
|
CONSENT_NAMESPACE = 'com.zoho.crm.api.record.Consent'
|
626
|
+
|
627
|
+
INVALID_TOKEN_ERROR = "INVALID TOKEN ERROR"
|
628
|
+
|
629
|
+
NO_ACCESS_TOKEN_ERROR = "ACCESS TOKEN IS NOT PRESENT IN RESPONSE"
|
630
|
+
|
631
|
+
CLIENT_ID_NULL_ERROR_MESSAGE = "ClientID MUST NOT be null"
|
632
|
+
|
633
|
+
CLIENT_SECRET_NULL_ERROR_MESSAGE = "ClientSecret MUST NOT be null"
|
634
|
+
|
538
635
|
end
|
@@ -56,7 +56,23 @@ module Util
|
|
56
56
|
check = true
|
57
57
|
|
58
58
|
unless value.nil?
|
59
|
-
|
59
|
+
if key_details.key? Constants::INTERFACE and key_details[Constants::INTERFACE] == true
|
60
|
+
json_details = Initializer.get_initializer.json_details
|
61
|
+
interface_details = json_details[key_details[Constants::STRUCTURE_NAME]]
|
62
|
+
classes = interface_details[Constants::CLASSES]
|
63
|
+
check = false
|
64
|
+
classes.each do |each_class_name|
|
65
|
+
class_name_lower = each_class_name.to_s.downcase
|
66
|
+
value_class_name = til::Utility.path_to_package(value.class.name).downcase
|
67
|
+
|
68
|
+
if class_name_lower.downcase == value_class_name
|
69
|
+
check = true
|
70
|
+
break
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
var_type = value.class.name
|
75
|
+
end
|
60
76
|
end
|
61
77
|
|
62
78
|
if Constants::DATA_TYPE.key? type
|
@@ -70,7 +86,6 @@ module Util
|
|
70
86
|
instance_number = index
|
71
87
|
type = Constants::LIST_NAMESPACE + '(' + structure_name + ')'
|
72
88
|
var_type = Constants::LIST_NAMESPACE + '(' + class_name + ')'
|
73
|
-
expected_list_type = false
|
74
89
|
check = false
|
75
90
|
|
76
91
|
break
|
@@ -108,7 +123,9 @@ module Util
|
|
108
123
|
|
109
124
|
if key_details.key?(Constants::VALUES) && (!key_details.key?(Constants::PICKLIST) || (key_details[Constants::PICKLIST] && Initializer.get_initializer.sdk_config.pick_list_validation))
|
110
125
|
value = value.value if value.is_a? Util::Choice
|
111
|
-
|
126
|
+
|
127
|
+
values_ja = key_details[Constants::VALUES]
|
128
|
+
unless values_ja.include? value
|
112
129
|
|
113
130
|
unless instance_number.nil?
|
114
131
|
error[Constants::INDEX] = instance_number
|
@@ -120,7 +137,7 @@ module Util
|
|
120
137
|
|
121
138
|
error[Constants::ERROR_HASH_FIELD] = member_name
|
122
139
|
|
123
|
-
error[Constants::ACCEPTED_VALUES] =
|
140
|
+
error[Constants::ACCEPTED_VALUES] = values_ja
|
124
141
|
|
125
142
|
raise SDKException.new(Constants::UNACCEPTED_VALUES_ERROR, nil, error, nil)
|
126
143
|
end
|
@@ -108,7 +108,10 @@ module Util
|
|
108
108
|
# @raise Exception
|
109
109
|
def self.pre_convert(obj, type)
|
110
110
|
init
|
111
|
-
@@pre_converter_map
|
111
|
+
if @@pre_converter_map.key? type
|
112
|
+
return @@pre_converter_map[type].call(obj)
|
113
|
+
end
|
114
|
+
obj
|
112
115
|
end
|
113
116
|
|
114
117
|
# This method is to convert Java data to JSON data value.
|
@@ -118,7 +121,10 @@ module Util
|
|
118
121
|
# @raise Exception
|
119
122
|
def self.post_convert(obj, type)
|
120
123
|
init
|
121
|
-
@@post_converter_map
|
124
|
+
if @@post_converter_map.key? type
|
125
|
+
return @@post_converter_map[type].call(obj)
|
126
|
+
end
|
127
|
+
obj
|
122
128
|
end
|
123
129
|
|
124
130
|
def self.pre_convert_object_data(obj)
|
@@ -13,10 +13,10 @@ module Util
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def append_to_request(request_base, request_object)
|
16
|
-
request_base.set_form(
|
16
|
+
request_base.set_form(set_file_body(request_object), Constants::MULTIPART_FORM_DATA) if request_object.is_a?(Hash)
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def set_file_body(request_object)
|
20
20
|
data = []
|
21
21
|
request_object.each do |key, value|
|
22
22
|
if value.is_a? Array
|
@@ -38,19 +38,7 @@ module Util
|
|
38
38
|
|
39
39
|
def form_request(request_instance, class_path, instance_no, member_json_details = nil)
|
40
40
|
require_relative '../initializer'
|
41
|
-
|
42
|
-
path = @common_api_handler.api_path.split("/")
|
43
|
-
if path.length == 6
|
44
|
-
module_api_name = path[3].downcase
|
45
|
-
if path[1].downcase == Constants::CRM && path[2].downcase == Constants::API_VERSION && path[5].downcase == Constants::PHOTO && !(Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name)
|
46
|
-
api_supported_module = Utility::api_supported_module
|
47
|
-
if api_supported_module.key?(module_api_name) && api_supported_module[module_api_name].downcase != "custom"
|
48
|
-
raise SDKException.new(Constants::INVALID_MODULE, Constants::PHOTO_UPLOAD_ERROR_MESSAGE)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
41
|
+
|
54
42
|
package_name = Utility.path_to_package(class_path)
|
55
43
|
class_details = Initializer.json_details[package_name]
|
56
44
|
request_hash = {}
|
@@ -73,7 +61,7 @@ module Util
|
|
73
61
|
|
74
62
|
member_data = request_instance.instance_variable_get(Constants::AT + member_name)
|
75
63
|
|
76
|
-
if !modified.nil? && (modified != 0) && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
|
64
|
+
if !modified.nil? && (modified != 0) && !member_data.nil? && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
|
77
65
|
key_name = member_details[Constants::NAME]
|
78
66
|
type = member_details[Constants::TYPE]
|
79
67
|
if type.downcase == Constants::LIST_NAMESPACE.downcase
|