ZOHOCRMSDK2_0 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/src/com/zoho/api/authenticator/oauth_token.rb +184 -178
  3. data/src/com/zoho/api/authenticator/store/db_store.rb +125 -123
  4. data/src/com/zoho/api/authenticator/store/file_store.rb +155 -153
  5. data/src/com/zoho/api/authenticator/store/token_store.rb +29 -27
  6. data/src/com/zoho/api/authenticator/token.rb +10 -8
  7. data/src/com/zoho/api/logger/sdk_logger.rb +59 -57
  8. data/src/com/zoho/crm/api/attachments/action_handler.rb +7 -5
  9. data/src/com/zoho/crm/api/attachments/action_response.rb +7 -5
  10. data/src/com/zoho/crm/api/attachments/action_wrapper.rb +48 -46
  11. data/src/com/zoho/crm/api/attachments/api_exception.rb +95 -93
  12. data/src/com/zoho/crm/api/attachments/attachment.rb +271 -269
  13. data/src/com/zoho/crm/api/attachments/attachments_operations.rb +168 -166
  14. data/src/com/zoho/crm/api/attachments/file_body_wrapper.rb +48 -46
  15. data/src/com/zoho/crm/api/attachments/response_handler.rb +7 -5
  16. data/src/com/zoho/crm/api/attachments/response_wrapper.rb +63 -61
  17. data/src/com/zoho/crm/api/attachments/success_response.rb +91 -89
  18. data/src/com/zoho/crm/api/blue_print/action_response.rb +7 -5
  19. data/src/com/zoho/crm/api/blue_print/api_exception.rb +93 -91
  20. data/src/com/zoho/crm/api/blue_print/blue_print.rb +89 -87
  21. data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +56 -54
  22. data/src/com/zoho/crm/api/blue_print/body_wrapper.rb +47 -45
  23. data/src/com/zoho/crm/api/blue_print/next_transition.rb +61 -59
  24. data/src/com/zoho/crm/api/blue_print/process_info.rb +187 -185
  25. data/src/com/zoho/crm/api/blue_print/response_handler.rb +7 -5
  26. data/src/com/zoho/crm/api/blue_print/response_wrapper.rb +48 -46
  27. data/src/com/zoho/crm/api/blue_print/success_response.rb +91 -89
  28. data/src/com/zoho/crm/api/blue_print/transition.rb +187 -185
  29. data/src/com/zoho/crm/api/blue_print/validation_error.rb +61 -59
  30. data/src/com/zoho/crm/api/bulk_read/action_handler.rb +7 -5
  31. data/src/com/zoho/crm/api/bulk_read/action_response.rb +7 -5
  32. data/src/com/zoho/crm/api/bulk_read/action_wrapper.rb +63 -61
  33. data/src/com/zoho/crm/api/bulk_read/api_exception.rb +95 -93
  34. data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +61 -59
  35. data/src/com/zoho/crm/api/bulk_read/call_back.rb +61 -59
  36. data/src/com/zoho/crm/api/bulk_read/criteria.rb +101 -99
  37. data/src/com/zoho/crm/api/bulk_read/file_body_wrapper.rb +48 -46
  38. data/src/com/zoho/crm/api/bulk_read/job_detail.rb +145 -143
  39. data/src/com/zoho/crm/api/bulk_read/query.rb +103 -101
  40. data/src/com/zoho/crm/api/bulk_read/request_wrapper.rb +75 -73
  41. data/src/com/zoho/crm/api/bulk_read/response_handler.rb +7 -5
  42. data/src/com/zoho/crm/api/bulk_read/response_wrapper.rb +48 -46
  43. data/src/com/zoho/crm/api/bulk_read/result.rb +103 -101
  44. data/src/com/zoho/crm/api/bulk_read/success_response.rb +91 -89
  45. data/src/com/zoho/crm/api/bulk_write/action_response.rb +7 -5
  46. data/src/com/zoho/crm/api/bulk_write/api_exception.rb +179 -177
  47. data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +93 -91
  48. data/src/com/zoho/crm/api/bulk_write/bulk_write_response.rb +161 -159
  49. data/src/com/zoho/crm/api/bulk_write/call_back.rb +61 -59
  50. data/src/com/zoho/crm/api/bulk_write/field_mapping.rb +117 -115
  51. data/src/com/zoho/crm/api/bulk_write/file.rb +117 -115
  52. data/src/com/zoho/crm/api/bulk_write/file_body_wrapper.rb +48 -46
  53. data/src/com/zoho/crm/api/bulk_write/request_wrapper.rb +89 -87
  54. data/src/com/zoho/crm/api/bulk_write/resource.rb +145 -143
  55. data/src/com/zoho/crm/api/bulk_write/response_handler.rb +7 -5
  56. data/src/com/zoho/crm/api/bulk_write/response_wrapper.rb +7 -5
  57. data/src/com/zoho/crm/api/bulk_write/result.rb +47 -45
  58. data/src/com/zoho/crm/api/bulk_write/success_response.rb +91 -89
  59. data/src/com/zoho/crm/api/contact_roles/action_handler.rb +7 -5
  60. data/src/com/zoho/crm/api/contact_roles/action_response.rb +7 -5
  61. data/src/com/zoho/crm/api/contact_roles/action_wrapper.rb +48 -46
  62. data/src/com/zoho/crm/api/contact_roles/api_exception.rb +99 -97
  63. data/src/com/zoho/crm/api/contact_roles/body_wrapper.rb +47 -45
  64. data/src/com/zoho/crm/api/contact_roles/contact_role.rb +75 -73
  65. data/src/com/zoho/crm/api/contact_roles/contact_role_wrapper.rb +47 -45
  66. data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +244 -242
  67. data/src/com/zoho/crm/api/contact_roles/record_action_handler.rb +7 -5
  68. data/src/com/zoho/crm/api/contact_roles/record_action_wrapper.rb +48 -46
  69. data/src/com/zoho/crm/api/contact_roles/record_body_wrapper.rb +47 -45
  70. data/src/com/zoho/crm/api/contact_roles/record_response_handler.rb +7 -5
  71. data/src/com/zoho/crm/api/contact_roles/record_response_wrapper.rb +63 -61
  72. data/src/com/zoho/crm/api/contact_roles/response_handler.rb +7 -5
  73. data/src/com/zoho/crm/api/contact_roles/response_wrapper.rb +48 -46
  74. data/src/com/zoho/crm/api/contact_roles/success_response.rb +91 -89
  75. data/src/com/zoho/crm/api/currencies/action_handler.rb +7 -5
  76. data/src/com/zoho/crm/api/currencies/action_response.rb +7 -5
  77. data/src/com/zoho/crm/api/currencies/action_wrapper.rb +48 -46
  78. data/src/com/zoho/crm/api/currencies/api_exception.rb +97 -95
  79. data/src/com/zoho/crm/api/currencies/base_currency_action_handler.rb +7 -5
  80. data/src/com/zoho/crm/api/currencies/base_currency_action_wrapper.rb +48 -46
  81. data/src/com/zoho/crm/api/currencies/base_currency_wrapper.rb +47 -45
  82. data/src/com/zoho/crm/api/currencies/body_wrapper.rb +47 -45
  83. data/src/com/zoho/crm/api/currencies/currencies_operations.rb +136 -134
  84. data/src/com/zoho/crm/api/currencies/currency.rb +215 -213
  85. data/src/com/zoho/crm/api/currencies/format.rb +75 -73
  86. data/src/com/zoho/crm/api/currencies/response_handler.rb +7 -5
  87. data/src/com/zoho/crm/api/currencies/response_wrapper.rb +48 -46
  88. data/src/com/zoho/crm/api/currencies/success_response.rb +91 -89
  89. data/src/com/zoho/crm/api/custom_views/api_exception.rb +91 -89
  90. data/src/com/zoho/crm/api/custom_views/criteria.rb +101 -99
  91. data/src/com/zoho/crm/api/custom_views/custom_view.rb +243 -241
  92. data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +57 -55
  93. data/src/com/zoho/crm/api/custom_views/info.rb +117 -115
  94. data/src/com/zoho/crm/api/custom_views/range.rb +61 -59
  95. data/src/com/zoho/crm/api/custom_views/response_handler.rb +7 -5
  96. data/src/com/zoho/crm/api/custom_views/response_wrapper.rb +63 -61
  97. data/src/com/zoho/crm/api/custom_views/shared_details.rb +89 -87
  98. data/src/com/zoho/crm/api/custom_views/translation.rb +89 -87
  99. data/src/com/zoho/crm/api/dc/au_datacenter.rb +16 -13
  100. data/src/com/zoho/crm/api/dc/cn_datacenter.rb +16 -13
  101. data/src/com/zoho/crm/api/dc/datacenter.rb +18 -16
  102. data/src/com/zoho/crm/api/dc/eu_datacenter.rb +16 -13
  103. data/src/com/zoho/crm/api/dc/in_datacenter.rb +16 -13
  104. data/src/com/zoho/crm/api/dc/us_datacenter.rb +16 -13
  105. data/src/com/zoho/crm/api/exception/sdk_exception.rb +40 -38
  106. data/src/com/zoho/crm/api/fields/api_exception.rb +91 -89
  107. data/src/com/zoho/crm/api/fields/association_details.rb +61 -59
  108. data/src/com/zoho/crm/api/fields/auto_number.rb +75 -73
  109. data/src/com/zoho/crm/api/fields/crypt.rb +117 -115
  110. data/src/com/zoho/crm/api/fields/currency.rb +61 -59
  111. data/src/com/zoho/crm/api/fields/field.rb +712 -710
  112. data/src/com/zoho/crm/api/fields/fields_operations.rb +54 -52
  113. data/src/com/zoho/crm/api/fields/formula.rb +61 -59
  114. data/src/com/zoho/crm/api/fields/lookup_field.rb +61 -59
  115. data/src/com/zoho/crm/api/fields/module.rb +117 -115
  116. data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +117 -115
  117. data/src/com/zoho/crm/api/fields/pick_list_value.rb +131 -129
  118. data/src/com/zoho/crm/api/fields/private.rb +75 -73
  119. data/src/com/zoho/crm/api/fields/related_details.rb +103 -101
  120. data/src/com/zoho/crm/api/fields/response_handler.rb +7 -5
  121. data/src/com/zoho/crm/api/fields/response_wrapper.rb +48 -46
  122. data/src/com/zoho/crm/api/fields/tool_tip.rb +61 -59
  123. data/src/com/zoho/crm/api/fields/unique.rb +47 -45
  124. data/src/com/zoho/crm/api/fields/view_type.rb +89 -87
  125. data/src/com/zoho/crm/api/files/action_handler.rb +7 -5
  126. data/src/com/zoho/crm/api/files/action_response.rb +7 -5
  127. data/src/com/zoho/crm/api/files/action_wrapper.rb +48 -46
  128. data/src/com/zoho/crm/api/files/api_exception.rb +95 -93
  129. data/src/com/zoho/crm/api/files/body_wrapper.rb +46 -44
  130. data/src/com/zoho/crm/api/files/file_body_wrapper.rb +48 -46
  131. data/src/com/zoho/crm/api/files/file_operations.rb +58 -56
  132. data/src/com/zoho/crm/api/files/response_handler.rb +7 -5
  133. data/src/com/zoho/crm/api/files/success_response.rb +91 -89
  134. data/src/com/zoho/crm/api/header.rb +10 -8
  135. data/src/com/zoho/crm/api/header_map.rb +39 -37
  136. data/src/com/zoho/crm/api/initializer.rb +129 -127
  137. data/src/com/zoho/crm/api/layouts/api_exception.rb +91 -89
  138. data/src/com/zoho/crm/api/layouts/layout.rb +201 -199
  139. data/src/com/zoho/crm/api/layouts/layouts_operations.rb +47 -45
  140. data/src/com/zoho/crm/api/layouts/properties.rb +75 -73
  141. data/src/com/zoho/crm/api/layouts/response_handler.rb +7 -5
  142. data/src/com/zoho/crm/api/layouts/response_wrapper.rb +48 -46
  143. data/src/com/zoho/crm/api/layouts/section.rb +173 -171
  144. data/src/com/zoho/crm/api/modules/action_handler.rb +7 -5
  145. data/src/com/zoho/crm/api/modules/action_response.rb +7 -5
  146. data/src/com/zoho/crm/api/modules/action_wrapper.rb +48 -46
  147. data/src/com/zoho/crm/api/modules/api_exception.rb +95 -93
  148. data/src/com/zoho/crm/api/modules/argument.rb +61 -59
  149. data/src/com/zoho/crm/api/modules/body_wrapper.rb +47 -45
  150. data/src/com/zoho/crm/api/modules/module.rb +652 -650
  151. data/src/com/zoho/crm/api/modules/modules_operations.rb +92 -90
  152. data/src/com/zoho/crm/api/modules/related_list_properties.rb +75 -73
  153. data/src/com/zoho/crm/api/modules/response_handler.rb +7 -5
  154. data/src/com/zoho/crm/api/modules/response_wrapper.rb +48 -46
  155. data/src/com/zoho/crm/api/modules/success_response.rb +91 -89
  156. data/src/com/zoho/crm/api/modules/territory.rb +75 -73
  157. data/src/com/zoho/crm/api/notes/action_handler.rb +7 -5
  158. data/src/com/zoho/crm/api/notes/action_response.rb +7 -5
  159. data/src/com/zoho/crm/api/notes/action_wrapper.rb +48 -46
  160. data/src/com/zoho/crm/api/notes/api_exception.rb +95 -93
  161. data/src/com/zoho/crm/api/notes/body_wrapper.rb +47 -45
  162. data/src/com/zoho/crm/api/notes/info.rb +89 -87
  163. data/src/com/zoho/crm/api/notes/note.rb +257 -255
  164. data/src/com/zoho/crm/api/notes/notes_operations.rb +184 -182
  165. data/src/com/zoho/crm/api/notes/response_handler.rb +7 -5
  166. data/src/com/zoho/crm/api/notes/response_wrapper.rb +63 -61
  167. data/src/com/zoho/crm/api/notes/success_response.rb +91 -89
  168. data/src/com/zoho/crm/api/notification/action_handler.rb +7 -5
  169. data/src/com/zoho/crm/api/notification/action_response.rb +7 -5
  170. data/src/com/zoho/crm/api/notification/action_wrapper.rb +48 -46
  171. data/src/com/zoho/crm/api/notification/api_exception.rb +95 -93
  172. data/src/com/zoho/crm/api/notification/body_wrapper.rb +47 -45
  173. data/src/com/zoho/crm/api/notification/info.rb +89 -87
  174. data/src/com/zoho/crm/api/notification/notification.rb +187 -185
  175. data/src/com/zoho/crm/api/notification/notification_operations.rb +139 -137
  176. data/src/com/zoho/crm/api/notification/response_handler.rb +7 -5
  177. data/src/com/zoho/crm/api/notification/response_wrapper.rb +63 -61
  178. data/src/com/zoho/crm/api/notification/success_response.rb +91 -89
  179. data/src/com/zoho/crm/api/org/action_response.rb +7 -5
  180. data/src/com/zoho/crm/api/org/api_exception.rb +93 -91
  181. data/src/com/zoho/crm/api/org/file_body_wrapper.rb +46 -44
  182. data/src/com/zoho/crm/api/org/license_details.rb +117 -115
  183. data/src/com/zoho/crm/api/org/org.rb +467 -465
  184. data/src/com/zoho/crm/api/org/org_operations.rb +39 -37
  185. data/src/com/zoho/crm/api/org/response_handler.rb +7 -5
  186. data/src/com/zoho/crm/api/org/response_wrapper.rb +48 -46
  187. data/src/com/zoho/crm/api/org/success_response.rb +91 -89
  188. data/src/com/zoho/crm/api/param.rb +10 -8
  189. data/src/com/zoho/crm/api/parameter_map.rb +39 -37
  190. data/src/com/zoho/crm/api/profiles/api_exception.rb +91 -89
  191. data/src/com/zoho/crm/api/profiles/category.rb +75 -73
  192. data/src/com/zoho/crm/api/profiles/permission_detail.rb +103 -101
  193. data/src/com/zoho/crm/api/profiles/profile.rb +215 -213
  194. data/src/com/zoho/crm/api/profiles/profiles_operations.rb +47 -45
  195. data/src/com/zoho/crm/api/profiles/response_handler.rb +7 -5
  196. data/src/com/zoho/crm/api/profiles/response_wrapper.rb +48 -46
  197. data/src/com/zoho/crm/api/profiles/section.rb +61 -59
  198. data/src/com/zoho/crm/api/query/api_exception.rb +91 -89
  199. data/src/com/zoho/crm/api/query/body_wrapper.rb +47 -45
  200. data/src/com/zoho/crm/api/query/query_operations.rb +26 -24
  201. data/src/com/zoho/crm/api/query/response_handler.rb +7 -5
  202. data/src/com/zoho/crm/api/query/response_wrapper.rb +63 -61
  203. data/src/com/zoho/crm/api/record/action_handler.rb +7 -5
  204. data/src/com/zoho/crm/api/record/action_response.rb +7 -5
  205. data/src/com/zoho/crm/api/record/action_wrapper.rb +48 -46
  206. data/src/com/zoho/crm/api/record/api_exception.rb +113 -111
  207. data/src/com/zoho/crm/api/record/body_wrapper.rb +117 -115
  208. data/src/com/zoho/crm/api/record/carry_over_tags.rb +75 -73
  209. data/src/com/zoho/crm/api/record/comment.rb +89 -87
  210. data/src/com/zoho/crm/api/record/consent.rb +130 -128
  211. data/src/com/zoho/crm/api/record/convert_action_handler.rb +7 -5
  212. data/src/com/zoho/crm/api/record/convert_action_response.rb +7 -5
  213. data/src/com/zoho/crm/api/record/convert_action_wrapper.rb +48 -46
  214. data/src/com/zoho/crm/api/record/convert_body_wrapper.rb +47 -45
  215. data/src/com/zoho/crm/api/record/criteria.rb +101 -99
  216. data/src/com/zoho/crm/api/record/deleted_record.rb +117 -115
  217. data/src/com/zoho/crm/api/record/deleted_records_handler.rb +7 -5
  218. data/src/com/zoho/crm/api/record/deleted_records_wrapper.rb +63 -61
  219. data/src/com/zoho/crm/api/record/download_handler.rb +7 -5
  220. data/src/com/zoho/crm/api/record/field.rb +2055 -2053
  221. data/src/com/zoho/crm/api/record/file_body_wrapper.rb +50 -48
  222. data/src/com/zoho/crm/api/record/file_details.rb +243 -241
  223. data/src/com/zoho/crm/api/record/file_handler.rb +7 -5
  224. data/src/com/zoho/crm/api/record/info.rb +89 -87
  225. data/src/com/zoho/crm/api/record/inventory_line_items.rb +166 -164
  226. data/src/com/zoho/crm/api/record/lead_converter.rb +145 -143
  227. data/src/com/zoho/crm/api/record/line_item_product.rb +45 -43
  228. data/src/com/zoho/crm/api/record/line_tax.rb +89 -87
  229. data/src/com/zoho/crm/api/record/mass_update.rb +105 -103
  230. data/src/com/zoho/crm/api/record/mass_update_action_handler.rb +7 -5
  231. data/src/com/zoho/crm/api/record/mass_update_action_response.rb +7 -5
  232. data/src/com/zoho/crm/api/record/mass_update_action_wrapper.rb +48 -46
  233. data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +117 -115
  234. data/src/com/zoho/crm/api/record/mass_update_response.rb +7 -5
  235. data/src/com/zoho/crm/api/record/mass_update_response_handler.rb +7 -5
  236. data/src/com/zoho/crm/api/record/mass_update_response_wrapper.rb +48 -46
  237. data/src/com/zoho/crm/api/record/mass_update_success_response.rb +91 -89
  238. data/src/com/zoho/crm/api/record/options.rb +7 -5
  239. data/src/com/zoho/crm/api/record/participants.rb +82 -80
  240. data/src/com/zoho/crm/api/record/pricing_details.rb +45 -43
  241. data/src/com/zoho/crm/api/record/record.rb +139 -137
  242. data/src/com/zoho/crm/api/record/record_operations.rb +947 -939
  243. data/src/com/zoho/crm/api/record/recurring_activity.rb +47 -45
  244. data/src/com/zoho/crm/api/record/remind_at.rb +47 -45
  245. data/src/com/zoho/crm/api/record/reminder.rb +61 -59
  246. data/src/com/zoho/crm/api/record/response_handler.rb +7 -5
  247. data/src/com/zoho/crm/api/record/response_wrapper.rb +63 -61
  248. data/src/com/zoho/crm/api/record/success_response.rb +121 -119
  249. data/src/com/zoho/crm/api/record/successful_convert.rb +77 -75
  250. data/src/com/zoho/crm/api/record/territory.rb +61 -59
  251. data/src/com/zoho/crm/api/related_lists/api_exception.rb +91 -89
  252. data/src/com/zoho/crm/api/related_lists/related_list.rb +187 -185
  253. data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +47 -45
  254. data/src/com/zoho/crm/api/related_lists/response_handler.rb +7 -5
  255. data/src/com/zoho/crm/api/related_lists/response_wrapper.rb +48 -46
  256. data/src/com/zoho/crm/api/related_records/action_handler.rb +7 -5
  257. data/src/com/zoho/crm/api/related_records/action_response.rb +7 -5
  258. data/src/com/zoho/crm/api/related_records/action_wrapper.rb +48 -46
  259. data/src/com/zoho/crm/api/related_records/api_exception.rb +95 -93
  260. data/src/com/zoho/crm/api/related_records/body_wrapper.rb +46 -44
  261. data/src/com/zoho/crm/api/related_records/file_body_wrapper.rb +48 -46
  262. data/src/com/zoho/crm/api/related_records/related_records_operations.rb +460 -458
  263. data/src/com/zoho/crm/api/related_records/response_handler.rb +7 -5
  264. data/src/com/zoho/crm/api/related_records/response_wrapper.rb +63 -61
  265. data/src/com/zoho/crm/api/related_records/success_response.rb +91 -89
  266. data/src/com/zoho/crm/api/request_proxy.rb +12 -10
  267. data/src/com/zoho/crm/api/roles/api_exception.rb +91 -89
  268. data/src/com/zoho/crm/api/roles/response_handler.rb +7 -5
  269. data/src/com/zoho/crm/api/roles/response_wrapper.rb +48 -46
  270. data/src/com/zoho/crm/api/roles/role.rb +145 -143
  271. data/src/com/zoho/crm/api/roles/roles_operations.rb +37 -35
  272. data/src/com/zoho/crm/api/sdk_config.rb +12 -9
  273. data/src/com/zoho/crm/api/share_records/action_handler.rb +7 -5
  274. data/src/com/zoho/crm/api/share_records/action_response.rb +7 -5
  275. data/src/com/zoho/crm/api/share_records/action_wrapper.rb +48 -46
  276. data/src/com/zoho/crm/api/share_records/api_exception.rb +99 -97
  277. data/src/com/zoho/crm/api/share_records/body_wrapper.rb +47 -45
  278. data/src/com/zoho/crm/api/share_records/delete_action_handler.rb +7 -5
  279. data/src/com/zoho/crm/api/share_records/delete_action_response.rb +7 -5
  280. data/src/com/zoho/crm/api/share_records/delete_action_wrapper.rb +48 -46
  281. data/src/com/zoho/crm/api/share_records/response_handler.rb +7 -5
  282. data/src/com/zoho/crm/api/share_records/response_wrapper.rb +63 -61
  283. data/src/com/zoho/crm/api/share_records/share_record.rb +117 -115
  284. data/src/com/zoho/crm/api/share_records/share_records_operations.rb +109 -107
  285. data/src/com/zoho/crm/api/share_records/shared_through.rb +75 -73
  286. data/src/com/zoho/crm/api/share_records/success_response.rb +93 -91
  287. data/src/com/zoho/crm/api/tags/action_handler.rb +7 -5
  288. data/src/com/zoho/crm/api/tags/action_response.rb +7 -5
  289. data/src/com/zoho/crm/api/tags/action_wrapper.rb +48 -46
  290. data/src/com/zoho/crm/api/tags/api_exception.rb +101 -99
  291. data/src/com/zoho/crm/api/tags/body_wrapper.rb +47 -45
  292. data/src/com/zoho/crm/api/tags/conflict_wrapper.rb +47 -45
  293. data/src/com/zoho/crm/api/tags/count_handler.rb +7 -5
  294. data/src/com/zoho/crm/api/tags/count_wrapper.rb +48 -46
  295. data/src/com/zoho/crm/api/tags/info.rb +61 -59
  296. data/src/com/zoho/crm/api/tags/merge_wrapper.rb +47 -45
  297. data/src/com/zoho/crm/api/tags/record_action_handler.rb +7 -5
  298. data/src/com/zoho/crm/api/tags/record_action_response.rb +7 -5
  299. data/src/com/zoho/crm/api/tags/record_action_wrapper.rb +91 -89
  300. data/src/com/zoho/crm/api/tags/response_handler.rb +7 -5
  301. data/src/com/zoho/crm/api/tags/response_wrapper.rb +63 -61
  302. data/src/com/zoho/crm/api/tags/success_response.rb +93 -91
  303. data/src/com/zoho/crm/api/tags/tag.rb +117 -115
  304. data/src/com/zoho/crm/api/tags/tags_operations.rb +338 -336
  305. data/src/com/zoho/crm/api/taxes/action_handler.rb +7 -5
  306. data/src/com/zoho/crm/api/taxes/action_response.rb +7 -5
  307. data/src/com/zoho/crm/api/taxes/action_wrapper.rb +48 -46
  308. data/src/com/zoho/crm/api/taxes/api_exception.rb +95 -93
  309. data/src/com/zoho/crm/api/taxes/body_wrapper.rb +47 -45
  310. data/src/com/zoho/crm/api/taxes/preference.rb +61 -59
  311. data/src/com/zoho/crm/api/taxes/response_handler.rb +7 -5
  312. data/src/com/zoho/crm/api/taxes/response_wrapper.rb +63 -61
  313. data/src/com/zoho/crm/api/taxes/success_response.rb +91 -89
  314. data/src/com/zoho/crm/api/taxes/tax.rb +103 -101
  315. data/src/com/zoho/crm/api/taxes/taxes_operations.rb +114 -112
  316. data/src/com/zoho/crm/api/territories/api_exception.rb +91 -89
  317. data/src/com/zoho/crm/api/territories/response_handler.rb +7 -5
  318. data/src/com/zoho/crm/api/territories/response_wrapper.rb +48 -46
  319. data/src/com/zoho/crm/api/territories/territories_operations.rb +37 -35
  320. data/src/com/zoho/crm/api/territories/territory.rb +173 -171
  321. data/src/com/zoho/crm/api/user_signature.rb +19 -17
  322. data/src/com/zoho/crm/api/users/action_handler.rb +7 -5
  323. data/src/com/zoho/crm/api/users/action_response.rb +7 -5
  324. data/src/com/zoho/crm/api/users/action_wrapper.rb +48 -46
  325. data/src/com/zoho/crm/api/users/api_exception.rb +95 -93
  326. data/src/com/zoho/crm/api/users/body_wrapper.rb +47 -45
  327. data/src/com/zoho/crm/api/users/customize_info.rb +117 -115
  328. data/src/com/zoho/crm/api/users/info.rb +89 -87
  329. data/src/com/zoho/crm/api/users/request_wrapper.rb +47 -45
  330. data/src/com/zoho/crm/api/users/response_handler.rb +7 -5
  331. data/src/com/zoho/crm/api/users/response_wrapper.rb +63 -61
  332. data/src/com/zoho/crm/api/users/shift.rb +61 -59
  333. data/src/com/zoho/crm/api/users/success_response.rb +91 -89
  334. data/src/com/zoho/crm/api/users/tab_theme.rb +61 -59
  335. data/src/com/zoho/crm/api/users/territory.rb +75 -73
  336. data/src/com/zoho/crm/api/users/theme.rb +117 -115
  337. data/src/com/zoho/crm/api/users/user.rb +489 -487
  338. data/src/com/zoho/crm/api/users/users_operations.rb +152 -150
  339. data/src/com/zoho/crm/api/util/api_http_connector.rb +85 -83
  340. data/src/com/zoho/crm/api/util/api_response.rb +16 -14
  341. data/src/com/zoho/crm/api/util/choice.rb +8 -6
  342. data/src/com/zoho/crm/api/util/common_api_handler.rb +162 -157
  343. data/src/com/zoho/crm/api/util/constants.rb +335 -331
  344. data/src/com/zoho/crm/api/util/converter.rb +167 -165
  345. data/src/com/zoho/crm/api/util/data_type_converter.rb +127 -125
  346. data/src/com/zoho/crm/api/util/downloader.rb +60 -57
  347. data/src/com/zoho/crm/api/util/form_data_converter.rb +118 -115
  348. data/src/com/zoho/crm/api/util/header_param_validator.rb +47 -45
  349. data/src/com/zoho/crm/api/util/json_converter.rb +535 -530
  350. data/src/com/zoho/crm/api/util/model.rb +6 -4
  351. data/src/com/zoho/crm/api/util/module_fields_handler.rb +61 -59
  352. data/src/com/zoho/crm/api/util/stream_wrapper.rb +27 -25
  353. data/src/com/zoho/crm/api/util/utility.rb +680 -668
  354. data/src/com/zoho/crm/api/variable_groups/api_exception.rb +91 -89
  355. data/src/com/zoho/crm/api/variable_groups/response_handler.rb +7 -5
  356. data/src/com/zoho/crm/api/variable_groups/response_wrapper.rb +48 -46
  357. data/src/com/zoho/crm/api/variable_groups/variable_group.rb +103 -101
  358. data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +54 -52
  359. data/src/com/zoho/crm/api/variables/action_handler.rb +7 -5
  360. data/src/com/zoho/crm/api/variables/action_response.rb +7 -5
  361. data/src/com/zoho/crm/api/variables/action_wrapper.rb +48 -46
  362. data/src/com/zoho/crm/api/variables/api_exception.rb +95 -93
  363. data/src/com/zoho/crm/api/variables/body_wrapper.rb +47 -45
  364. data/src/com/zoho/crm/api/variables/response_handler.rb +7 -5
  365. data/src/com/zoho/crm/api/variables/response_wrapper.rb +48 -46
  366. data/src/com/zoho/crm/api/variables/success_response.rb +91 -89
  367. data/src/com/zoho/crm/api/variables/variable.rb +129 -127
  368. data/src/com/zoho/crm/api/variables/variables_operations.rb +231 -229
  369. data/src/resources/JSONDetails.json +1 -1
  370. data/src/version.rb +2 -2
  371. metadata +4 -4
@@ -1,5 +1,7 @@
1
- module Util
2
- module Model
3
- def initialize; end
1
+ module ZOHOCRMSDK
2
+ module Util
3
+ module Model
4
+ def initialize; end
5
+ end
4
6
  end
5
- end
7
+ end
@@ -1,78 +1,80 @@
1
1
  require 'json'
2
2
  require 'monitor'
3
3
 
4
- module Util
5
- class ModuleFieldsHandler
6
- @@sync_lock = Monitor.new
4
+ module ZOHOCRMSDK
5
+ module Util
6
+ class ModuleFieldsHandler
7
+ @@sync_lock = Monitor.new
7
8
 
8
- def self.delete_fields_file
9
- @@sync_lock.synchronize do
10
- record_field_details_path = Converter.new(nil).get_record_json_file_path
11
- File.delete(record_field_details_path) if File.exist? record_field_details_path
9
+ def self.delete_fields_file
10
+ @@sync_lock.synchronize do
11
+ record_field_details_path = Converter.new(nil).get_record_json_file_path
12
+ File.delete(record_field_details_path) if File.exist? record_field_details_path
13
+ end
14
+ rescue StandardError => e
15
+ ex = SDKException.new(nil, nil, nil, e)
16
+ SDKLog::SDKLogger.severe(Constants::DELETE_FIELD_FILE_ERROR, ex)
17
+ raise ex
12
18
  end
13
- rescue StandardError => e
14
- ex = SDKException.new(nil, nil, nil, e)
15
- SDKLog::SDKLogger.severe(Constants::DELETE_FIELD_FILE_ERROR, ex)
16
- raise ex
17
- end
18
19
 
19
- def self.delete_all_fields_file
20
- @@sync_lock.synchronize do
21
- initializer = Initializer.get_initializer
22
- resources_path = initializer.resources_path + '/' + Constants::RESOURCES
23
- if Dir.exist? resources_path
24
- Dir.foreach(resources_path) do |f|
25
- File.delete(resources_path + '/' + f) if (f != '.') && (f != '..')
20
+ def self.delete_all_fields_file
21
+ @@sync_lock.synchronize do
22
+ initializer = Initializer.get_initializer
23
+ resources_path = initializer.resources_path + '/' + Constants::RESOURCES
24
+ if Dir.exist? resources_path
25
+ Dir.foreach(resources_path) do |f|
26
+ File.delete(resources_path + '/' + f) if (f != '.') && (f != '..')
27
+ end
26
28
  end
27
29
  end
30
+ rescue StandardError => e
31
+ ex = SDKException.new(nil, nil, nil, e)
32
+ SDKLog::SDKLogger.severe(Constants::DELETE_FIELD_FILES_ERROR, ex)
33
+ raise ex
28
34
  end
29
- rescue StandardError => e
30
- ex = SDKException.new(nil, nil, nil, e)
31
- SDKLog::SDKLogger.severe(Constants::DELETE_FIELD_FILES_ERROR, ex)
32
- raise ex
33
- end
34
35
 
35
- def self.delete_fields(module_api_name)
36
- record_field_details_path = Converter.new(nil).get_record_json_file_path
37
- if File.exist? record_field_details_path
38
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
39
- if record_field_details_json.key? module_api_name.downcase
40
- Utility.delete_fields(record_field_details_json,module_api_name)
41
- File.open(record_field_details_path, 'w') do |f|
42
- f.write(record_field_details_json.to_json)
36
+ def self.delete_fields(module_api_name)
37
+ record_field_details_path = Converter.new(nil).get_record_json_file_path
38
+ if File.exist? record_field_details_path
39
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
40
+ if record_field_details_json.key? module_api_name.downcase
41
+ Utility.delete_fields(record_field_details_json,module_api_name)
42
+ File.open(record_field_details_path, 'w') do |f|
43
+ f.write(record_field_details_json.to_json)
44
+ end
43
45
  end
44
46
  end
47
+ rescue StandardError => e
48
+ ex = SDKException.new(nil, nil, nil, e)
49
+ raise ex
45
50
  end
46
- rescue StandardError => e
47
- ex = SDKException.new(nil, nil, nil, e)
48
- raise ex
49
- end
50
51
 
51
- def self.refresh_fields(module_api_name)
52
- @@sync_lock.synchronize do
53
- delete_fields(module_api_name)
54
- Utility.get_fields_info(module_api_name)
52
+ def self.refresh_fields(module_api_name)
53
+ @@sync_lock.synchronize do
54
+ delete_fields(module_api_name)
55
+ Utility.get_fields_info(module_api_name)
56
+ end
57
+ rescue SDKException => e
58
+ SDKLog::SDKLogger.severe(Constants::REFRESH_SINGLE_MODULE_FIELDS_ERROR + module_api_name, e)
59
+ raise e
60
+ rescue StandardError => e
61
+ ex = SDKException.new(nil, nil, nil, e)
62
+ SDKLog::SDKLogger.severe(Constants::REFRESH_SINGLE_MODULE_FIELDS_ERROR + module_api_name, ex)
63
+ raise ex
55
64
  end
56
- rescue SDKException => e
57
- SDKLog::SDKLogger.severe(Constants::REFRESH_SINGLE_MODULE_FIELDS_ERROR + module_api_name, e)
58
- raise e
59
- rescue StandardError => e
60
- ex = SDKException.new(nil, nil, nil, e)
61
- SDKLog::SDKLogger.severe(Constants::REFRESH_SINGLE_MODULE_FIELDS_ERROR + module_api_name, ex)
62
- raise ex
63
- end
64
65
 
65
- def self.refresh_all_modules
66
- @@sync_lock.synchronize do
67
- Utility.refresh_modules
66
+ def self.refresh_all_modules
67
+ @@sync_lock.synchronize do
68
+ Utility.refresh_modules
69
+ end
70
+ rescue SDKException => e
71
+ SDKLog::SDKLogger.severe(Constants::REFRESH_ALL_MODULE_FIELDS_ERROR, e)
72
+ raise e
73
+ rescue StandardError => e
74
+ ex = SDKException.new(nil, nil, nil, e)
75
+ SDKLog::SDKLogger.severe(Constants::REFRESH_ALL_MODULE_FIELDS_ERROR, ex)
76
+ raise ex
68
77
  end
69
- rescue SDKException => e
70
- SDKLog::SDKLogger.severe(Constants::REFRESH_ALL_MODULE_FIELDS_ERROR, e)
71
- raise e
72
- rescue StandardError => e
73
- ex = SDKException.new(nil, nil, nil, e)
74
- SDKLog::SDKLogger.severe(Constants::REFRESH_ALL_MODULE_FIELDS_ERROR, ex)
75
- raise ex
76
78
  end
77
79
  end
78
- end
80
+ end
@@ -1,37 +1,39 @@
1
1
  require_relative 'model'
2
2
  require_relative 'constants'
3
3
 
4
- module Util
5
- # This class handles the file stream and name.
6
- class StreamWrapper
7
- include Model
4
+ module ZOHOCRMSDK
5
+ module Util
6
+ # This class handles the file stream and name.
7
+ class StreamWrapper
8
+ include Model
8
9
 
9
- # Creates a StreamWrapper class instance with the specified parameters.
10
- # @param name [String] A String containing the file name.
11
- # @param stream An InputStream containing the file stream.
12
- # @param file_path [String] A String containing the absolute file path.
13
- def initialize(name = nil, stream = nil, file_path = nil)
14
- @name = name
10
+ # Creates a StreamWrapper class instance with the specified parameters.
11
+ # @param name [String] A String containing the file name.
12
+ # @param stream An InputStream containing the file stream.
13
+ # @param file_path [String] A String containing the absolute file path.
14
+ def initialize(name = nil, stream = nil, file_path = nil)
15
+ @name = name
15
16
 
16
- @stream = stream
17
- return if file_path.nil?
18
- if File.exist? file_path
19
- file = File.open(file_path)
17
+ @stream = stream
18
+ return if file_path.nil?
19
+ if File.exist? file_path
20
+ file = File.open(file_path)
20
21
 
21
- @name = File.basename(file_path)
22
+ @name = File.basename(file_path)
22
23
 
23
- @stream = file.read
24
- else
25
- raise SDKException.new(Constants::FILE_ERROR,Constants::FILE_DOES_NOT_EXISTS + " " + file_path)
24
+ @stream = file.read
25
+ else
26
+ raise SDKException.new(Constants::FILE_ERROR,Constants::FILE_DOES_NOT_EXISTS + " " + file_path)
27
+ end
26
28
  end
27
- end
28
29
 
29
- def name
30
- @name
31
- end
30
+ def name
31
+ @name
32
+ end
32
33
 
33
- def stream
34
- @stream
34
+ def stream
35
+ @stream
36
+ end
35
37
  end
36
38
  end
37
- end
39
+ end
@@ -13,846 +13,858 @@ require_relative 'constants'
13
13
  require_relative '../exception/sdk_exception'
14
14
  require_relative '../../../api/logger/sdk_logger'
15
15
 
16
- module Util
17
- # This class handles module field details.
18
- class Utility
19
- @@sync_lock = Monitor.new
16
+ module ZOHOCRMSDK
17
+ module Util
18
+ # This class handles module field details.
19
+ class Utility
20
+ @@sync_lock = Monitor.new
20
21
 
21
- @@apitype_vs_datatype = {}
22
+ @@apitype_vs_datatype = {}
22
23
 
23
- @@apitype_vs_structurename = {}
24
+ @@apitype_vs_structurename = {}
24
25
 
25
- @@new_file = false
26
+ @@new_file = false
26
27
 
27
- @@get_modified_modules = false
28
+ @@get_modified_modules = false
28
29
 
29
- @@api_supported_module = {}
30
+ @@api_supported_module = {}
30
31
 
31
- @@module_api_name = nil
32
+ @@module_api_name = nil
32
33
 
33
- @@force_refresh = false
34
- def self.set_handler_api_path(module_api_name, handler_instance)
35
- if handler_instance.nil?
36
- return
37
- end
38
- api_path = handler_instance.api_path
39
- if module_api_name.downcase == api_path.downcase
40
- api_path_split = api_path.split('/')
41
- api_path_split.each do |api_path_split|
42
- split_lower = api_path_split[i].downcase
43
- if split_lower == module_api_name.downcase
44
- api_path_splits[i] = module_api_name
45
- elsif Constants::DEFAULT_MODULENAME_VS_APINAME.key? split_lower && !Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower].nil?
46
- api_path_splits[i] = Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower]
34
+ @@force_refresh = false
35
+
36
+ def self.set_handler_api_path(module_api_name, handler_instance)
37
+ if handler_instance.nil?
38
+ return
39
+ end
40
+ api_path = handler_instance.api_path
41
+ if api_path.downcase.include? module_api_name.downcase
42
+ api_path_splits = api_path.split('/')
43
+ i = 0
44
+ api_path_splits.each do |api_path_split|
45
+ split_lower = api_path_split.downcase
46
+ if split_lower == module_api_name.downcase
47
+ api_path_splits[i] = module_api_name
48
+ elsif (Constants::DEFAULT_MODULENAME_VS_APINAME.key? split_lower) && (!Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower].nil?)
49
+ api_path_splits[i] = Constants::DEFAULT_MODULENAME_VS_APINAME[split_lower]
50
+ end
51
+ api_path = api_path_splits.join("/")
52
+ handler_instance.api_path = api_path
53
+ i += 1
47
54
  end
48
- api_path = api_path_splits.join("/")
49
- handler_instance.api_path = api_path
50
55
  end
51
56
  end
52
- end
53
57
 
54
- def self.file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
55
- @@sync_lock.synchronize do
56
- initializer = Initializer.get_initializer
57
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
58
- last_modified_time_exists = false
59
- if record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) && !record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
60
- if get_current_time_in_millis - record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] > 3_600_000
58
+ def self.file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
59
+ @@sync_lock.synchronize do
60
+ initializer = Initializer.get_initializer
61
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
62
+ last_modified_time_exists = false
63
+ if record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) && !record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
64
+ if get_current_time_in_millis - record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] > 3_600_000
65
+ last_modified_time_exists = true
66
+ end
67
+ end
68
+ if !record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) || @@force_refresh
61
69
  last_modified_time_exists = true
62
70
  end
63
- end
64
- if !record_field_details_json.key?(Constants::FIELDS_LAST_MODIFIED_TIME) || @@force_refresh
65
- last_modified_time_exists = true
66
- end
67
-
68
- if initializer.sdk_config.auto_refresh_fields && !@@new_file && !@@get_modified_modules && last_modified_time_exists
69
- @@get_modified_modules = true
70
- last_modified_time = (record_field_details_json.key? Constants::FIELDS_LAST_MODIFIED_TIME) ? record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] : nil
71
- modify_fields(record_field_details_path, last_modified_time)
72
- @@get_modified_modules = false
73
- elsif !initializer.sdk_config.auto_refresh_fields && @@force_refresh && !@@get_modified_modules
74
- @@get_modified_modules = true
75
- modify_fields(record_field_details_path, last_modified_time)
76
- @@get_modified_modules = false
77
- end
71
+
72
+ if initializer.sdk_config.auto_refresh_fields && !@@new_file && !@@get_modified_modules && last_modified_time_exists
73
+ @@get_modified_modules = true
74
+ last_modified_time = (record_field_details_json.key? Constants::FIELDS_LAST_MODIFIED_TIME) ? record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] : nil
75
+ modify_fields(record_field_details_path, last_modified_time)
76
+ @@get_modified_modules = false
77
+ elsif !initializer.sdk_config.auto_refresh_fields && @@force_refresh && !@@get_modified_modules
78
+ @@get_modified_modules = true
79
+ modify_fields(record_field_details_path, last_modified_time)
80
+ @@get_modified_modules = false
81
+ end
78
82
 
79
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
80
- return if module_api_name.nil? || record_field_details_json.key?(module_api_name.downcase)
83
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
84
+
85
+ return if module_api_name.nil? || (record_field_details_json.key?(module_api_name.downcase) && !record_field_details_json[module_api_name.downcase].nil?)
81
86
 
82
- fill_data_type()
87
+ fill_data_type()
83
88
 
84
- record_field_details_json[module_api_name.downcase] = {}
89
+ record_field_details_json[module_api_name.downcase] = {}
85
90
 
86
- File.open(record_field_details_path, 'w') do |f|
87
- f.write(record_field_details_json.to_json)
88
- end
89
- field_details = get_fields_details(module_api_name)
90
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
91
+ File.open(record_field_details_path, 'w') do |f|
92
+ f.write(record_field_details_json.to_json)
93
+ end
94
+ field_details = get_fields_details(module_api_name)
95
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
91
96
 
92
- record_field_details_json[module_api_name.downcase] = field_details
97
+ record_field_details_json[module_api_name.downcase] = field_details
93
98
 
94
- File.open(record_field_details_path, 'w') do |f|
95
- f.write(record_field_details_json.to_json)
99
+ File.open(record_field_details_path, 'w') do |f|
100
+ f.write(record_field_details_json.to_json)
101
+ end
96
102
  end
97
103
  end
98
- end
99
104
 
100
- def self.get_fields(module_api_name, handler_instance=nil)
101
- @@sync_lock.synchronize do
102
- @@module_api_name = module_api_name
103
- get_fields_info(module_api_name,handler_instance)
105
+ def self.get_fields(module_api_name, handler_instance=nil)
106
+ @@sync_lock.synchronize do
107
+ @@module_api_name = module_api_name
108
+ get_fields_info(module_api_name,handler_instance)
109
+ end
104
110
  end
105
- end
106
-
107
- def self.get_fields_info(module_api_name, handler_instance=nil)
108
- require_relative '../initializer'
109
- initializer = Initializer.get_initializer
110
- record_field_details_path = nil
111
- last_modified_time = nil
112
111
 
113
- @@sync_lock.synchronize do
114
- begin
115
- return if !module_api_name.nil? && !search_json_details(module_api_name).nil?
116
-
117
- resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
118
-
119
- Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
120
- record_field_details_path = get_record_json_file_path()
121
- module_api_name = verify_module_api_name(module_api_name)
122
- set_handler_api_path(module_api_name,handler_instance)
123
-
124
- if File.exist? record_field_details_path
125
- file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
126
- elsif initializer.sdk_config.auto_refresh_fields
127
- @@new_file = true
128
- fill_data_type()
129
- @@api_supported_module = @@api_supported_module.length == 0 ? get_modules(nil) : @@api_supported_module
130
-
131
- record_field_details_json = File.exist? record_field_details_path ? JSON.parse(File.read(record_field_details_path)) : {}
132
-
133
- record_field_details_json = { Constants::FIELDS_LAST_MODIFIED_TIME => get_current_time_in_millis }
134
- @@api_supported_module.each_key do |module_name|
135
- unless record_field_details_json.key? module_name.downcase
136
- record_field_details_json[module_name.downcase] = {}
137
- File.open(record_field_details_path, 'w') do |f|
138
- f.write(record_field_details_json.to_json)
139
- end
140
- field_details = get_fields_details( @@api_supported_module[module_name][Constants::API_NAME])
141
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
142
- record_field_details_json[module_name.downcase] = field_details
143
- File.open(record_field_details_path, 'w') do |f|
144
- f.write(record_field_details_json.to_json)
112
+ def self.get_fields_info(module_api_name, handler_instance=nil)
113
+ require_relative '../initializer'
114
+ initializer = Initializer.get_initializer
115
+ record_field_details_path = nil
116
+ last_modified_time = nil
117
+
118
+ @@sync_lock.synchronize do
119
+ begin
120
+ return if !module_api_name.nil? && !search_json_details(module_api_name).nil?
121
+
122
+ resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
123
+
124
+ Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
125
+ record_field_details_path = get_record_json_file_path()
126
+ module_api_name = verify_module_api_name(module_api_name)
127
+ set_handler_api_path(module_api_name,handler_instance)
128
+
129
+ return if !handler_instance.nil? && handler_instance.module_api_name.nil? && (!Constants::SKIP_MODULES.include? module_api_name.downcase)
130
+
131
+ if File.exist? record_field_details_path
132
+ file_exists_flow(module_api_name,record_field_details_path,last_modified_time)
133
+ elsif initializer.sdk_config.auto_refresh_fields
134
+ @@new_file = true
135
+ fill_data_type()
136
+ @@api_supported_module = @@api_supported_module.length == 0 ? get_modules(nil) : @@api_supported_module
137
+
138
+ record_field_details_json = File.exist? record_field_details_path ? JSON.parse(File.read(record_field_details_path)) : {}
139
+
140
+ record_field_details_json = { Constants::FIELDS_LAST_MODIFIED_TIME => get_current_time_in_millis }
141
+
142
+ if @@api_supported_module.length > 0
143
+ @@api_supported_module.each_key do |module_name|
144
+ unless record_field_details_json.key? module_name.downcase
145
+ record_field_details_json[module_name.downcase] = {}
146
+ File.open(record_field_details_path, 'w') do |f|
147
+ f.write(record_field_details_json.to_json)
148
+ end
149
+ field_details = get_fields_details( @@api_supported_module[module_name][Constants::API_NAME])
150
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
151
+ record_field_details_json[module_name.downcase] = field_details
152
+ File.open(record_field_details_path, 'w') do |f|
153
+ f.write(record_field_details_json.to_json)
154
+ end
155
+ end
145
156
  end
146
157
  end
147
- end
148
- @@new_file = false
149
- elsif @@force_refresh && !@@get_modified_modules
150
- @@get_modified_modules = true
151
- record_field_details_json = {}
152
- File.open(record_field_details_path, 'w') do |f|
153
- f.write(record_field_details_json.to_json)
154
- end
155
- modify_fields(record_field_details_path, last_modified_time)
156
- @@get_modified_modules = false
157
- else
158
- fill_data_type()
159
-
160
- record_field_details_json = { module_api_name.downcase => {} }
158
+ @@new_file = false
159
+ elsif @@force_refresh && !@@get_modified_modules
160
+ @@get_modified_modules = true
161
+ record_field_details_json = {}
162
+ File.open(record_field_details_path, 'w') do |f|
163
+ f.write(record_field_details_json.to_json)
164
+ end
165
+ modify_fields(record_field_details_path, last_modified_time)
166
+ @@get_modified_modules = false
167
+ else
168
+ fill_data_type()
161
169
 
162
- File.open(record_field_details_path, 'w') do |f|
163
- f.write(record_field_details_json.to_json)
164
- end
165
- field_details = get_fields_details(module_api_name)
166
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
167
- record_field_details_json[module_api_name.downcase] = field_details
170
+ record_field_details_json = { module_api_name.downcase => {} }
168
171
 
169
- File.open(record_field_details_path, 'w') do |f|
170
- f.write(record_field_details_json.to_json)
171
- end
172
- end
173
- rescue StandardError => e
174
- if !record_field_details_path.nil? && File.exist?(record_field_details_path)
175
- begin
172
+ File.open(record_field_details_path, 'w') do |f|
173
+ f.write(record_field_details_json.to_json)
174
+ end
175
+ field_details = get_fields_details(module_api_name)
176
176
  record_field_details_json = JSON.parse(File.read(record_field_details_path))
177
- if record_field_details_json.key? module_api_name.downcase
178
- record_field_details_json.delete(module_api_name.downcase)
177
+ record_field_details_json[module_api_name.downcase] = field_details
178
+
179
+ File.open(record_field_details_path, 'w') do |f|
180
+ f.write(record_field_details_json.to_json)
179
181
  end
180
- if @@new_file
181
- unless record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
182
- record_field_details_json.delete(Constants::FIELDS_LAST_MODIFIED_TIME)
182
+ end
183
+ rescue StandardError => e
184
+ if !record_field_details_path.nil? && File.exist?(record_field_details_path)
185
+ begin
186
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
187
+ if record_field_details_json.key? module_api_name.downcase
188
+ record_field_details_json.delete(module_api_name.downcase)
183
189
  end
184
- @@new_file = false
185
- end
186
- if @@get_modified_modules || @@force_refresh
187
- @@get_modified_modules = false
188
- @@force_refresh = false
189
- unless last_modified_time.nil?
190
- record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = last_modified_time
190
+ if @@new_file
191
+ unless record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME].nil?
192
+ record_field_details_json.delete(Constants::FIELDS_LAST_MODIFIED_TIME)
193
+ end
194
+ @@new_file = false
191
195
  end
196
+ if @@get_modified_modules || @@force_refresh
197
+ @@get_modified_modules = false
198
+ @@force_refresh = false
199
+ unless last_modified_time.nil?
200
+ record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = last_modified_time
201
+ end
202
+ end
203
+ File.open(record_field_details_path, 'w') do |f|
204
+ f.write(record_field_details_json.to_json)
205
+ end
206
+ rescue StandardError => e
207
+ exception = SDKException.new(nil, Constants::EXCEPTION, nil, e)
208
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, exception)
209
+ raise exception
192
210
  end
193
- File.open(record_field_details_path, 'w') do |f|
194
- f.write(record_field_details_json.to_json)
195
- end
196
- rescue StandardError => e
197
- exception = SDKException.new(nil, Constants::EXCEPTION, nil, e)
198
- SDKLog::SDKLogger.severe(Constants::EXCEPTION, exception)
199
- raise exception
200
211
  end
212
+ ex = (e.class.to_s == 'SDKException') ? e : SDKException.new(nil, Constants::EXCEPTION, nil, e)
213
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
214
+ raise ex
201
215
  end
202
- ex = (e.class.to_s == 'SDKException') ? e : SDKException.new(nil, Constants::EXCEPTION, nil, e)
203
- SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
204
- raise ex
205
216
  end
206
217
  end
207
- end
208
218
 
209
- def self.modify_fields(record_field_details_path, modified_time)
210
- modified_modules = get_modules(modified_time)
211
- record_field_details_json = JSON.parse(File.open(record_field_details_path).read)
212
- record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = get_current_time_in_millis()
213
- File.open(record_field_details_path, 'w') do |f|
214
- f.write(record_field_details_json.to_json)
215
- end
216
- return unless modified_modules.any?
219
+ def self.modify_fields(record_field_details_path, modified_time)
220
+ modified_modules = get_modules(modified_time)
221
+ record_field_details_json = JSON.parse(File.open(record_field_details_path).read)
222
+ record_field_details_json[Constants::FIELDS_LAST_MODIFIED_TIME] = get_current_time_in_millis()
223
+ File.open(record_field_details_path, 'w') do |f|
224
+ f.write(record_field_details_json.to_json)
225
+ end
226
+ return unless modified_modules.any?
217
227
 
218
- modified_modules.each_key do |module_api_name|
219
- if record_field_details_json.key? module_api_name.downcase
220
- delete_fields(record_field_details_json, module_api_name)
228
+ modified_modules.each_key do |module_api_name|
229
+ if record_field_details_json.key? module_api_name.downcase
230
+ delete_fields(record_field_details_json, module_api_name)
231
+ end
221
232
  end
222
- end
223
233
 
224
- File.open(record_field_details_path, 'w') do |f|
225
- f.write(record_field_details_json.to_json)
226
- end
227
- modified_modules.each_key do |module_api_name|
228
- module_data = modified_modules[module_api_name]
229
- get_fields_info(module_data[Constants::API_NAME])
234
+ File.open(record_field_details_path, 'w') do |f|
235
+ f.write(record_field_details_json.to_json)
236
+ end
237
+ modified_modules.each_key do |module_api_name|
238
+ module_data = modified_modules[module_api_name]
239
+ get_fields_info(module_data[Constants::API_NAME])
240
+ end
230
241
  end
231
- end
232
242
 
233
- def self.verify_module_api_name(module_api_name)
234
-
235
- if !module_api_name.nil?
236
- if Constants::DEFAULT_MODULENAME_VS_APINAME.key? (module_api_name.downcase) && !Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase].nil?
237
- return Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase]
243
+ def self.verify_module_api_name(module_api_name)
244
+ if !module_api_name.nil?
245
+ if (Constants::DEFAULT_MODULENAME_VS_APINAME.key? module_api_name.downcase) && (!Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase].nil?)
246
+ return Constants::DEFAULT_MODULENAME_VS_APINAME[module_api_name.downcase]
247
+ end
238
248
  end
239
- end
240
249
 
241
- record_field_details_path = get_record_json_file_path()
250
+ record_field_details_path = get_record_json_file_path()
242
251
 
243
- if File.exist? record_field_details_path
244
- fields_json = JSON.parse(File.open(record_field_details_path).read)
245
- if fields_json.key? Constants::SDK_MODULE_METADATA and fields_json[Constants::SDK_MODULE_METADATA].key? module_api_name.downcase
246
- return fields_json[Constants::SDK_MODULE_METADATA][module_api_name.downcase][Constants::API_NAME]
252
+ if File.exist? record_field_details_path
253
+ fields_json = JSON.parse(File.open(record_field_details_path).read)
254
+ if !fields_json.empty? && (fields_json.key? Constants::SDK_MODULE_METADATA) && (!module_api_name.nil? && (fields_json[Constants::SDK_MODULE_METADATA].key? module_api_name.downcase))
255
+ return fields_json[Constants::SDK_MODULE_METADATA][module_api_name.downcase][Constants::API_NAME]
256
+ end
247
257
  end
258
+ return module_api_name
248
259
  end
249
- return module_api_name
250
- end
251
260
 
252
- def self.delete_fields(record_field_details_json, module_api_name)
253
- subform_modules = []
261
+ def self.delete_fields(record_field_details_json, module_api_name)
262
+ subform_modules = []
254
263
 
255
- field_json = record_field_details_json[module_api_name.downcase]
256
- field_json.each_key do |key|
257
- if field_json[key].key?(Constants::SUBFORM) && field_json[key][Constants::SUBFORM]
258
- if record_field_details_json.key? field_json[key][Constants::MODULE]
259
- subform_modules.push(field_json[key][Constants::MODULE])
264
+ field_json = record_field_details_json[module_api_name.downcase]
265
+ field_json.each_key do |key|
266
+ if field_json[key].key?(Constants::SUBFORM) && field_json[key][Constants::SUBFORM]
267
+ if record_field_details_json.key? field_json[key][Constants::MODULE]
268
+ subform_modules.push(field_json[key][Constants::MODULE])
269
+ end
260
270
  end
261
271
  end
262
- end
263
- record_field_details_json.delete(module_api_name.downcase)
264
- return unless subform_modules.any?
272
+ record_field_details_json.delete(module_api_name.downcase)
273
+ return unless subform_modules.any?
265
274
 
266
- subform_modules.each do |subform_module|
267
- delete_fields(record_field_details_json, subform_module)
275
+ subform_modules.each do |subform_module|
276
+ delete_fields(record_field_details_json, subform_module)
277
+ end
268
278
  end
269
- end
270
-
271
- def self.get_record_json_file_path()
272
- Converter.new(nil).get_record_json_file_path()
273
- end
274
279
 
275
- def self.get_related_lists(related_module_name, module_api_name, common_api_handler)
276
- require_relative '../initializer'
280
+ def self.get_record_json_file_path()
281
+ Converter.new(nil).get_record_json_file_path()
282
+ end
277
283
 
278
- initializer = Initializer.get_initializer
284
+ def self.get_related_lists(related_module_name, module_api_name, common_api_handler)
285
+ require_relative '../initializer'
279
286
 
280
- @@sync_lock.synchronize do
281
- begin
282
- is_new_data = false
283
- key = module_api_name + Constants::UNDERSCORE + Constants::RELATED_LISTS
284
- key = key.downcase
285
- resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
286
- Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
287
+ initializer = Initializer.get_initializer
287
288
 
288
- record_field_details_path = get_record_json_file_path()
289
- if !File.exist?(record_field_details_path) || (File.exist?(record_field_details_path) && !(JSON.parse(File.read(record_field_details_path)).key? key))
290
- is_new_data = true
291
- related_list_values = get_related_list_details(module_api_name)
292
- if File.exist? (record_field_details_path)
293
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
294
- else
295
- record_field_details_json = {}
296
- end
297
- record_field_details_json[key] = related_list_values
298
- File.open(record_field_details_path, 'w') do |f|
299
- f.write(record_field_details_json.to_json)
289
+ @@sync_lock.synchronize do
290
+ begin
291
+ is_new_data = false
292
+ key = module_api_name + Constants::UNDERSCORE + Constants::RELATED_LISTS
293
+ key = key.downcase
294
+ resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
295
+ Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
296
+
297
+ record_field_details_path = get_record_json_file_path()
298
+ if !File.exist?(record_field_details_path) || (File.exist?(record_field_details_path) && !(JSON.parse(File.read(record_field_details_path)).key? key))
299
+ is_new_data = true
300
+ module_api_name = verify_module_api_name(module_api_name)
301
+ related_list_values = get_related_list_details(module_api_name)
302
+ if File.exist? (record_field_details_path)
303
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
304
+ else
305
+ record_field_details_json = {}
306
+ end
307
+ record_field_details_json[key] = related_list_values
308
+ File.open(record_field_details_path, 'w') do |f|
309
+ f.write(record_field_details_json.to_json)
310
+ end
300
311
  end
301
- end
302
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
303
- module_related_list = record_field_details_json[key]
304
- if !check_related_list_exists(related_module_name, module_related_list, common_api_handler) && !is_new_data
305
- record_field_details_json.delete(key)
306
- File.open(record_field_details_path, 'w') do |f|
307
- f.write(record_field_details_json.to_json)
312
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
313
+ module_related_list = record_field_details_json[key]
314
+ if !check_related_list_exists(related_module_name, module_related_list, common_api_handler) && !is_new_data
315
+ record_field_details_json.delete(key)
316
+ File.open(record_field_details_path, 'w') do |f|
317
+ f.write(record_field_details_json.to_json)
318
+ end
319
+ get_related_lists(related_module_name, module_api_name, common_api_handler)
308
320
  end
309
- get_related_lists(related_module_name, module_api_name, common_api_handler)
321
+ rescue SDKException => e
322
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, e)
323
+ raise e
324
+ rescue StandardError => e
325
+ ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
326
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
327
+ raise ex
310
328
  end
311
- rescue SDKException => e
312
- SDKLog::SDKLogger.severe(Constants::EXCEPTION, e)
313
- raise e
314
- rescue StandardError => e
315
- ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
316
- SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
317
- raise ex
318
329
  end
319
330
  end
320
- end
321
331
 
322
- def self.get_fields_details(module_api_name)
323
- response = Fields::FieldsOperations.new(module_api_name).get_fields(nil)
324
- fields_details = {}
332
+ def self.get_fields_details(module_api_name)
333
+ response = Fields::FieldsOperations.new(module_api_name).get_fields(nil)
334
+ fields_details = {}
325
335
 
326
- unless response.nil?
336
+ unless response.nil?
327
337
 
328
- return fields_details if response.status_code == Constants::RESPONSECODE_NO_CONTENT
338
+ return fields_details if response.status_code == Constants::RESPONSECODE_NO_CONTENT
329
339
 
330
- if response.is_expected
331
- data_object = response.data_object
340
+ if response.is_expected
341
+ data_object = response.data_object
332
342
 
333
- if data_object.is_a? Fields::ResponseWrapper
334
- fields = data_object.fields
343
+ if data_object.is_a? Fields::ResponseWrapper
344
+ fields = data_object.fields
335
345
 
336
- fields.each do |field|
337
- key_name = field.api_name
338
- next if Constants::KEYS_TO_SKIP.include? key_name
346
+ fields.each do |field|
347
+ key_name = field.api_name
348
+ next if Constants::KEYS_TO_SKIP.include? key_name
339
349
 
340
- field_detail = {}
341
- set_data_type(field_detail, field, module_api_name)
342
- fields_details[key_name] = field_detail
343
- end
344
- if Constants::INVENTORY_MODULES.include? module_api_name.downcase
345
- field_detail = {}
346
- field_detail[Constants::NAME] = Constants::LINE_TAX
347
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
348
- field_detail[Constants::STRUCTURE_NAME] = Constants::LINE_TAX_NAMESPACE
349
- field_detail[Constants::LOOKUP] = true
350
- fields_details[Constants::LINE_TAX] = field_detail
351
- end
350
+ field_detail = {}
351
+ set_data_type(field_detail, field, module_api_name)
352
+ fields_details[key_name] = field_detail
353
+ end
354
+ if Constants::INVENTORY_MODULES.include? module_api_name.downcase
355
+ field_detail = {}
356
+ field_detail[Constants::NAME] = Constants::LINE_TAX
357
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
358
+ field_detail[Constants::STRUCTURE_NAME] = Constants::LINE_TAX_NAMESPACE
359
+ fields_details[Constants::LINE_TAX] = field_detail
360
+ end
352
361
 
353
- if module_api_name.downcase == Constants::NOTES.downcase
354
- field_detail = {}
355
- field_detail[Constants::NAME] = Constants::ATTACHMENTS
356
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
357
- field_detail[Constants::STRUCTURE_NAME] = Constants::ATTACHMENTS_NAMESPACE
358
- fields_details[Constants::ATTACHMENTS] = field_detail
359
- end
362
+ if module_api_name.downcase == Constants::NOTES.downcase
363
+ field_detail = {}
364
+ field_detail[Constants::NAME] = Constants::ATTACHMENTS
365
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
366
+ field_detail[Constants::STRUCTURE_NAME] = Constants::ATTACHMENTS_NAMESPACE
367
+ fields_details[Constants::ATTACHMENTS] = field_detail
368
+ end
360
369
 
361
- elsif data_object.is_a? Fields::APIException
370
+ elsif data_object.is_a? Fields::APIException
371
+ error_response = {}
372
+ error_response[Constants::CODE] = data_object.code.value
373
+ error_response[Constants::STATUS] = data_object.status.value
374
+ error_response[Constants::MESSAGE] = data_object.message.value
375
+ error_response[Constants::DETAILS] = data_object.details
376
+ exception = SDKException.new(Constants::API_EXCEPTION, nil, error_response)
377
+ if @@module_api_name == module_api_name.downcase
378
+ raise exception
379
+ end
380
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, exception)
381
+ end
382
+ else
362
383
  error_response = {}
363
- error_response[Constants::CODE] = data_object.code.value
364
- error_response[Constants::STATUS] = data_object.status.value
365
- error_response[Constants::MESSAGE] = data_object.message.value
366
- error_response[Constants::DETAILS] = data_object.details
384
+ error_response[Constants::CODE] = response.status_code
367
385
  raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
368
386
  end
369
- else
370
- error_response = {}
371
- error_response[Constants::CODE] = response.status_code
372
- raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
373
387
  end
388
+ fields_details
374
389
  end
375
- fields_details
376
- end
377
390
 
378
- def self.search_json_details(key)
379
- require_relative '../initializer'
391
+ def self.search_json_details(key)
392
+ require_relative '../initializer'
380
393
 
381
- package_name = Constants::PACKAGE_PREFIX + 'record.' + key
394
+ package_name = Constants::PACKAGE_PREFIX + 'record.' + key
382
395
 
383
- Initializer.json_details.each_key do |class_key|
384
- if class_key.downcase == package_name.downcase
385
- return_json = {
386
- Constants::MODULEPACKAGENAME => class_key,
387
- Constants::MODULEDETAILS => Initializer.json_details[class_key]
388
- }
396
+ Initializer.json_details.each_key do |class_key|
397
+ if class_key.downcase == package_name.downcase
398
+ return_json = {
399
+ Constants::MODULEPACKAGENAME => class_key,
400
+ Constants::MODULEDETAILS => Initializer.json_details[class_key]
401
+ }
389
402
 
390
- return return_json
403
+ return return_json
404
+ end
391
405
  end
406
+ nil
392
407
  end
393
408
 
394
- nil
395
- end
396
-
397
- def self.get_json_object(json, key)
398
- json.each_key do |key_in_json|
399
- return json[key_in_json] if key_in_json == key
400
- end
401
-
402
- nil
403
- end
404
-
405
- def self.fill_data_type
406
- return unless @@apitype_vs_datatype.empty?
407
-
408
- field_api_names_string = %w[autonumber textarea text website email phone mediumtext multiselectlookup profileimage]
409
- field_api_names_integer = %w[integer]
410
- field_api_names_boolean = %w[boolean]
411
- field_api_names_long = %w[bigint long]
412
- field_api_names_double = %w[double percent lookup currency]
413
- field_api_names_file = %w[imageupload]
414
- field_api_names_field_file = %w[fileupload]
415
- field_api_names_datetime = %w[datetime event_reminder]
416
- field_api_names_date = %w[date]
417
- field_api_names_lookup = %w[lookup]
418
- field_api_names_picklist = %w[picklist]
419
- field_api_names_multiselect_picklist = %w[multiselectpicklist]
420
- field_api_names_subform = %w[subform]
421
- field_api_names_owner_lookup = %w[ownerlookup userlookup]
422
- field_api_names_multiuser_lookup = %w[multiuserlookup]
423
- field_api_names_multimodule_lookup = %w[multimodulelookup]
424
- field_api_names_task_remind_at = %w[ALARM]
425
- field_api_names_recurring_activity = %w[RRULE]
426
- field_api_names_reminder = %w[multireminder]
427
- field_api_names_consent_look_up = %w[consent_lookup]
428
-
429
- field_api_names_string.each do |field_api_name|
430
- @@apitype_vs_datatype[field_api_name] = Constants::STRING
431
- end
409
+ def self.get_json_object(json, key)
410
+ json.each_key do |key_in_json|
411
+ return json[key_in_json] if key_in_json == key
412
+ end
413
+ nil
414
+ end
415
+
416
+ def self.fill_data_type
417
+ return unless @@apitype_vs_datatype.empty?
418
+
419
+ field_api_names_string = %w[autonumber textarea text website email phone mediumtext multiselectlookup profileimage]
420
+ field_api_names_integer = %w[integer]
421
+ field_api_names_boolean = %w[boolean]
422
+ field_api_names_long = %w[bigint long]
423
+ field_api_names_double = %w[double percent lookup currency]
424
+ field_api_names_file = %w[imageupload]
425
+ field_api_names_field_file = %w[fileupload]
426
+ field_api_names_datetime = %w[datetime event_reminder]
427
+ field_api_names_date = %w[date]
428
+ field_api_names_lookup = %w[lookup]
429
+ field_api_names_picklist = %w[picklist]
430
+ field_api_names_multiselect_picklist = %w[multiselectpicklist]
431
+ field_api_names_subform = %w[subform]
432
+ field_api_names_owner_lookup = %w[ownerlookup userlookup]
433
+ field_api_names_multiuser_lookup = %w[multiuserlookup]
434
+ field_api_names_multimodule_lookup = %w[multimodulelookup]
435
+ field_api_names_task_remind_at = %w[ALARM]
436
+ field_api_names_recurring_activity = %w[RRULE]
437
+ field_api_names_reminder = %w[multireminder]
438
+ field_api_names_consent_look_up = %w[consent_lookup]
439
+
440
+ field_api_names_string.each do |field_api_name|
441
+ @@apitype_vs_datatype[field_api_name] = Constants::STRING
442
+ end
432
443
 
433
- field_api_names_integer.each do |field_api_name|
434
- @@apitype_vs_datatype[field_api_name] = Constants::INTEGER
435
- end
444
+ field_api_names_integer.each do |field_api_name|
445
+ @@apitype_vs_datatype[field_api_name] = Constants::INTEGER
446
+ end
436
447
 
437
- field_api_names_boolean.each do |field_api_name|
438
- @@apitype_vs_datatype[field_api_name] = Constants::BOOLEAN
439
- end
448
+ field_api_names_boolean.each do |field_api_name|
449
+ @@apitype_vs_datatype[field_api_name] = Constants::BOOLEAN
450
+ end
440
451
 
441
- field_api_names_double.each do |field_api_name|
442
- @@apitype_vs_datatype[field_api_name] = Constants::DOUBLE
443
- end
452
+ field_api_names_double.each do |field_api_name|
453
+ @@apitype_vs_datatype[field_api_name] = Constants::DOUBLE
454
+ end
444
455
 
445
- field_api_names_long.each do |field_api_name|
446
- @@apitype_vs_datatype[field_api_name] = Constants::LONG
447
- end
456
+ field_api_names_long.each do |field_api_name|
457
+ @@apitype_vs_datatype[field_api_name] = Constants::LONG
458
+ end
448
459
 
449
- field_api_names_file.each do |field_api_name|
450
- @@apitype_vs_datatype[field_api_name] = Constants::FILE_NAMESPACE
451
- end
460
+ field_api_names_file.each do |field_api_name|
461
+ @@apitype_vs_datatype[field_api_name] = Constants::FILE_NAMESPACE
462
+ end
452
463
 
453
- field_api_names_field_file.each do |field_api_name|
454
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
455
- @@apitype_vs_structurename[field_api_name] = Constants::FIELD_FILE_NAMESPACE
456
- end
464
+ field_api_names_field_file.each do |field_api_name|
465
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
466
+ @@apitype_vs_structurename[field_api_name] = Constants::FIELD_FILE_NAMESPACE
467
+ end
457
468
 
458
- field_api_names_task_remind_at.each do |field_api_name|
459
- @@apitype_vs_datatype[field_api_name] = Constants::REMINDAT_NAMESPACE
460
- @@apitype_vs_structurename[field_api_name] = Constants::REMINDAT_NAMESPACE
461
- end
469
+ field_api_names_task_remind_at.each do |field_api_name|
470
+ @@apitype_vs_datatype[field_api_name] = Constants::REMINDAT_NAMESPACE
471
+ @@apitype_vs_structurename[field_api_name] = Constants::REMINDAT_NAMESPACE
472
+ end
462
473
 
463
- field_api_names_recurring_activity.each do |field_api_name|
464
- @@apitype_vs_datatype[field_api_name] = Constants::RECURRING_ACTIVITY_NAMESPACE
465
- @@apitype_vs_structurename[field_api_name] = Constants::RECURRING_ACTIVITY_NAMESPACE
466
- end
474
+ field_api_names_recurring_activity.each do |field_api_name|
475
+ @@apitype_vs_datatype[field_api_name] = Constants::RECURRING_ACTIVITY_NAMESPACE
476
+ @@apitype_vs_structurename[field_api_name] = Constants::RECURRING_ACTIVITY_NAMESPACE
477
+ end
467
478
 
468
- field_api_names_reminder.each do |field_api_name|
469
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
470
- @@apitype_vs_structurename[field_api_name] = Constants::REMINDER_NAMESPACE
471
- end
479
+ field_api_names_reminder.each do |field_api_name|
480
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
481
+ @@apitype_vs_structurename[field_api_name] = Constants::REMINDER_NAMESPACE
482
+ end
472
483
 
473
- field_api_names_datetime.each do |field_api_name|
474
- @@apitype_vs_datatype[field_api_name] = Constants::DATETIME_NAMESPACE
475
- end
484
+ field_api_names_datetime.each do |field_api_name|
485
+ @@apitype_vs_datatype[field_api_name] = Constants::DATETIME_NAMESPACE
486
+ end
476
487
 
477
- field_api_names_date.each do |field_api_name|
478
- @@apitype_vs_datatype[field_api_name] = Constants::DATE_NAMESPACE
479
- end
488
+ field_api_names_date.each do |field_api_name|
489
+ @@apitype_vs_datatype[field_api_name] = Constants::DATE_NAMESPACE
490
+ end
480
491
 
481
- field_api_names_lookup.each do |field_api_name|
482
- @@apitype_vs_datatype[field_api_name] = Constants::RECORD_NAMESPACE
492
+ field_api_names_lookup.each do |field_api_name|
493
+ @@apitype_vs_datatype[field_api_name] = Constants::RECORD_NAMESPACE
483
494
 
484
- @@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
485
- end
495
+ @@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
496
+ end
486
497
 
487
- field_api_names_owner_lookup.each do |field_api_name|
488
- @@apitype_vs_datatype[field_api_name] = Constants::USER_NAMESPACE
498
+ field_api_names_owner_lookup.each do |field_api_name|
499
+ @@apitype_vs_datatype[field_api_name] = Constants::USER_NAMESPACE
489
500
 
490
- @@apitype_vs_structurename[field_api_name] = Constants::USER_NAMESPACE
491
- end
501
+ @@apitype_vs_structurename[field_api_name] = Constants::USER_NAMESPACE
502
+ end
492
503
 
493
- field_api_names_multiuser_lookup.each do |field_api_name|
494
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
504
+ field_api_names_multiuser_lookup.each do |field_api_name|
505
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
495
506
 
496
- @@apitype_vs_structurename[field_api_name] = Constants::USER_NAMESPACE
497
- end
507
+ @@apitype_vs_structurename[field_api_name] = Constants::USER_NAMESPACE
508
+ end
498
509
 
499
- field_api_names_multimodule_lookup.each do |field_api_name|
500
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
510
+ field_api_names_multimodule_lookup.each do |field_api_name|
511
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
501
512
 
502
- @@apitype_vs_structurename[field_api_name] = Constants::MODULE_NAMESPACE
503
- end
513
+ @@apitype_vs_structurename[field_api_name] = Constants::MODULE_NAMESPACE
514
+ end
504
515
 
505
- field_api_names_picklist.each do |field_api_name|
506
- @@apitype_vs_datatype[field_api_name] = Constants::CHOICE_NAMESPACE
507
- end
516
+ field_api_names_picklist.each do |field_api_name|
517
+ @@apitype_vs_datatype[field_api_name] = Constants::CHOICE_NAMESPACE
518
+ end
508
519
 
509
- field_api_names_multiselect_picklist.each do |field_api_name|
510
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
520
+ field_api_names_multiselect_picklist.each do |field_api_name|
521
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
511
522
 
512
- @@apitype_vs_structurename[field_api_name] = Constants::CHOICE_NAMESPACE
513
- end
523
+ @@apitype_vs_structurename[field_api_name] = Constants::CHOICE_NAMESPACE
524
+ end
514
525
 
515
- field_api_names_subform.each do |field_api_name|
516
- @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
526
+ field_api_names_subform.each do |field_api_name|
527
+ @@apitype_vs_datatype[field_api_name] = Constants::LIST_NAMESPACE
517
528
 
518
- @@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
519
- end
529
+ @@apitype_vs_structurename[field_api_name] = Constants::RECORD_NAMESPACE
530
+ end
520
531
 
521
- field_api_names_consent_look_up.each do |field_api_name|
522
- @@apitype_vs_datatype[field_api_name] = Constants::CONSENT_NAMESPACE
532
+ field_api_names_consent_look_up.each do |field_api_name|
533
+ @@apitype_vs_datatype[field_api_name] = Constants::CONSENT_NAMESPACE
523
534
 
524
- @@apitype_vs_structurename[field_api_name] = Constants::CONSENT_NAMESPACE
535
+ @@apitype_vs_structurename[field_api_name] = Constants::CONSENT_NAMESPACE
536
+ end
525
537
  end
526
- end
527
538
 
528
- def self.set_data_type(field_detail, field_instance, module_api_name)
529
- data_type = field_instance.data_type
539
+ def self.set_data_type(field_detail, field_instance, module_api_name)
540
+ data_type = field_instance.data_type
530
541
 
531
- key_name = field_instance.api_name
542
+ key_name = field_instance.api_name
532
543
 
533
- module_name = ''
544
+ module_name = ''
534
545
 
535
- module_api_name = module_api_name.downcase
536
- if !field_instance.system_mandatory.nil? && field_instance.system_mandatory && !((module_api_name == Constants::CALLS.downcase) && (key_name.downcase == Constants::CALL_DURATION.downcase))
537
- field_detail[Constants::REQUIRED] = true
538
- end
539
- if Constants::INVENTORY_MODULES.include?(module_api_name) && (key_name.downcase == Constants::PRODUCT_DETAILS.downcase)
540
- field_detail[Constants::NAME] = key_name
541
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
542
- field_detail[Constants::STRUCTURE_NAME] = Constants::INVENTORY_LINE_ITEMS
543
- field_detail[Constants::SKIP_MANDATORY] = true
544
- return
545
- elsif (key_name.downcase == Constants::PRICING_DETAILS.downcase) && (module_api_name == Constants::PRICE_BOOKS.downcase)
546
- field_detail[Constants::NAME] = key_name
547
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
548
- field_detail[Constants::STRUCTURE_NAME] = Constants::PRICINGDETAILS
549
- field_detail[Constants::SKIP_MANDATORY] = true
550
- return
551
- elsif (key_name.downcase == Constants::PARTICIPANT_API_NAME.downcase) && ((module_api_name == Constants::EVENTS.downcase) || (module_api_name == Constants::ACTIVITIES.downcase))
552
- field_detail[Constants::NAME] = key_name
553
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
554
- field_detail[Constants::STRUCTURE_NAME] = Constants::PARTICIPANTS
555
- field_detail[Constants::SKIP_MANDATORY] = true
556
- return
557
- elsif (key_name.downcase == Constants::COMMENTS.downcase) && ((module_api_name == Constants::SOLUTIONS.downcase) || (module_api_name == Constants::CASES.downcase))
558
- field_detail[Constants::NAME] = key_name
559
- field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
560
- field_detail[Constants::STRUCTURE_NAME] = Constants::COMMENTS_NAMESPACE
561
- field_detail[Constants::LOOKUP] = true
562
- return
563
- elsif key_name.downcase == Constants::LAYOUT.downcase
564
- field_detail[Constants::NAME] = key_name
565
- field_detail[Constants::TYPE] = Constants::LAYOUT_NAMESPACE
566
- field_detail[Constants::LOOKUP] = true
567
- field_detail[Constants::STRUCTURE_NAME] = Constants::LAYOUT_NAMESPACE
568
- return
569
- elsif @@apitype_vs_datatype.include? data_type
570
- field_detail[Constants::TYPE] = @@apitype_vs_datatype[data_type]
571
- elsif data_type.downcase == Constants::FORMULA.downcase
572
- unless field_instance.formula.nil?
573
- return_type = field_instance.formula.return_type
574
- unless @@apitype_vs_datatype[return_type].nil?
575
- field_detail[Constants::TYPE] = @@apitype_vs_datatype[return_type]
546
+ module_api_name = module_api_name.downcase
547
+ if !field_instance.system_mandatory.nil? && field_instance.system_mandatory && !((module_api_name == Constants::CALLS.downcase) && (key_name.downcase == Constants::CALL_DURATION.downcase))
548
+ field_detail[Constants::REQUIRED] = true
549
+ end
550
+ if Constants::INVENTORY_MODULES.include?(module_api_name) && (key_name.downcase == Constants::PRODUCT_DETAILS.downcase)
551
+ field_detail[Constants::NAME] = key_name
552
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
553
+ field_detail[Constants::STRUCTURE_NAME] = Constants::INVENTORY_LINE_ITEMS
554
+ field_detail[Constants::SKIP_MANDATORY] = true
555
+ return
556
+ elsif (key_name.downcase == Constants::PRICING_DETAILS.downcase) && (module_api_name == Constants::PRICE_BOOKS.downcase)
557
+ field_detail[Constants::NAME] = key_name
558
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
559
+ field_detail[Constants::STRUCTURE_NAME] = Constants::PRICINGDETAILS
560
+ field_detail[Constants::SKIP_MANDATORY] = true
561
+ return
562
+ elsif (key_name.downcase == Constants::PARTICIPANT_API_NAME.downcase) && ((module_api_name == Constants::EVENTS.downcase) || (module_api_name == Constants::ACTIVITIES.downcase))
563
+ field_detail[Constants::NAME] = key_name
564
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
565
+ field_detail[Constants::STRUCTURE_NAME] = Constants::PARTICIPANTS
566
+ field_detail[Constants::SKIP_MANDATORY] = true
567
+ return
568
+ elsif (key_name.downcase == Constants::COMMENTS.downcase) && ((module_api_name == Constants::SOLUTIONS.downcase) || (module_api_name == Constants::CASES.downcase))
569
+ field_detail[Constants::NAME] = key_name
570
+ field_detail[Constants::TYPE] = Constants::LIST_NAMESPACE
571
+ field_detail[Constants::STRUCTURE_NAME] = Constants::COMMENTS_NAMESPACE
572
+ field_detail[Constants::LOOKUP] = true
573
+ return
574
+ elsif key_name.downcase == Constants::LAYOUT.downcase
575
+ field_detail[Constants::NAME] = key_name
576
+ field_detail[Constants::TYPE] = Constants::LAYOUT_NAMESPACE
577
+ field_detail[Constants::LOOKUP] = true
578
+ field_detail[Constants::STRUCTURE_NAME] = Constants::LAYOUT_NAMESPACE
579
+ return
580
+ elsif @@apitype_vs_datatype.include? data_type
581
+ field_detail[Constants::TYPE] = @@apitype_vs_datatype[data_type]
582
+ elsif data_type.downcase == Constants::FORMULA.downcase
583
+ unless field_instance.formula.nil?
584
+ return_type = field_instance.formula.return_type
585
+ unless @@apitype_vs_datatype[return_type].nil?
586
+ field_detail[Constants::TYPE] = @@apitype_vs_datatype[return_type]
587
+ end
588
+ field_detail[Constants::READ_ONLY] = true
576
589
  end
577
- field_detail[Constants::READ_ONLY] = true
590
+ else
591
+ return
578
592
  end
579
- else
580
- return
581
- end
582
- field_detail[Constants::LOOKUP] = true if data_type.downcase.include? Constants::LOOKUP
583
- field_detail[Constants::SKIP_MANDATORY] = true if data_type.downcase.include? Constants::CONSENT_LOOKUP
593
+ field_detail[Constants::LOOKUP] = true if data_type.downcase.include? Constants::LOOKUP
594
+ field_detail[Constants::SKIP_MANDATORY] = true if data_type.downcase.include? Constants::CONSENT_LOOKUP
584
595
 
585
- if @@apitype_vs_structurename.include? data_type
586
- field_detail[Constants::STRUCTURE_NAME] = @@apitype_vs_structurename[data_type]
587
- end
596
+ if @@apitype_vs_structurename.include? data_type
597
+ field_detail[Constants::STRUCTURE_NAME] = @@apitype_vs_structurename[data_type]
598
+ end
588
599
 
589
- if (field_instance.data_type.downcase == Constants::PICKLIST.downcase) && !field_instance.pick_list_values.nil? && !field_instance.pick_list_values.empty?
590
- values = []
600
+ if (field_instance.data_type.downcase == Constants::PICKLIST.downcase) && !field_instance.pick_list_values.nil? && !field_instance.pick_list_values.empty?
601
+ values = []
591
602
 
592
- field_instance.pick_list_values.each do |pick_list_value|
593
- values.push(pick_list_value.display_value)
603
+ field_instance.pick_list_values.each do |pick_list_value|
604
+ values.push(pick_list_value.display_value)
605
+ end
606
+ field_detail[Constants::PICKLIST] = true
607
+ field_detail[Constants::VALUES] = values
594
608
  end
595
- field_detail[Constants::PICKLIST] = true
596
- field_detail[Constants::VALUES] = values
597
- end
598
-
599
- if data_type.downcase == Constants::SUBFORM.downcase
600
- module_name = field_instance.subform.module
601
- field_detail[Constants::SUBFORM] = true
602
- field_detail[Constants::SKIP_MANDATORY] = true
603
- field_detail[Constants::MODULE] = module_name
604
- end
605
609
 
606
- if data_type.downcase == Constants::LOOKUP.downcase
607
- module_name = field_instance.lookup.module
608
- if !module_name.nil? && (module_name.downcase != Constants::SE_MODULE.downcase)
610
+ if data_type.downcase == Constants::SUBFORM.downcase
611
+ module_name = field_instance.subform.module
612
+ field_detail[Constants::SUBFORM] = true
613
+ field_detail[Constants::SKIP_MANDATORY] = true
609
614
  field_detail[Constants::MODULE] = module_name
610
- if (module_name.downcase == Constants::ACCOUNTS.downcase) && !field_instance.custom_field
611
- field_detail[Constants::SKIP_MANDATORY] = true
612
- end
613
- else
614
- module_name = ''
615
615
  end
616
- field_detail[Constants::LOOKUP] = true
617
- end
618
- get_fields_info(module_name) if !module_name.nil? && !module_name.empty?
619
- field_detail[Constants::NAME] = key_name
620
- end
621
-
622
- def self.get_modules(header)
623
- api_names = {}
624
- header_map = HeaderMap.new
625
- unless header.nil?
626
- header_value = Time.at(header.to_i / 1000).iso8601
627
- header_map.add(Modules::ModulesOperations::GetModulesHeader.If_modified_since, header_value)
628
- end
629
- response = Modules::ModulesOperations.new.get_modules(header_map)
630
-
631
- unless response.nil?
632
- if [Constants::RESPONSECODE_NO_CONTENT, Constants::RESPONSECODE_NOT_MODIFIED].include? response.status_code
633
- return api_names
634
- end
635
-
636
- if response.is_expected
637
- response_object = response.data_object
638
- if response_object.is_a? Modules::ResponseWrapper
639
- modules = response_object.modules
640
- modules.each do |module_ins|
641
- if module_ins.api_supported
642
- module_details = {}
643
- module_details[Constants::API_NAME]=module_ins.api_name
644
- module_details[Constants::GENERATED_TYPE]=module_ins.generated_type.value
645
- api_names[module_ins.api_name.downcase] =module_details
646
- end
616
+
617
+ if data_type.downcase == Constants::LOOKUP.downcase
618
+ module_name = field_instance.lookup.module
619
+ if !module_name.nil? && (module_name.downcase != Constants::SE_MODULE.downcase)
620
+ field_detail[Constants::MODULE] = module_name
621
+ if (module_name.downcase == Constants::ACCOUNTS.downcase) && !field_instance.custom_field
622
+ field_detail[Constants::SKIP_MANDATORY] = true
647
623
  end
648
- elsif response_object.is_a? Modules::APIException
649
- error_response = {}
650
- error_response[Constants::CODE] = response_object.code.value
651
- error_response[Constants::STATUS] = response_object.status.value
652
- error_response[Constants::MESSAGE] = response_object.message.value
653
- raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
624
+ else
625
+ module_name = ''
654
626
  end
627
+ field_detail[Constants::LOOKUP] = true
655
628
  end
629
+ get_fields_info(module_name) if !module_name.nil? && !module_name.empty?
630
+ field_detail[Constants::NAME] = key_name
656
631
  end
657
- if header.nil?
658
- begin
659
- initializer = Initializer.get_initializer
660
- resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
661
- Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
662
- record_field_details_path = get_record_json_file_path()
663
- write_module_meta_data(record_field_details_path, api_names)
632
+
633
+ def self.get_modules(header)
634
+ api_names = {}
635
+ header_map = HeaderMap.new
636
+ unless header.nil?
637
+ header_value = Time.at(header.to_i / 1000).iso8601
638
+ header_map.add(Modules::ModulesOperations::GetModulesHeader.If_modified_since, DateTime.parse(header_value))
664
639
  end
665
- end
666
- api_names
667
- end
640
+ response = Modules::ModulesOperations.new.get_modules(header_map)
668
641
 
669
- def self.check_related_list_exists(related_module_name, module_related_list_ja, common_api_handler)
670
- (0..module_related_list_ja.length - 1).each do |i|
671
- related_list_jo = module_related_list_ja[i]
672
- if !related_list_jo[Constants::API_NAME].nil? && (related_list_jo[Constants::API_NAME].downcase == related_module_name.downcase)
673
- if related_list_jo[Constants::HREF] == Constants::NULL_VALUE
674
- raise SDKException.new(Constants::UNSUPPORTED_IN_API, common_api_handler.http_method + ' ' + common_api_handler.api_path + Constants::UNSUPPORTED_IN_API_MESSAGE)
642
+ unless response.nil?
643
+ if [Constants::RESPONSECODE_NO_CONTENT, Constants::RESPONSECODE_NOT_MODIFIED].include? response.status_code
644
+ return api_names
675
645
  end
676
646
 
677
- if related_list_jo[Constants::MODULE] != Constants::NULL_VALUE
678
- common_api_handler.module_api_name = related_list_jo[Constants::MODULE]
679
- get_fields_info(related_list_jo[Constants::MODULE])
647
+ if response.is_expected
648
+ response_object = response.data_object
649
+ if response_object.is_a? Modules::ResponseWrapper
650
+ modules = response_object.modules
651
+ modules.each do |module_ins|
652
+ if module_ins.api_supported
653
+ module_details = {}
654
+ module_details[Constants::API_NAME]=module_ins.api_name
655
+ module_details[Constants::GENERATED_TYPE]=module_ins.generated_type.value
656
+ api_names[module_ins.api_name.downcase] =module_details
657
+ end
658
+ end
659
+ elsif response_object.is_a? Modules::APIException
660
+ error_response = {}
661
+ error_response[Constants::CODE] = response_object.code.value
662
+ error_response[Constants::STATUS] = response_object.status.value
663
+ error_response[Constants::MESSAGE] = response_object.message.value
664
+ raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
665
+ end
666
+ end
667
+ end
668
+ if header.nil?
669
+ begin
670
+ initializer = Initializer.get_initializer
671
+ resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
672
+ Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
673
+ record_field_details_path = get_record_json_file_path()
674
+ write_module_meta_data(record_field_details_path, api_names)
680
675
  end
681
- return true
682
676
  end
677
+ api_names
683
678
  end
684
- false
685
- end
686
679
 
687
- def self.verify_photo_support(module_api_name)
688
- @@sync_lock.synchronize do
689
- begin
690
- module_api_name = verify_module_api_name(module_api_name)
691
- if Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name.downcase
680
+ def self.check_related_list_exists(related_module_name, module_related_list_ja, common_api_handler)
681
+ (0..module_related_list_ja.length - 1).each do |i|
682
+ related_list_jo = module_related_list_ja[i]
683
+ if !related_list_jo[Constants::API_NAME].nil? && (related_list_jo[Constants::API_NAME].downcase == related_module_name.downcase)
684
+ if related_list_jo[Constants::HREF] == Constants::NULL_VALUE
685
+ raise SDKException.new(Constants::UNSUPPORTED_IN_API, common_api_handler.http_method + ' ' + common_api_handler.api_path + Constants::UNSUPPORTED_IN_API_MESSAGE)
686
+ end
687
+
688
+ if related_list_jo[Constants::MODULE] != Constants::NULL_VALUE
689
+ common_api_handler.module_api_name = related_list_jo[Constants::MODULE]
690
+ get_fields_info(related_list_jo[Constants::MODULE], common_api_handler)
691
+ end
692
692
  return true
693
693
  end
694
- modules = get_module_names()
694
+ end
695
+ false
696
+ end
697
+
698
+ def self.verify_photo_support(module_api_name)
699
+ @@sync_lock.synchronize do
700
+ begin
701
+ module_api_name = verify_module_api_name(module_api_name)
702
+ if Constants::PHOTO_SUPPORTED_MODULES.include? module_api_name.downcase
703
+ return true
704
+ end
705
+ modules = get_module_names()
695
706
 
696
- if modules.key? module_api_name.downcase || !modules[module_api_name.downcase].nil?
697
- module_meta_data = modules[module_api_name.downcase]
707
+ if modules.key? module_api_name.downcase || !modules[module_api_name.downcase].nil?
708
+ module_meta_data = modules[module_api_name.downcase]
698
709
 
699
- if module_meta_data.key? Constants::GENERATED_TYPE && module_meta_data[Constants::GENERATED_TYPE] != Constants::GENERATED_TYPE_CUSTOM
700
- raise SDKException.new(Constants::UPLOAD_PHOTO_UNSUPPORTED_ERROR,Constants::UPLOAD_PHOTO_UNSUPPORTED_MESSAGE + module_api_name)
710
+ if module_meta_data.key? Constants::GENERATED_TYPE && module_meta_data[Constants::GENERATED_TYPE] != Constants::GENERATED_TYPE_CUSTOM
711
+ raise SDKException.new(Constants::UPLOAD_PHOTO_UNSUPPORTED_ERROR,Constants::UPLOAD_PHOTO_UNSUPPORTED_MESSAGE + module_api_name)
712
+ end
701
713
  end
714
+ rescue SDKException => e
715
+ raise e
716
+ rescue StandardError => e
717
+ ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
718
+ SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
719
+ raise ex
702
720
  end
703
- rescue SDKException => e
704
- raise e
705
- rescue StandardError => e
706
- ex = SDKException.new(nil, Constants::EXCEPTION, nil, e)
707
- SDKLog::SDKLogger.severe(Constants::EXCEPTION, ex)
708
- raise ex
709
- end
710
- return true
721
+ return true
722
+ end
711
723
  end
712
- end
713
-
714
- def self.get_module_names()
715
- module_data = {}
716
- initializer = Initializer.get_initializer
717
- resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
718
- Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
719
-
720
- record_field_details_path = get_record_json_file_path()
721
-
722
- call_get_modules = false
723
- if File.exists? record_field_details_path
724
- json = JSON.parse(File.read(record_field_details_path))
725
- if !json.key? Constants::SDK_MODULE_METADATA
726
- call_get_modules = true
727
- elsif json[Constants::SDK_MODULE_METADATA].nil? || json[Constants::SDK_MODULE_METADATA].length == 0
724
+
725
+ def self.get_module_names()
726
+ module_data = {}
727
+ initializer = Initializer.get_initializer
728
+ resoures_folder_path = initializer.resources_path + '/' + Constants::RESOURCES
729
+ Dir.mkdir resoures_folder_path unless File.exist? resoures_folder_path
730
+
731
+ record_field_details_path = get_record_json_file_path()
732
+
733
+ call_get_modules = false
734
+ if File.exists? record_field_details_path
735
+ json = JSON.parse(File.read(record_field_details_path))
736
+ if !json.key? Constants::SDK_MODULE_METADATA
737
+ call_get_modules = true
738
+ elsif json[Constants::SDK_MODULE_METADATA].nil? || json[Constants::SDK_MODULE_METADATA].length == 0
739
+ call_get_modules = true
740
+ end
741
+ else
728
742
  call_get_modules = true
729
743
  end
730
- else
731
- call_get_modules = true
732
- end
733
- if call_get_modules
734
- module_data = get_modules(nil)
735
- write_module_meta_data(record_field_details_path, module_data)
744
+ if call_get_modules
745
+ module_data = get_modules(nil)
746
+ write_module_meta_data(record_field_details_path, module_data)
747
+ return module_data
748
+ end
749
+ record_field_details_json = JSON.parse(File.read(record_field_details_path))
750
+ module_data = record_field_details_json[Constants::SDK_MODULE_METADATA]
736
751
  return module_data
737
752
  end
738
- record_field_details_json = JSON.parse(File.read(record_field_details_path))
739
- module_data = record_field_details_json[Constants::SDK_MODULE_METADATA]
740
- return module_data
741
- end
742
753
 
743
- def self.write_module_meta_data(record_field_details_path, module_data)
744
- field_details_json = (File.exist? record_field_details_path) ? JSON.parse(File.read(record_field_details_path)):{}
745
- field_details_json[Constants::SDK_MODULE_METADATA] = module_data
746
- File.open(record_field_details_path, 'w') do |f|
747
- f.write(field_details_json.to_json)
754
+ def self.write_module_meta_data(record_field_details_path, module_data)
755
+ field_details_json = (File.exist? record_field_details_path) ? JSON.parse(File.read(record_field_details_path)):{}
756
+ field_details_json[Constants::SDK_MODULE_METADATA] = module_data
757
+ File.open(record_field_details_path, 'w') do |f|
758
+ f.write(field_details_json.to_json)
759
+ end
748
760
  end
749
- end
750
761
 
751
- def self.get_related_list_details(module_api_name)
752
- rlo = RelatedLists::RelatedListsOperations.new(module_api_name)
753
- response = rlo.get_related_lists
754
- related_lists_ja = []
755
- unless response.nil?
756
- return related_lists_ja if response.status_code == Constants::RESPONSECODE_NO_CONTENT
757
-
758
- if response.is_expected
759
- response_handler = response.data_object
760
- if response_handler.is_a? RelatedLists::ResponseWrapper
761
- response_wrapper = response_handler
762
- related_lists = response_wrapper.related_lists
763
- related_lists.each do |related_list|
764
- related_list_detail = {}
765
- related_list_detail[Constants::API_NAME] = related_list.api_name
766
- related_list_detail[Constants::MODULE] = related_list.module.nil? ? Constants::NULL_VALUE : related_list.module
767
- related_list_detail[Constants::NAME] = related_list.name
768
- related_list_detail[Constants::HREF] = related_list.href.nil? ? Constants::NULL_VALUE : related_list.href
769
- related_lists_ja.push(related_list_detail)
762
+ def self.get_related_list_details(module_api_name)
763
+ rlo = RelatedLists::RelatedListsOperations.new(module_api_name)
764
+ response = rlo.get_related_lists
765
+ related_lists_ja = []
766
+ unless response.nil?
767
+ return related_lists_ja if response.status_code == Constants::RESPONSECODE_NO_CONTENT
768
+
769
+ if response.is_expected
770
+ response_handler = response.data_object
771
+ if response_handler.is_a? RelatedLists::ResponseWrapper
772
+ response_wrapper = response_handler
773
+ related_lists = response_wrapper.related_lists
774
+ related_lists.each do |related_list|
775
+ related_list_detail = {}
776
+ related_list_detail[Constants::API_NAME] = related_list.api_name
777
+ related_list_detail[Constants::MODULE] = related_list.module.nil? ? Constants::NULL_VALUE : related_list.module
778
+ related_list_detail[Constants::NAME] = related_list.name
779
+ related_list_detail[Constants::HREF] = related_list.href.nil? ? Constants::NULL_VALUE : related_list.href
780
+ related_lists_ja.push(related_list_detail)
781
+ end
782
+ elsif response_handler.is_a? RelatedLists::APIException
783
+ exception = response_handler
784
+ error_response = {}
785
+ error_response[Constants::CODE] = exception.code.value
786
+ error_response[Constants::STATUS] = exception.status.value
787
+ error_response[Constants::MESSAGE] = exception.message.value
788
+ raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
770
789
  end
771
- elsif response_handler.is_a? RelatedLists::APIException
772
- exception = response_handler
790
+ else
773
791
  error_response = {}
774
- error_response[Constants::CODE] = exception.code.value
775
- error_response[Constants::STATUS] = exception.status.value
776
- error_response[Constants::MESSAGE] = exception.message.value
792
+ error_response[Constants::CODE] = response.status_code
777
793
  raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
778
794
  end
779
- else
780
- error_response = {}
781
- error_response[Constants::CODE] = response.status_code
782
- raise SDKException.new(Constants::API_EXCEPTION, nil, error_response)
783
795
  end
796
+ related_lists_ja
784
797
  end
785
- related_lists_ja
786
- end
787
-
788
- def self.get_current_time_in_millis
789
- (Time.now.to_f * 1000).to_i
790
- end
791
798
 
792
- def self.refresh_modules
793
- @@force_refresh = true
794
- get_fields_info(nil)
795
- @@force_refresh = false
796
- end
799
+ def self.get_current_time_in_millis
800
+ (Time.now.to_f * 1000).to_i
801
+ end
797
802
 
798
- def self.classname_to_filename(class_name)
799
- changed_class_name = ''
800
- camel_case_split = (class_name.to_s.split(/([[:upper:]][[:lower:]]+)/)).delete_if(&:empty?)
801
- camel_case_split.each_with_index do |each_name, i|
802
- changed_class_name += Constants::UNDERSCORE if i.positive?
803
- changed_class_name += each_name.to_s.downcase
803
+ def self.refresh_modules
804
+ @@force_refresh = true
805
+ get_fields_info(nil)
806
+ @@force_refresh = false
804
807
  end
805
808
 
806
- changed_class_name
807
- end
809
+ def self.classname_to_filename(class_name)
810
+ changed_class_name = ''
811
+ camel_case_split = (class_name.to_s.split(/([[:upper:]][[:lower:]]+)/)).delete_if(&:empty?)
812
+ camel_case_split.each_with_index do |each_name, i|
813
+ changed_class_name += Constants::UNDERSCORE if i.positive?
814
+ changed_class_name += each_name.to_s.downcase
815
+ end
808
816
 
809
- def self.class_to_load(class_path)
810
- package_to_load = ''
817
+ changed_class_name
818
+ end
811
819
 
812
- class_path = class_path.to_s
820
+ def self.class_to_load(class_path)
821
+ package_to_load = 'ZOHOCRMSDK::'
813
822
 
814
- split_names = class_path.split(Constants::DOT)
823
+ class_path = class_path.to_s
815
824
 
816
- package_name_split = split_names[-2].to_s.split(Constants::UNDERSCORE)
825
+ split_names = class_path.split(Constants::DOT)
817
826
 
818
- package_name_split.each do |name|
819
- name[0] = name[0].to_s.upcase
820
- package_to_load += name
821
- end
827
+ package_name_split = split_names[-2].to_s.split(Constants::UNDERSCORE)
822
828
 
823
- package_to_load += Constants::DOUBLE_COLON
829
+ package_name_split.each do |name|
830
+ name[0] = name[0].to_s.upcase
831
+ package_to_load += name
832
+ end
824
833
 
825
- package_to_load += split_names[-1]
834
+ package_to_load += Constants::DOUBLE_COLON
826
835
 
827
- package_to_load
828
- end
836
+ package_to_load += split_names[-1]
829
837
 
830
- def self.path_to_package(class_path)
831
- if class_path.to_s.include? Constants::DOUBLE_COLON
832
- name = Constants::PACKAGE_PREFIX
833
- class_path = class_path.to_s
834
- class_split = class_path.to_s.split(Constants::DOUBLE_COLON)
835
- class_split[0] = classname_to_filename(class_split[0])
836
- name += class_split[0] + Constants::DOT + class_split[1]
837
- name
838
- else
839
- class_path
838
+ package_to_load
840
839
  end
841
- end
842
840
 
843
- def self.check_data_type(value,type)
844
- if value.nil?
845
- return false
846
- end
847
- if type.downcase == Constants::OBJECT.downcase
848
- return true
841
+ def self.path_to_package(class_path)
842
+ if class_path.to_s.include? Constants::DOUBLE_COLON
843
+ name = Constants::PACKAGE_PREFIX
844
+ class_path = class_path.to_s
845
+ class_split = class_path.to_s.split(Constants::DOUBLE_COLON)
846
+ class_split[1] = classname_to_filename(class_split[1])
847
+ name += class_split[1] + Constants::DOT + class_split[2]
848
+ name
849
+ else
850
+ class_path
851
+ end
849
852
  end
850
- type = Constants::DATA_TYPE[type].downcase
851
- class_name = value.class.name.downcase
852
- if type == Constants::BOOLEAN.downcase
853
- class_name = ([true, false].include? value) ? Constants::BOOLEAN.downcase : class_name
853
+
854
+ def self.check_data_type(value,type)
855
+ if value.nil?
856
+ return false
857
+ end
858
+ if type.downcase == Constants::OBJECT.downcase
859
+ return true
860
+ end
861
+ type = Constants::DATA_TYPE[type].downcase
862
+ class_name = value.class.name.downcase
863
+ if type == Constants::BOOLEAN.downcase
864
+ class_name = ([true, false].include? value) ? Constants::BOOLEAN.downcase : class_name
865
+ end
866
+ class_name == type
854
867
  end
855
- class_name == type
856
868
  end
857
869
  end
858
- end
870
+ end