ZOHOCRMSDK2_0_docgo 6.2.0

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