ZOHOCRMSDK2_0_docgo 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (374) hide show
  1. checksums.yaml +7 -0
  2. data/src/ZOHOCRMSDK2_0_docgo.rb +370 -0
  3. data/src/com/zoho/api/authenticator/oauth_token.rb +285 -0
  4. data/src/com/zoho/api/authenticator/store/db_store.rb +194 -0
  5. data/src/com/zoho/api/authenticator/store/file_store.rb +238 -0
  6. data/src/com/zoho/api/authenticator/store/token_store.rb +35 -0
  7. data/src/com/zoho/api/authenticator/token.rb +12 -0
  8. data/src/com/zoho/api/logger/sdk_logger.rb +64 -0
  9. data/src/com/zoho/crm/api/attachments/action_handler.rb +12 -0
  10. data/src/com/zoho/crm/api/attachments/action_response.rb +12 -0
  11. data/src/com/zoho/crm/api/attachments/action_wrapper.rb +65 -0
  12. data/src/com/zoho/crm/api/attachments/api_exception.rb +127 -0
  13. data/src/com/zoho/crm/api/attachments/attachment.rb +369 -0
  14. data/src/com/zoho/crm/api/attachments/attachments_operations.rb +198 -0
  15. data/src/com/zoho/crm/api/attachments/file_body_wrapper.rb +66 -0
  16. data/src/com/zoho/crm/api/attachments/response_handler.rb +12 -0
  17. data/src/com/zoho/crm/api/attachments/response_wrapper.rb +85 -0
  18. data/src/com/zoho/crm/api/attachments/success_response.rb +123 -0
  19. data/src/com/zoho/crm/api/blue_print/action_response.rb +12 -0
  20. data/src/com/zoho/crm/api/blue_print/api_exception.rb +125 -0
  21. data/src/com/zoho/crm/api/blue_print/blue_print.rb +121 -0
  22. data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +69 -0
  23. data/src/com/zoho/crm/api/blue_print/body_wrapper.rb +63 -0
  24. data/src/com/zoho/crm/api/blue_print/next_transition.rb +82 -0
  25. data/src/com/zoho/crm/api/blue_print/process_info.rb +253 -0
  26. data/src/com/zoho/crm/api/blue_print/response_handler.rb +12 -0
  27. data/src/com/zoho/crm/api/blue_print/response_wrapper.rb +65 -0
  28. data/src/com/zoho/crm/api/blue_print/success_response.rb +123 -0
  29. data/src/com/zoho/crm/api/blue_print/transition.rb +255 -0
  30. data/src/com/zoho/crm/api/blue_print/validation_error.rb +82 -0
  31. data/src/com/zoho/crm/api/bulk_read/action_handler.rb +12 -0
  32. data/src/com/zoho/crm/api/bulk_read/action_response.rb +12 -0
  33. data/src/com/zoho/crm/api/bulk_read/action_wrapper.rb +84 -0
  34. data/src/com/zoho/crm/api/bulk_read/api_exception.rb +127 -0
  35. data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +76 -0
  36. data/src/com/zoho/crm/api/bulk_read/call_back.rb +83 -0
  37. data/src/com/zoho/crm/api/bulk_read/criteria.rb +137 -0
  38. data/src/com/zoho/crm/api/bulk_read/file_body_wrapper.rb +66 -0
  39. data/src/com/zoho/crm/api/bulk_read/job_detail.rb +198 -0
  40. data/src/com/zoho/crm/api/bulk_read/query.rb +139 -0
  41. data/src/com/zoho/crm/api/bulk_read/request_wrapper.rb +102 -0
  42. data/src/com/zoho/crm/api/bulk_read/response_handler.rb +12 -0
  43. data/src/com/zoho/crm/api/bulk_read/response_wrapper.rb +65 -0
  44. data/src/com/zoho/crm/api/bulk_read/result.rb +139 -0
  45. data/src/com/zoho/crm/api/bulk_read/success_response.rb +123 -0
  46. data/src/com/zoho/crm/api/bulk_write/action_response.rb +12 -0
  47. data/src/com/zoho/crm/api/bulk_write/api_exception.rb +241 -0
  48. data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +114 -0
  49. data/src/com/zoho/crm/api/bulk_write/bulk_write_response.rb +218 -0
  50. data/src/com/zoho/crm/api/bulk_write/call_back.rb +83 -0
  51. data/src/com/zoho/crm/api/bulk_write/field_mapping.rb +158 -0
  52. data/src/com/zoho/crm/api/bulk_write/file.rb +159 -0
  53. data/src/com/zoho/crm/api/bulk_write/file_body_wrapper.rb +66 -0
  54. data/src/com/zoho/crm/api/bulk_write/request_wrapper.rb +121 -0
  55. data/src/com/zoho/crm/api/bulk_write/resource.rb +197 -0
  56. data/src/com/zoho/crm/api/bulk_write/response_handler.rb +12 -0
  57. data/src/com/zoho/crm/api/bulk_write/response_wrapper.rb +12 -0
  58. data/src/com/zoho/crm/api/bulk_write/result.rb +63 -0
  59. data/src/com/zoho/crm/api/bulk_write/success_response.rb +123 -0
  60. data/src/com/zoho/crm/api/contact_roles/action_handler.rb +12 -0
  61. data/src/com/zoho/crm/api/contact_roles/action_response.rb +12 -0
  62. data/src/com/zoho/crm/api/contact_roles/action_wrapper.rb +65 -0
  63. data/src/com/zoho/crm/api/contact_roles/api_exception.rb +131 -0
  64. data/src/com/zoho/crm/api/contact_roles/body_wrapper.rb +63 -0
  65. data/src/com/zoho/crm/api/contact_roles/contact_role.rb +101 -0
  66. data/src/com/zoho/crm/api/contact_roles/contact_role_wrapper.rb +63 -0
  67. data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +270 -0
  68. data/src/com/zoho/crm/api/contact_roles/record_action_handler.rb +12 -0
  69. data/src/com/zoho/crm/api/contact_roles/record_action_wrapper.rb +65 -0
  70. data/src/com/zoho/crm/api/contact_roles/record_body_wrapper.rb +63 -0
  71. data/src/com/zoho/crm/api/contact_roles/record_response_handler.rb +12 -0
  72. data/src/com/zoho/crm/api/contact_roles/record_response_wrapper.rb +86 -0
  73. data/src/com/zoho/crm/api/contact_roles/response_handler.rb +12 -0
  74. data/src/com/zoho/crm/api/contact_roles/response_wrapper.rb +65 -0
  75. data/src/com/zoho/crm/api/contact_roles/success_response.rb +123 -0
  76. data/src/com/zoho/crm/api/currencies/action_handler.rb +12 -0
  77. data/src/com/zoho/crm/api/currencies/action_response.rb +12 -0
  78. data/src/com/zoho/crm/api/currencies/action_wrapper.rb +65 -0
  79. data/src/com/zoho/crm/api/currencies/api_exception.rb +129 -0
  80. data/src/com/zoho/crm/api/currencies/base_currency_action_handler.rb +12 -0
  81. data/src/com/zoho/crm/api/currencies/base_currency_action_wrapper.rb +65 -0
  82. data/src/com/zoho/crm/api/currencies/base_currency_wrapper.rb +63 -0
  83. data/src/com/zoho/crm/api/currencies/body_wrapper.rb +63 -0
  84. data/src/com/zoho/crm/api/currencies/currencies_operations.rb +151 -0
  85. data/src/com/zoho/crm/api/currencies/currency.rb +292 -0
  86. data/src/com/zoho/crm/api/currencies/format.rb +102 -0
  87. data/src/com/zoho/crm/api/currencies/response_handler.rb +12 -0
  88. data/src/com/zoho/crm/api/currencies/response_wrapper.rb +65 -0
  89. data/src/com/zoho/crm/api/currencies/success_response.rb +123 -0
  90. data/src/com/zoho/crm/api/custom_views/api_exception.rb +123 -0
  91. data/src/com/zoho/crm/api/custom_views/criteria.rb +137 -0
  92. data/src/com/zoho/crm/api/custom_views/custom_view.rb +329 -0
  93. data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +75 -0
  94. data/src/com/zoho/crm/api/custom_views/info.rb +158 -0
  95. data/src/com/zoho/crm/api/custom_views/range.rb +82 -0
  96. data/src/com/zoho/crm/api/custom_views/response_handler.rb +12 -0
  97. data/src/com/zoho/crm/api/custom_views/response_wrapper.rb +84 -0
  98. data/src/com/zoho/crm/api/custom_views/shared_details.rb +120 -0
  99. data/src/com/zoho/crm/api/custom_views/translation.rb +120 -0
  100. data/src/com/zoho/crm/api/dc/au_datacenter.rb +21 -0
  101. data/src/com/zoho/crm/api/dc/cn_datacenter.rb +21 -0
  102. data/src/com/zoho/crm/api/dc/datacenter.rb +23 -0
  103. data/src/com/zoho/crm/api/dc/eu_datacenter.rb +21 -0
  104. data/src/com/zoho/crm/api/dc/in_datacenter.rb +21 -0
  105. data/src/com/zoho/crm/api/dc/jp_datacenter.rb +21 -0
  106. data/src/com/zoho/crm/api/dc/us_datacenter.rb +21 -0
  107. data/src/com/zoho/crm/api/exception/sdk_exception.rb +49 -0
  108. data/src/com/zoho/crm/api/fields/api_exception.rb +123 -0
  109. data/src/com/zoho/crm/api/fields/association_details.rb +82 -0
  110. data/src/com/zoho/crm/api/fields/auto_number.rb +101 -0
  111. data/src/com/zoho/crm/api/fields/crypt.rb +158 -0
  112. data/src/com/zoho/crm/api/fields/currency.rb +82 -0
  113. data/src/com/zoho/crm/api/fields/field.rb +958 -0
  114. data/src/com/zoho/crm/api/fields/fields_operations.rb +71 -0
  115. data/src/com/zoho/crm/api/fields/formula.rb +82 -0
  116. data/src/com/zoho/crm/api/fields/lookup_field.rb +82 -0
  117. data/src/com/zoho/crm/api/fields/module.rb +159 -0
  118. data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +158 -0
  119. data/src/com/zoho/crm/api/fields/pick_list_value.rb +177 -0
  120. data/src/com/zoho/crm/api/fields/private.rb +101 -0
  121. data/src/com/zoho/crm/api/fields/related_details.rb +139 -0
  122. data/src/com/zoho/crm/api/fields/response_handler.rb +12 -0
  123. data/src/com/zoho/crm/api/fields/response_wrapper.rb +65 -0
  124. data/src/com/zoho/crm/api/fields/tool_tip.rb +82 -0
  125. data/src/com/zoho/crm/api/fields/unique.rb +63 -0
  126. data/src/com/zoho/crm/api/fields/view_type.rb +120 -0
  127. data/src/com/zoho/crm/api/files/action_handler.rb +12 -0
  128. data/src/com/zoho/crm/api/files/action_response.rb +12 -0
  129. data/src/com/zoho/crm/api/files/action_wrapper.rb +65 -0
  130. data/src/com/zoho/crm/api/files/api_exception.rb +127 -0
  131. data/src/com/zoho/crm/api/files/body_wrapper.rb +64 -0
  132. data/src/com/zoho/crm/api/files/file_body_wrapper.rb +66 -0
  133. data/src/com/zoho/crm/api/files/file_operations.rb +75 -0
  134. data/src/com/zoho/crm/api/files/response_handler.rb +12 -0
  135. data/src/com/zoho/crm/api/files/success_response.rb +123 -0
  136. data/src/com/zoho/crm/api/header.rb +12 -0
  137. data/src/com/zoho/crm/api/header_map.rb +57 -0
  138. data/src/com/zoho/crm/api/initializer.rb +255 -0
  139. data/src/com/zoho/crm/api/layouts/api_exception.rb +123 -0
  140. data/src/com/zoho/crm/api/layouts/layout.rb +274 -0
  141. data/src/com/zoho/crm/api/layouts/layouts_operations.rb +61 -0
  142. data/src/com/zoho/crm/api/layouts/properties.rb +102 -0
  143. data/src/com/zoho/crm/api/layouts/response_handler.rb +12 -0
  144. data/src/com/zoho/crm/api/layouts/response_wrapper.rb +65 -0
  145. data/src/com/zoho/crm/api/layouts/section.rb +235 -0
  146. data/src/com/zoho/crm/api/modules/action_handler.rb +12 -0
  147. data/src/com/zoho/crm/api/modules/action_response.rb +12 -0
  148. data/src/com/zoho/crm/api/modules/action_wrapper.rb +65 -0
  149. data/src/com/zoho/crm/api/modules/api_exception.rb +127 -0
  150. data/src/com/zoho/crm/api/modules/argument.rb +82 -0
  151. data/src/com/zoho/crm/api/modules/body_wrapper.rb +63 -0
  152. data/src/com/zoho/crm/api/modules/module.rb +884 -0
  153. data/src/com/zoho/crm/api/modules/modules_operations.rb +109 -0
  154. data/src/com/zoho/crm/api/modules/related_list_properties.rb +101 -0
  155. data/src/com/zoho/crm/api/modules/response_handler.rb +12 -0
  156. data/src/com/zoho/crm/api/modules/response_wrapper.rb +65 -0
  157. data/src/com/zoho/crm/api/modules/success_response.rb +123 -0
  158. data/src/com/zoho/crm/api/modules/territory.rb +101 -0
  159. data/src/com/zoho/crm/api/notes/action_handler.rb +12 -0
  160. data/src/com/zoho/crm/api/notes/action_response.rb +12 -0
  161. data/src/com/zoho/crm/api/notes/action_wrapper.rb +65 -0
  162. data/src/com/zoho/crm/api/notes/api_exception.rb +127 -0
  163. data/src/com/zoho/crm/api/notes/body_wrapper.rb +63 -0
  164. data/src/com/zoho/crm/api/notes/info.rb +120 -0
  165. data/src/com/zoho/crm/api/notes/note.rb +351 -0
  166. data/src/com/zoho/crm/api/notes/notes_operations.rb +214 -0
  167. data/src/com/zoho/crm/api/notes/response_handler.rb +12 -0
  168. data/src/com/zoho/crm/api/notes/response_wrapper.rb +84 -0
  169. data/src/com/zoho/crm/api/notes/success_response.rb +123 -0
  170. data/src/com/zoho/crm/api/notification/action_handler.rb +12 -0
  171. data/src/com/zoho/crm/api/notification/action_response.rb +12 -0
  172. data/src/com/zoho/crm/api/notification/action_wrapper.rb +65 -0
  173. data/src/com/zoho/crm/api/notification/api_exception.rb +127 -0
  174. data/src/com/zoho/crm/api/notification/body_wrapper.rb +63 -0
  175. data/src/com/zoho/crm/api/notification/info.rb +120 -0
  176. data/src/com/zoho/crm/api/notification/notification.rb +253 -0
  177. data/src/com/zoho/crm/api/notification/notification_operations.rb +160 -0
  178. data/src/com/zoho/crm/api/notification/response_handler.rb +12 -0
  179. data/src/com/zoho/crm/api/notification/response_wrapper.rb +84 -0
  180. data/src/com/zoho/crm/api/notification/success_response.rb +123 -0
  181. data/src/com/zoho/crm/api/org/action_response.rb +12 -0
  182. data/src/com/zoho/crm/api/org/api_exception.rb +125 -0
  183. data/src/com/zoho/crm/api/org/file_body_wrapper.rb +64 -0
  184. data/src/com/zoho/crm/api/org/license_details.rb +158 -0
  185. data/src/com/zoho/crm/api/org/org.rb +633 -0
  186. data/src/com/zoho/crm/api/org/org_operations.rb +49 -0
  187. data/src/com/zoho/crm/api/org/response_handler.rb +12 -0
  188. data/src/com/zoho/crm/api/org/response_wrapper.rb +65 -0
  189. data/src/com/zoho/crm/api/org/success_response.rb +123 -0
  190. data/src/com/zoho/crm/api/param.rb +12 -0
  191. data/src/com/zoho/crm/api/parameter_map.rb +56 -0
  192. data/src/com/zoho/crm/api/profiles/api_exception.rb +123 -0
  193. data/src/com/zoho/crm/api/profiles/category.rb +101 -0
  194. data/src/com/zoho/crm/api/profiles/permission_detail.rb +139 -0
  195. data/src/com/zoho/crm/api/profiles/profile.rb +292 -0
  196. data/src/com/zoho/crm/api/profiles/profiles_operations.rb +61 -0
  197. data/src/com/zoho/crm/api/profiles/response_handler.rb +12 -0
  198. data/src/com/zoho/crm/api/profiles/response_wrapper.rb +65 -0
  199. data/src/com/zoho/crm/api/profiles/section.rb +82 -0
  200. data/src/com/zoho/crm/api/query/api_exception.rb +123 -0
  201. data/src/com/zoho/crm/api/query/body_wrapper.rb +63 -0
  202. data/src/com/zoho/crm/api/query/query_operations.rb +36 -0
  203. data/src/com/zoho/crm/api/query/response_handler.rb +12 -0
  204. data/src/com/zoho/crm/api/query/response_wrapper.rb +86 -0
  205. data/src/com/zoho/crm/api/record/action_handler.rb +12 -0
  206. data/src/com/zoho/crm/api/record/action_response.rb +12 -0
  207. data/src/com/zoho/crm/api/record/action_wrapper.rb +65 -0
  208. data/src/com/zoho/crm/api/record/api_exception.rb +145 -0
  209. data/src/com/zoho/crm/api/record/apply_feature_execution.rb +63 -0
  210. data/src/com/zoho/crm/api/record/body_wrapper.rb +177 -0
  211. data/src/com/zoho/crm/api/record/carry_over_tags.rb +101 -0
  212. data/src/com/zoho/crm/api/record/comment.rb +120 -0
  213. data/src/com/zoho/crm/api/record/consent.rb +187 -0
  214. data/src/com/zoho/crm/api/record/convert_action_handler.rb +12 -0
  215. data/src/com/zoho/crm/api/record/convert_action_response.rb +12 -0
  216. data/src/com/zoho/crm/api/record/convert_action_wrapper.rb +65 -0
  217. data/src/com/zoho/crm/api/record/convert_body_wrapper.rb +63 -0
  218. data/src/com/zoho/crm/api/record/criteria.rb +137 -0
  219. data/src/com/zoho/crm/api/record/deleted_record.rb +159 -0
  220. data/src/com/zoho/crm/api/record/deleted_records_handler.rb +12 -0
  221. data/src/com/zoho/crm/api/record/deleted_records_wrapper.rb +84 -0
  222. data/src/com/zoho/crm/api/record/download_handler.rb +12 -0
  223. data/src/com/zoho/crm/api/record/field.rb +2111 -0
  224. data/src/com/zoho/crm/api/record/file_body_wrapper.rb +68 -0
  225. data/src/com/zoho/crm/api/record/file_details.rb +329 -0
  226. data/src/com/zoho/crm/api/record/file_handler.rb +12 -0
  227. data/src/com/zoho/crm/api/record/info.rb +120 -0
  228. data/src/com/zoho/crm/api/record/inventory_line_items.rb +237 -0
  229. data/src/com/zoho/crm/api/record/lead_converter.rb +196 -0
  230. data/src/com/zoho/crm/api/record/line_item_product.rb +67 -0
  231. data/src/com/zoho/crm/api/record/line_tax.rb +120 -0
  232. data/src/com/zoho/crm/api/record/mass_update.rb +142 -0
  233. data/src/com/zoho/crm/api/record/mass_update_action_handler.rb +12 -0
  234. data/src/com/zoho/crm/api/record/mass_update_action_response.rb +12 -0
  235. data/src/com/zoho/crm/api/record/mass_update_action_wrapper.rb +65 -0
  236. data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +158 -0
  237. data/src/com/zoho/crm/api/record/mass_update_response.rb +12 -0
  238. data/src/com/zoho/crm/api/record/mass_update_response_handler.rb +12 -0
  239. data/src/com/zoho/crm/api/record/mass_update_response_wrapper.rb +65 -0
  240. data/src/com/zoho/crm/api/record/mass_update_success_response.rb +123 -0
  241. data/src/com/zoho/crm/api/record/options.rb +12 -0
  242. data/src/com/zoho/crm/api/record/participants.rb +118 -0
  243. data/src/com/zoho/crm/api/record/pricing_details.rb +67 -0
  244. data/src/com/zoho/crm/api/record/record.rb +194 -0
  245. data/src/com/zoho/crm/api/record/record_operations.rb +961 -0
  246. data/src/com/zoho/crm/api/record/recurring_activity.rb +63 -0
  247. data/src/com/zoho/crm/api/record/remind_at.rb +63 -0
  248. data/src/com/zoho/crm/api/record/reminder.rb +82 -0
  249. data/src/com/zoho/crm/api/record/response_handler.rb +12 -0
  250. data/src/com/zoho/crm/api/record/response_wrapper.rb +84 -0
  251. data/src/com/zoho/crm/api/record/success_response.rb +163 -0
  252. data/src/com/zoho/crm/api/record/successful_convert.rb +103 -0
  253. data/src/com/zoho/crm/api/record/territory.rb +82 -0
  254. data/src/com/zoho/crm/api/related_lists/api_exception.rb +123 -0
  255. data/src/com/zoho/crm/api/related_lists/related_list.rb +253 -0
  256. data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +61 -0
  257. data/src/com/zoho/crm/api/related_lists/response_handler.rb +12 -0
  258. data/src/com/zoho/crm/api/related_lists/response_wrapper.rb +65 -0
  259. data/src/com/zoho/crm/api/related_records/action_handler.rb +12 -0
  260. data/src/com/zoho/crm/api/related_records/action_response.rb +12 -0
  261. data/src/com/zoho/crm/api/related_records/action_wrapper.rb +65 -0
  262. data/src/com/zoho/crm/api/related_records/api_exception.rb +127 -0
  263. data/src/com/zoho/crm/api/related_records/body_wrapper.rb +64 -0
  264. data/src/com/zoho/crm/api/related_records/file_body_wrapper.rb +66 -0
  265. data/src/com/zoho/crm/api/related_records/related_records_operations.rb +524 -0
  266. data/src/com/zoho/crm/api/related_records/response_handler.rb +12 -0
  267. data/src/com/zoho/crm/api/related_records/response_wrapper.rb +86 -0
  268. data/src/com/zoho/crm/api/related_records/success_response.rb +123 -0
  269. data/src/com/zoho/crm/api/request_proxy.rb +17 -0
  270. data/src/com/zoho/crm/api/roles/api_exception.rb +123 -0
  271. data/src/com/zoho/crm/api/roles/response_handler.rb +12 -0
  272. data/src/com/zoho/crm/api/roles/response_wrapper.rb +65 -0
  273. data/src/com/zoho/crm/api/roles/role.rb +197 -0
  274. data/src/com/zoho/crm/api/roles/roles_operations.rb +47 -0
  275. data/src/com/zoho/crm/api/sdk_config.rb +15 -0
  276. data/src/com/zoho/crm/api/share_records/action_handler.rb +12 -0
  277. data/src/com/zoho/crm/api/share_records/action_response.rb +12 -0
  278. data/src/com/zoho/crm/api/share_records/action_wrapper.rb +65 -0
  279. data/src/com/zoho/crm/api/share_records/api_exception.rb +131 -0
  280. data/src/com/zoho/crm/api/share_records/body_wrapper.rb +63 -0
  281. data/src/com/zoho/crm/api/share_records/delete_action_handler.rb +12 -0
  282. data/src/com/zoho/crm/api/share_records/delete_action_response.rb +12 -0
  283. data/src/com/zoho/crm/api/share_records/delete_action_wrapper.rb +65 -0
  284. data/src/com/zoho/crm/api/share_records/response_handler.rb +12 -0
  285. data/src/com/zoho/crm/api/share_records/response_wrapper.rb +85 -0
  286. data/src/com/zoho/crm/api/share_records/share_record.rb +159 -0
  287. data/src/com/zoho/crm/api/share_records/share_records_operations.rb +130 -0
  288. data/src/com/zoho/crm/api/share_records/shared_through.rb +102 -0
  289. data/src/com/zoho/crm/api/share_records/success_response.rb +125 -0
  290. data/src/com/zoho/crm/api/tags/action_handler.rb +12 -0
  291. data/src/com/zoho/crm/api/tags/action_response.rb +12 -0
  292. data/src/com/zoho/crm/api/tags/action_wrapper.rb +65 -0
  293. data/src/com/zoho/crm/api/tags/api_exception.rb +133 -0
  294. data/src/com/zoho/crm/api/tags/body_wrapper.rb +63 -0
  295. data/src/com/zoho/crm/api/tags/conflict_wrapper.rb +63 -0
  296. data/src/com/zoho/crm/api/tags/count_handler.rb +12 -0
  297. data/src/com/zoho/crm/api/tags/count_wrapper.rb +65 -0
  298. data/src/com/zoho/crm/api/tags/info.rb +82 -0
  299. data/src/com/zoho/crm/api/tags/merge_wrapper.rb +63 -0
  300. data/src/com/zoho/crm/api/tags/record_action_handler.rb +12 -0
  301. data/src/com/zoho/crm/api/tags/record_action_response.rb +12 -0
  302. data/src/com/zoho/crm/api/tags/record_action_wrapper.rb +122 -0
  303. data/src/com/zoho/crm/api/tags/response_handler.rb +12 -0
  304. data/src/com/zoho/crm/api/tags/response_wrapper.rb +84 -0
  305. data/src/com/zoho/crm/api/tags/success_response.rb +125 -0
  306. data/src/com/zoho/crm/api/tags/tag.rb +159 -0
  307. data/src/com/zoho/crm/api/tags/tags_operations.rb +382 -0
  308. data/src/com/zoho/crm/api/taxes/action_handler.rb +12 -0
  309. data/src/com/zoho/crm/api/taxes/action_response.rb +12 -0
  310. data/src/com/zoho/crm/api/taxes/action_wrapper.rb +65 -0
  311. data/src/com/zoho/crm/api/taxes/api_exception.rb +127 -0
  312. data/src/com/zoho/crm/api/taxes/body_wrapper.rb +63 -0
  313. data/src/com/zoho/crm/api/taxes/preference.rb +82 -0
  314. data/src/com/zoho/crm/api/taxes/response_handler.rb +12 -0
  315. data/src/com/zoho/crm/api/taxes/response_wrapper.rb +84 -0
  316. data/src/com/zoho/crm/api/taxes/success_response.rb +123 -0
  317. data/src/com/zoho/crm/api/taxes/tax.rb +139 -0
  318. data/src/com/zoho/crm/api/taxes/taxes_operations.rb +132 -0
  319. data/src/com/zoho/crm/api/territories/api_exception.rb +123 -0
  320. data/src/com/zoho/crm/api/territories/response_handler.rb +12 -0
  321. data/src/com/zoho/crm/api/territories/response_wrapper.rb +65 -0
  322. data/src/com/zoho/crm/api/territories/territories_operations.rb +47 -0
  323. data/src/com/zoho/crm/api/territories/territory.rb +236 -0
  324. data/src/com/zoho/crm/api/user_signature.rb +29 -0
  325. data/src/com/zoho/crm/api/users/action_handler.rb +12 -0
  326. data/src/com/zoho/crm/api/users/action_response.rb +12 -0
  327. data/src/com/zoho/crm/api/users/action_wrapper.rb +65 -0
  328. data/src/com/zoho/crm/api/users/api_exception.rb +127 -0
  329. data/src/com/zoho/crm/api/users/body_wrapper.rb +63 -0
  330. data/src/com/zoho/crm/api/users/customize_info.rb +158 -0
  331. data/src/com/zoho/crm/api/users/info.rb +120 -0
  332. data/src/com/zoho/crm/api/users/request_wrapper.rb +63 -0
  333. data/src/com/zoho/crm/api/users/response_handler.rb +12 -0
  334. data/src/com/zoho/crm/api/users/response_wrapper.rb +84 -0
  335. data/src/com/zoho/crm/api/users/shift.rb +82 -0
  336. data/src/com/zoho/crm/api/users/success_response.rb +123 -0
  337. data/src/com/zoho/crm/api/users/tab_theme.rb +82 -0
  338. data/src/com/zoho/crm/api/users/territory.rb +101 -0
  339. data/src/com/zoho/crm/api/users/theme.rb +158 -0
  340. data/src/com/zoho/crm/api/users/user.rb +698 -0
  341. data/src/com/zoho/crm/api/users/users_operations.rb +177 -0
  342. data/src/com/zoho/crm/api/util/api_http_connector.rb +114 -0
  343. data/src/com/zoho/crm/api/util/api_response.rb +18 -0
  344. data/src/com/zoho/crm/api/util/choice.rb +11 -0
  345. data/src/com/zoho/crm/api/util/common_api_handler.rb +241 -0
  346. data/src/com/zoho/crm/api/util/constants.rb +646 -0
  347. data/src/com/zoho/crm/api/util/converter.rb +238 -0
  348. data/src/com/zoho/crm/api/util/data_type_converter.rb +170 -0
  349. data/src/com/zoho/crm/api/util/downloader.rb +86 -0
  350. data/src/com/zoho/crm/api/util/form_data_converter.rb +159 -0
  351. data/src/com/zoho/crm/api/util/header_param_validator.rb +57 -0
  352. data/src/com/zoho/crm/api/util/json_converter.rb +729 -0
  353. data/src/com/zoho/crm/api/util/model.rb +7 -0
  354. data/src/com/zoho/crm/api/util/module_fields_handler.rb +80 -0
  355. data/src/com/zoho/crm/api/util/stream_wrapper.rb +39 -0
  356. data/src/com/zoho/crm/api/util/utility.rb +871 -0
  357. data/src/com/zoho/crm/api/variable_groups/api_exception.rb +123 -0
  358. data/src/com/zoho/crm/api/variable_groups/response_handler.rb +12 -0
  359. data/src/com/zoho/crm/api/variable_groups/response_wrapper.rb +65 -0
  360. data/src/com/zoho/crm/api/variable_groups/variable_group.rb +139 -0
  361. data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +65 -0
  362. data/src/com/zoho/crm/api/variables/action_handler.rb +12 -0
  363. data/src/com/zoho/crm/api/variables/action_response.rb +12 -0
  364. data/src/com/zoho/crm/api/variables/action_wrapper.rb +65 -0
  365. data/src/com/zoho/crm/api/variables/api_exception.rb +127 -0
  366. data/src/com/zoho/crm/api/variables/body_wrapper.rb +63 -0
  367. data/src/com/zoho/crm/api/variables/response_handler.rb +12 -0
  368. data/src/com/zoho/crm/api/variables/response_wrapper.rb +65 -0
  369. data/src/com/zoho/crm/api/variables/success_response.rb +123 -0
  370. data/src/com/zoho/crm/api/variables/variable.rb +175 -0
  371. data/src/com/zoho/crm/api/variables/variables_operations.rb +234 -0
  372. data/src/resources/JSONDetails.json +1 -0
  373. data/src/version.rb +3 -0
  374. metadata +500 -0
@@ -0,0 +1,238 @@
1
+ require 'base64'
2
+ require_relative 'constants'
3
+ require_relative 'utility'
4
+
5
+ module ZOHOCRMSDK
6
+ module Util
7
+ class Converter
8
+ attr_accessor :common_api_handler
9
+ # This method is to process the API response.
10
+ # @param response [Object] A Object containing the API response contents or response.
11
+ # @param class_path [String] A String containing the expected method return type.
12
+ def get_response(response_json, class_path); end
13
+
14
+ # This abstract method is to construct the API request.
15
+ # @param request_instance [Object] An Object containing the class instance.
16
+ # @param class_path [String] A String containing the expected method return type.
17
+ # @param instanceNumber [Integer] An Integer containing the class instance list number.
18
+ # @return An Object representing the API request body object.
19
+ # @raise Exception
20
+ def form_request(request_instance, class_path, instance_no, member_details = nil); end
21
+
22
+ # This abstract method is to process the API response.
23
+ # @param response [Object] A Object containing the HttpResponse class instance.
24
+ # @param pack [String] A String containing the expected method return type.
25
+ # @return An Object representing the POJO class instance.
26
+ # @raise Exception
27
+ def get_wrapper_response(response, pack); end
28
+
29
+ # This abstract method is to construct the API request body.
30
+ # @param request [Object] A HttpEntityEnclosingRequestBase class instance.
31
+ # @param request_object A Object containing the API request body object.
32
+ # @raise Exception
33
+ def append_to_request(request, request_object); end
34
+
35
+ # Creates a Converter class instance with the CommonAPIHandler class instance.
36
+ # @param common_api_handler A CommonAPIHandler class instance.
37
+ def initialize(common_api_handler)
38
+ @common_api_handler = common_api_handler
39
+ end
40
+
41
+ # This method is to validate if the input values satisfy the constraints for the respective fields.
42
+ # @param class_name [String] A String containing the class name.
43
+ # @param member_name [String] A String containing the member name.
44
+ # @param key_details A Hash containing the key JSON details.
45
+ # @param value [Object[ An Object containing the key value.
46
+ # @param unique_values_map A Hash containing the construct objects.
47
+ # @param instance_number [Integer] An Integer containing the POJO class instance list number.
48
+ # @return A Boolean representing the key value is expected pattern, unique, length, and values.
49
+ # @raise SDKException
50
+ def value_checker(class_name, member_name, key_details, value, unique_values_map, instance_number)
51
+ error = {}
52
+
53
+ name = key_details[Constants::NAME]
54
+ type = key_details[Constants::TYPE]
55
+
56
+ var_type = nil
57
+ check = true
58
+
59
+ unless value.nil?
60
+ var_type = value.class.name
61
+ if key_details.key? Constants::INTERFACE and key_details[Constants::INTERFACE] == true
62
+ json_details = Initializer.json_details
63
+ interface_details = json_details[key_details[Constants::STRUCTURE_NAME]]
64
+ classes = interface_details[Constants::CLASSES]
65
+ check = false
66
+ classes.each do |each_class_name|
67
+ class_name_lower = each_class_name.to_s.downcase
68
+ value_class_name = Util::Utility.path_to_package(value.class.name).downcase
69
+
70
+ if class_name_lower.downcase == value_class_name
71
+ check = true
72
+ break
73
+ end
74
+ end
75
+ else
76
+ var_type = value.class.name
77
+ end
78
+ end
79
+
80
+ if Constants::DATA_TYPE.key? type
81
+ if value.is_a? Array
82
+ if key_details.key? Constants::STRUCTURE_NAME
83
+ structure_name = key_details[Constants::STRUCTURE_NAME]
84
+ index = 0
85
+ value.each do |data|
86
+ class_name = data.class.name
87
+ unless structure_name.downcase == Util::Utility.path_to_package(class_name).downcase
88
+ instance_number = index
89
+ type = Constants::LIST_NAMESPACE + '(' + structure_name + ')'
90
+ var_type = Constants::LIST_NAMESPACE + '(' + class_name + ')'
91
+ check = false
92
+
93
+ break
94
+ end
95
+ index += 1
96
+ end
97
+ end
98
+ elsif !value.nil?
99
+ check = Util::Utility.check_data_type(value,type)
100
+ end
101
+ elsif (type.downcase != Constants::OBJECT.downcase)
102
+ if type.downcase != Util::Utility.path_to_package(var_type).downcase
103
+ check = false
104
+ end
105
+ if !check
106
+ if Object.const_get(var_type).new.is_a? Object.const_get(Util::Utility.class_to_load(type))
107
+ check = true
108
+ end
109
+ end
110
+ end
111
+ if !check
112
+ error[Constants::ERROR_HASH_CLASS] = class_name
113
+
114
+ error[Constants::ERROR_HASH_FIELD] = member_name
115
+
116
+ error[Constants::INDEX] = instance_number
117
+
118
+ error[Constants::ERROR_HASH_EXPECTED_TYPE] = type
119
+
120
+ error[Constants::GIVEN_TYPE] = var_type
121
+
122
+ raise SDKException.new(Constants::TYPE_ERROR, nil, error, nil)
123
+ end
124
+
125
+ class_name = if class_name.include? Constants::DOUBLE_COLON
126
+ class_name.split(Constants::DOUBLE_COLON)[1]
127
+ else
128
+ class_name.split(Constants::DOT)[5]
129
+ end
130
+
131
+ if key_details.key?(Constants::VALUES) && (!key_details.key?(Constants::PICKLIST) || (key_details[Constants::PICKLIST] && Initializer.get_initializer.sdk_config.pick_list_validation))
132
+ value = value.value if value.is_a? Util::Choice
133
+
134
+ values_ja = key_details[Constants::VALUES]
135
+ unless values_ja.include? value
136
+
137
+ unless instance_number.nil?
138
+ error[Constants::INDEX] = instance_number
139
+ end
140
+
141
+ error[Constants::ERROR_HASH_CLASS] = class_name
142
+
143
+ error[Constants::GIVEN_VALUE] = value
144
+
145
+ error[Constants::ERROR_HASH_FIELD] = member_name
146
+
147
+ error[Constants::ACCEPTED_VALUES] = values_ja
148
+
149
+ raise SDKException.new(Constants::UNACCEPTED_VALUES_ERROR, nil, error, nil)
150
+ end
151
+ end
152
+
153
+ if key_details.key?(Constants::MIN_LENGTH) || key_details.key?(Constants::MAX_LENGTH)
154
+ count = value.length
155
+ if count < key_details[Constants::MIN_LENGTH]
156
+ error[Constants::ERROR_HASH_CLASS] = class_name
157
+
158
+ error[Constants::GIVEN_LENGTH] = count
159
+
160
+ error[Constants::ERROR_HASH_FIELD] = member_name
161
+
162
+ error[Constants::ERROR_HASH_MINIMUM_LENGTH] = key_details[Constants::MIN_LENGTH]
163
+
164
+ raise SDKException.new(Constants::MINIMUM_LENGTH_ERROR, nil, error, nil)
165
+
166
+ end
167
+
168
+ if count > key_details[Constants::MAX_LENGTH]
169
+ error[Constants::ERROR_HASH_CLASS] = class_name
170
+
171
+ error[Constants::ERROR_HASH_FIELD] = member_name
172
+
173
+ error[Constants::GIVEN_LENGTH] = count
174
+
175
+ error[Constants::ERROR_HASH_MAXIMUM_LENGTH] = key_details[Constants::MAX_LENGTH]
176
+
177
+ raise SDKException.new(Constants::MAXIMUM_LENGTH_ERROR, nil, error, nil)
178
+
179
+ end
180
+ end
181
+
182
+ if key_details.key? Constants::REGEX
183
+ if value.match(key_details[Constants::REGEX]).nil?
184
+ error[Constants::INSTANCE_NUMBER] = instance_number
185
+
186
+ error[Constants::ERROR_HASH_CLASS] = class_name
187
+
188
+ error[Constants::ERROR_HASH_FIELD] = member_name
189
+
190
+ raise SDKException.new(Constants::REGEX_MISMATCH_ERROR, nil, error, nil)
191
+
192
+ end
193
+
194
+ end
195
+
196
+ if key_details.key? Constants::UNIQUE
197
+
198
+ unique_values_map[name] = [] unless unique_values_map.key? name
199
+
200
+ if unique_values_map[name].include? value
201
+ error[Constants::FIRST_INDEX] = unique_values_map[name].find_index(value) + 1
202
+
203
+ error[Constants::NEXT_INDEX] = instance_number
204
+
205
+ error[Constants::ERROR_HASH_CLASS] = class_name
206
+
207
+ error[Constants::ERROR_HASH_FIELD] = member_name
208
+
209
+ raise SDKException.new(Constants::UNIQUE_KEY_ERROR, nil, error, nil)
210
+
211
+ else
212
+ unique_values_map[name].push(value)
213
+ end
214
+ end
215
+
216
+ true
217
+ end
218
+
219
+ # This method to get the module field JSON details file path.
220
+ # @return A String representing the module field JSON details file path.
221
+ def get_record_json_file_path
222
+ initializer = Initializer.get_initializer
223
+
224
+ file_name = initializer.user.email
225
+
226
+ file_name = file_name[0..file_name.index(Constants::AT) - 1] + initializer.environment.url
227
+
228
+ bytes = file_name.force_encoding('utf-8').bytes
229
+
230
+ str = Base64.encode64(bytes.pack('C*'))
231
+
232
+ str = str.chomp
233
+
234
+ File.join(initializer.resources_path + '/' + Constants::RESOURCES + '/' + str + '.json')
235
+ end
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,170 @@
1
+ require 'date'
2
+ require 'time'
3
+ require 'monitor'
4
+ require_relative 'constants'
5
+
6
+ module ZOHOCRMSDK
7
+ module Util
8
+ # This class converts JSON value to the expected data type.
9
+ class DataTypeConverter
10
+ @@sync_lock = Monitor.new
11
+
12
+ @@pre_converter_map = {}
13
+
14
+ @@post_converter_map = {}
15
+
16
+ # This method is to initialize the PreConverter and PostConverter lambda functions.
17
+ def self.init
18
+ return unless @@pre_converter_map.empty? && @@post_converter_map.empty?
19
+
20
+ @@sync_lock.synchronize do
21
+ add_to_map(DateTime.name,
22
+ lambda do |obj|
23
+ return DateTime.parse(Time.parse(obj).localtime.to_s)
24
+ end,
25
+ lambda do |obj|
26
+ return obj.strftime('%FT%T%:z')
27
+ end)
28
+
29
+ add_to_map(Date.name,
30
+ lambda do |obj|
31
+ return Date.parse(obj)
32
+ end,
33
+ lambda do |obj|
34
+ return obj.strftime('%F')
35
+ end)
36
+ add_to_map(Constants::DATETIME_NAMESPACE,
37
+ lambda do |obj|
38
+ return DateTime.parse(Time.parse(obj).localtime.to_s)
39
+ end,
40
+ lambda do |obj|
41
+ return obj.strftime('%FT%T%:z')
42
+ end)
43
+
44
+ add_to_map(Constants::DATE_NAMESPACE,
45
+ lambda do |obj|
46
+ return Date.parse(obj)
47
+ end,
48
+ lambda do |obj|
49
+ return obj.strftime('%F')
50
+ end)
51
+
52
+ string = lambda do |obj|
53
+ return obj.to_s
54
+ end
55
+ add_to_map(String.name, string, string)
56
+ add_to_map(Constants::STRING, string, string)
57
+
58
+ integer = lambda do |obj|
59
+ if obj == Constants::NULL_VALUE
60
+ return nil
61
+ end
62
+ return obj.to_i
63
+ end
64
+
65
+ add_to_map(Integer.name, integer, integer)
66
+ add_to_map(Constants::INTEGER, integer, integer)
67
+ add_to_map(Constants::LONG, integer, integer)
68
+
69
+ pre_convert_object = lambda do |obj|
70
+ return pre_convert_object_data(obj)
71
+ end
72
+
73
+ post_convert_object = lambda do |obj|
74
+ return post_convert_object_data(obj)
75
+ end
76
+
77
+ add_to_map(Constants::OBJECT,pre_convert_object, post_convert_object)
78
+
79
+ bool = lambda do |obj|
80
+ return obj
81
+ end
82
+
83
+ add_to_map(Constants::BOOLEAN, bool, bool)
84
+
85
+ float = lambda do |obj|
86
+ return obj.to_f
87
+ end
88
+
89
+ add_to_map(Float.name, float, float)
90
+ add_to_map(Constants::FLOAT, float, float)
91
+ add_to_map(Constants::DOUBLE, float, float)
92
+ end
93
+ end
94
+
95
+ # This method is to add PreConverter and PostConverter instance.
96
+ # @param name [String] A String containing the data type class name.
97
+ # @param pre_converter [Object] A PreConverter instance.
98
+ # @param post_converter [Object] A PostConverter instance.
99
+ def self.add_to_map(name, pre_converter, post_converter)
100
+ @@pre_converter_map[name] = pre_converter
101
+
102
+ @@post_converter_map[name] = post_converter
103
+ end
104
+
105
+ # This method is to convert JSON value to expected data value.
106
+ # @param obj [Object] A Object containing the JSON value.
107
+ # @param type [String] A String containing the expected method return type.
108
+ # @return A Value containing the expected data value.
109
+ # @raise Exception
110
+ def self.pre_convert(obj, type)
111
+ init
112
+ if @@pre_converter_map.key? type
113
+ return @@pre_converter_map[type].call(obj)
114
+ end
115
+ obj
116
+ end
117
+
118
+ # This method is to convert Java data to JSON data value.
119
+ # @param obj [Object] R containing the Java data value.
120
+ # @param type [String] A String containing the expected method return type.
121
+ # @return An Object containing the expected data value.
122
+ # @raise Exception
123
+ def self.post_convert(obj, type)
124
+ init
125
+ if @@post_converter_map.key? type
126
+ return @@post_converter_map[type].call(obj)
127
+ end
128
+ obj
129
+ end
130
+
131
+ def self.pre_convert_object_data(obj)
132
+ return obj
133
+ end
134
+
135
+ def self.post_convert_object_data(obj)
136
+ if obj.nil?
137
+ return nil
138
+ end
139
+
140
+ if obj.is_a? DateTime
141
+ return DataTypeConverter.post_convert(obj, Constants::DATETIME_NAMESPACE)
142
+ end
143
+
144
+ if obj.is_a? Date
145
+ return DataTypeConverter.post_convert(obj, Constants::DATE_NAMESPACE)
146
+ end
147
+
148
+ if obj.is_a? Array
149
+ values = []
150
+ unless obj.empty?
151
+ obj.each do |value|
152
+ values.push(DataTypeConverter.post_convert_object_data(value))
153
+ end
154
+ end
155
+ return values
156
+ elsif obj.is_a? Hash
157
+ map_instance = {}
158
+ unless obj.empty?
159
+ obj.each do |key, value|
160
+ map_instance[key] = DataTypeConverter.post_convert_object_data(value)
161
+ end
162
+ end
163
+ return map_instance
164
+ else
165
+ return obj
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,86 @@
1
+ require_relative 'converter'
2
+ require_relative 'stream_wrapper'
3
+ require_relative 'constants'
4
+
5
+ module ZOHOCRMSDK
6
+ module Util
7
+ # This class is to process the download file and stream response.
8
+ class Downloader < Converter
9
+ attr_accessor :unique_hash
10
+
11
+ def initialize(common_api_handler)
12
+ @unique_hash = {}
13
+
14
+ super(common_api_handler)
15
+ end
16
+
17
+ def append_to_request(request, request_object); end
18
+
19
+ def form_request(request_instance, class_path, member_json_details = nil); end
20
+
21
+ def get_wrapped_response(response, class_path)
22
+ get_response(response, class_path)
23
+ end
24
+
25
+ def get_response(response_object, class_path)
26
+ require_relative '../initializer'
27
+
28
+ json_details = Initializer.json_details
29
+
30
+ if class_path.to_s.include? Constants::DOUBLE_COLON
31
+ class_path_split = class_path.to_s.split(Constants::DOUBLE_COLON)
32
+ module_name = Utility.classname_to_filename(class_path_split[1])
33
+ file_name = Utility.classname_to_filename(class_path_split[2])
34
+ else
35
+ class_path_split = class_path.to_s.split(Constants::DOT)
36
+ module_name = class_path_split[-2]
37
+ file_name = Utility.classname_to_filename(class_path_split[-1])
38
+ end
39
+
40
+ require_relative '../' + module_name + '/' + file_name
41
+
42
+ package_name = Utility.path_to_package(class_path)
43
+ class_details = json_details[package_name]
44
+
45
+ if class_details.key?(Constants::INTERFACE) && !class_details[Constants::INTERFACE].nil? && class_details[Constants::INTERFACE]
46
+ classes = class_details[Constants::CLASSES]
47
+ classes.each do |class_name|
48
+ return get_response(response_object, class_name) if class_name.include? Constants::FILEBODYWRAPPER
49
+ end
50
+ return nil
51
+ else
52
+
53
+ instance = if class_path.is_a? String
54
+
55
+ if class_path.include? Constants::DOUBLE_COLON
56
+ Object.const_get(class_path).new
57
+ else
58
+ Object.const_get(Utility.class_to_load(class_path)).new
59
+ end
60
+ else
61
+ Object.const_get(Utility.class_to_load(class_path.to_s)).new
62
+ end
63
+
64
+ class_details.each do |member_name, member_json_details|
65
+ type = member_json_details[Constants::TYPE]
66
+
67
+ if type.downcase == Constants::STREAM_WRAPPER_CLASS_PATH.downcase
68
+ file_name = response_object.to_hash[Constants::CONTENT_DISPOSITION][0].split('=')[1]
69
+
70
+ file_name = file_name.split("''")[1] if file_name.include? "''"
71
+
72
+ file_name = file_name.gsub('"', '') if file_name.include? '"'
73
+
74
+ file_instance = Util::StreamWrapper.new(file_name, response_object.body)
75
+ instance_value = file_instance
76
+ end
77
+
78
+ instance.instance_variable_set(Constants::AT + member_name, instance_value)
79
+ end
80
+ end
81
+
82
+ instance
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,159 @@
1
+ require_relative 'converter'
2
+ require_relative 'stream_wrapper'
3
+ require_relative 'constants'
4
+
5
+ module ZOHOCRMSDK
6
+ module Util
7
+ # This class is to process the upload file and stream.
8
+ class FormDataConverter < Converter
9
+ attr_accessor :unique_hash
10
+
11
+ def initialize(common_api_handler)
12
+ @unique_hash = {}
13
+
14
+ super(common_api_handler)
15
+ end
16
+
17
+ def append_to_request(request_base, request_object)
18
+ request_base.set_form(set_file_body(request_object), Constants::MULTIPART_FORM_DATA) if request_object.is_a?(Hash)
19
+ end
20
+
21
+ def set_file_body(request_object)
22
+ data = []
23
+ request_object.each do |key, value|
24
+ if value.is_a? Array
25
+ value.each do |v|
26
+ if v.is_a? StreamWrapper
27
+ data.push([key, v.stream, { filename: v.name }])
28
+ else
29
+ data.push([key, v])
30
+ end
31
+ end
32
+ elsif value.is_a? StreamWrapper
33
+ data.push([key, value.stream, { filename: value.name }])
34
+ else
35
+ data.push([key, value])
36
+ end
37
+ end
38
+ data
39
+ end
40
+
41
+ def form_request(request_instance, class_path, instance_no, member_json_details = nil)
42
+ require_relative '../initializer'
43
+
44
+ package_name = Utility.path_to_package(class_path)
45
+ class_details = Initializer.json_details[package_name]
46
+ request_hash = {}
47
+
48
+ class_details.each_key do |member_name|
49
+ member_details = class_details[member_name]
50
+ if (member_details.key?(Constants::READ_ONLY) && member_details[Constants::READ_ONLY]) || (!member_details.key? Constants::NAME)
51
+ next
52
+ end
53
+
54
+ begin
55
+ modified = request_instance.public_send(Constants::IS_KEY_MODIFIED, member_name)
56
+ rescue StandardError => e
57
+ raise SDKException.new(nil, Constants::EXCEPTION_IS_KEY_MODIFIED, nil, e)
58
+ end
59
+
60
+ if (modified.nil? || modified.zero?) && member_details.key?(Constants::REQUIRED) && member_details[Constants::REQUIRED]
61
+ raise SDKException.new(Constants::MANDATORY_KEY_ERROR, Constants::MANDATORY_VALUE_ERROR + member_name)
62
+ end
63
+
64
+ member_data = request_instance.instance_variable_get(Constants::AT + member_name)
65
+
66
+ if !modified.nil? && (modified != 0) && !member_data.nil? && value_checker(request_instance.class.name, member_name, member_details, member_data, @unique_hash, instance_no)
67
+ key_name = member_details[Constants::NAME]
68
+ type = member_details[Constants::TYPE]
69
+ if type.downcase == Constants::LIST_NAMESPACE.downcase
70
+ request_hash[key_name] = set_json_array(member_data, member_details)
71
+ elsif (type.downcase == Constants::MAP_NAMESPACE.downcase) || (type.downcase == Constants::HASH_MAP_NAMESPACE.downcase)
72
+ request_hash[key_name] = set_json_object(member_data, member_details)
73
+ elsif member_details.key? Constants::STRUCTURE_NAME
74
+ request_hash[key_name] = form_request(member_data, member_details[Constants::STRUCTURE_NAME], 1, member_details)
75
+ else
76
+ request_hash[key_name] = member_data
77
+ end
78
+ end
79
+ end
80
+
81
+ request_hash
82
+ end
83
+
84
+ def set_json_object(field_value, member_json_details)
85
+ json_object = {}
86
+ request_object = field_value
87
+
88
+ if member_json_details.nil?
89
+ request_object.each_pair do |key, value|
90
+ json_object[key] = redirector_for_object_to_json(value)
91
+ end
92
+ else
93
+ keys_detail = request_object[Constants::KEYS]
94
+
95
+ keys_detail.each do |key_detail|
96
+ key_name = key_detail[Constants::NAME]
97
+
98
+ if json_object.key?(key_name) && !json_object[key_name].nil?
99
+
100
+ key_value = if key_detail.key? Constants::STRUCTURE_NAME
101
+ form_request(request_object[key_name], key_detail[Constants::STRUCTURE_NAME], 1, member_json_details)
102
+ else
103
+ redirector_for_object_to_json(request_object[key_name])
104
+ end
105
+ json_object[key_name] = key_value
106
+ end
107
+ end
108
+ end
109
+
110
+ json_object
111
+ end
112
+
113
+ def set_json_array(member_data, member_json_details)
114
+ json_array = []
115
+
116
+ if member_json_details.nil?
117
+
118
+ member_data.each do |value|
119
+ json_array.push(redirector_for_object_to_json(value))
120
+ end
121
+ elsif member_json_details.key? Constants::STRUCTURE_NAME
122
+
123
+ instance_count = 0
124
+ package = member_json_details[Constants::STRUCTURE_NAME]
125
+
126
+ member_data.each do |data|
127
+ instance_count += 1
128
+ json_array.push(form_request(data, package, instance_count, member_json_details))
129
+ end
130
+ else
131
+
132
+ member_data.each do |data|
133
+ json_array.push(redirector_for_object_to_json(data))
134
+ end
135
+
136
+ end
137
+ json_array
138
+ end
139
+
140
+ def redirector_for_object_to_json(request)
141
+ if request.is_a?(Hash)
142
+ set_json_object(request, nil)
143
+ elsif request.is_a?(Array)
144
+ set_json_array(request, nil)
145
+ else
146
+ request
147
+ end
148
+ end
149
+
150
+ def get_wrapped_response(response, class_path)
151
+ nil
152
+ end
153
+
154
+ def get_response(response_object, class_path)
155
+ nil
156
+ end
157
+ end
158
+ end
159
+ end