ZCRMSDK 1.0.5 → 2.0.0

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