ZOHOCRMSDK2_0 1.0.0 → 5.0.0

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