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,177 @@
1
+ require_relative '../header'
2
+ require_relative '../header_map'
3
+ require_relative '../param'
4
+ require_relative '../parameter_map'
5
+ require_relative '../exception/sdk_exception'
6
+ require_relative '../util/api_response'
7
+ require_relative '../util/common_api_handler'
8
+ require_relative '../util/constants'
9
+
10
+ module ZOHOCRMSDK
11
+ module Users
12
+ class UsersOperations
13
+
14
+ # Creates an instance of UsersOperations
15
+ def initialize
16
+ end
17
+
18
+ # The method to get users
19
+ # @param param_instance [ParameterMap] An instance of ParameterMap
20
+ # @param header_instance [HeaderMap] An instance of HeaderMap
21
+ # @return An instance of APIResponse
22
+ # @raise SDKException
23
+ def get_users(param_instance=nil, header_instance=nil)
24
+ if param_instance!=nil and !param_instance.is_a? ParameterMap
25
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: param_instance EXPECTED TYPE: ParameterMap', nil, nil)
26
+ end
27
+ if header_instance!=nil and !header_instance.is_a? HeaderMap
28
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
29
+ end
30
+ handler_instance = Handler::CommonAPIHandler.new
31
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users"
32
+ handler_instance.api_path = api_path
33
+ handler_instance.http_method = Constants::REQUEST_METHOD_GET
34
+ handler_instance.category_method = 'READ'
35
+ handler_instance.param = param_instance
36
+ handler_instance.header = header_instance
37
+ require_relative 'response_handler'
38
+ handler_instance.api_call(ResponseHandler.name, 'application/json')
39
+ end
40
+
41
+ # The method to create user
42
+ # @param request [RequestWrapper] An instance of RequestWrapper
43
+ # @return An instance of APIResponse
44
+ # @raise SDKException
45
+ def create_user(request)
46
+ if request!=nil and !request.is_a? RequestWrapper
47
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: RequestWrapper', nil, nil)
48
+ end
49
+ handler_instance = Handler::CommonAPIHandler.new
50
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users"
51
+ handler_instance.api_path = api_path
52
+ handler_instance.http_method = Constants::REQUEST_METHOD_POST
53
+ handler_instance.category_method = 'CREATE'
54
+ handler_instance.content_type = 'application/json'
55
+ handler_instance.request = request
56
+ handler_instance.mandatory_checker = true
57
+ require_relative 'action_handler'
58
+ handler_instance.api_call(ActionHandler.name, 'application/json')
59
+ end
60
+
61
+ # The method to update users
62
+ # @param request [BodyWrapper] An instance of BodyWrapper
63
+ # @return An instance of APIResponse
64
+ # @raise SDKException
65
+ def update_users(request)
66
+ if request!=nil and !request.is_a? BodyWrapper
67
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
68
+ end
69
+ handler_instance = Handler::CommonAPIHandler.new
70
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users"
71
+ handler_instance.api_path = api_path
72
+ handler_instance.http_method = Constants::REQUEST_METHOD_PUT
73
+ handler_instance.category_method = 'UPDATE'
74
+ handler_instance.content_type = 'application/json'
75
+ handler_instance.request = request
76
+ handler_instance.mandatory_checker = true
77
+ require_relative 'action_handler'
78
+ handler_instance.api_call(ActionHandler.name, 'application/json')
79
+ end
80
+
81
+ # The method to get user
82
+ # @param id [Integer] A Integer
83
+ # @param header_instance [HeaderMap] An instance of HeaderMap
84
+ # @return An instance of APIResponse
85
+ # @raise SDKException
86
+ def get_user(id, header_instance=nil)
87
+ if !id.is_a? Integer
88
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: Integer', nil, nil)
89
+ end
90
+ if header_instance!=nil and !header_instance.is_a? HeaderMap
91
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: header_instance EXPECTED TYPE: HeaderMap', nil, nil)
92
+ end
93
+ handler_instance = Handler::CommonAPIHandler.new
94
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users/"
95
+ api_path = api_path + id.to_s
96
+ handler_instance.api_path = api_path
97
+ handler_instance.http_method = Constants::REQUEST_METHOD_GET
98
+ handler_instance.category_method = 'READ'
99
+ handler_instance.header = header_instance
100
+ require_relative 'response_handler'
101
+ handler_instance.api_call(ResponseHandler.name, 'application/json')
102
+ end
103
+
104
+ # The method to update user
105
+ # @param id [Integer] A Integer
106
+ # @param request [BodyWrapper] An instance of BodyWrapper
107
+ # @return An instance of APIResponse
108
+ # @raise SDKException
109
+ def update_user(id, request)
110
+ if !id.is_a? Integer
111
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: Integer', nil, nil)
112
+ end
113
+ if request!=nil and !request.is_a? BodyWrapper
114
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: request EXPECTED TYPE: BodyWrapper', nil, nil)
115
+ end
116
+ handler_instance = Handler::CommonAPIHandler.new
117
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users/"
118
+ api_path = api_path + id.to_s
119
+ handler_instance.api_path = api_path
120
+ handler_instance.http_method = Constants::REQUEST_METHOD_PUT
121
+ handler_instance.category_method = 'UPDATE'
122
+ handler_instance.content_type = 'application/json'
123
+ handler_instance.request = request
124
+ require_relative 'action_handler'
125
+ handler_instance.api_call(ActionHandler.name, 'application/json')
126
+ end
127
+
128
+ # The method to delete user
129
+ # @param id [Integer] A Integer
130
+ # @return An instance of APIResponse
131
+ # @raise SDKException
132
+ def delete_user(id)
133
+ if !id.is_a? Integer
134
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: Integer', nil, nil)
135
+ end
136
+ handler_instance = Handler::CommonAPIHandler.new
137
+ api_path = "/crm/v#{Initializer.get_initializer.api_version}/users/"
138
+ api_path = api_path + id.to_s
139
+ handler_instance.api_path = api_path
140
+ handler_instance.http_method = Constants::REQUEST_METHOD_DELETE
141
+ handler_instance.category_method = Constants::REQUEST_METHOD_DELETE
142
+ require_relative 'action_handler'
143
+ handler_instance.api_call(ActionHandler.name, 'application/json')
144
+ end
145
+
146
+ class GetUsersParam
147
+ @@type = Param.new('type', 'com.zoho.crm.api.Users.GetUsersParam')
148
+ def self.type
149
+ @@type
150
+ end
151
+ @@page = Param.new('page', 'com.zoho.crm.api.Users.GetUsersParam')
152
+ def self.page
153
+ @@page
154
+ end
155
+ @@per_page = Param.new('per_page', 'com.zoho.crm.api.Users.GetUsersParam')
156
+ def self.per_page
157
+ @@per_page
158
+ end
159
+ end
160
+
161
+ class GetUsersHeader
162
+ @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.Users.GetUsersHeader')
163
+ def self.If_modified_since
164
+ @@If_modified_since
165
+ end
166
+ end
167
+
168
+ class GetUserHeader
169
+ @@If_modified_since = Header.new('If-Modified-Since', 'com.zoho.crm.api.Users.GetUserHeader')
170
+ def self.If_modified_since
171
+ @@If_modified_since
172
+ end
173
+ end
174
+
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,114 @@
1
+ require 'net/http'
2
+
3
+ require_relative '../initializer'
4
+ require_relative '../../../api/logger/sdk_logger'
5
+ require_relative 'constants'
6
+
7
+ module ZOHOCRMSDK
8
+ module Util
9
+ # This class is to make HTTP connections, trigger the requests and receive the response
10
+ class APIHTTPConnector
11
+ attr_accessor :url, :headers, :request_method, :parameters, :request_body, :content_type
12
+
13
+ def initialize
14
+ @url = nil
15
+
16
+ @headers = {}
17
+
18
+ @request_method = nil
19
+
20
+ @parameters = {}
21
+
22
+ @request_body = nil
23
+
24
+ @content_type = nil
25
+ end
26
+
27
+ def set_content_type_header
28
+ Constants::SET_CONTENT_TYPE_HEADER.each do |content_type|
29
+ if @url.include? content_type
30
+ @headers[Constants::CONTENT_TYPE] = @content_type
31
+ break
32
+ end
33
+ end
34
+ end
35
+
36
+ # This method makes a Zoho CRM Rest API request
37
+ # @param converterInstance A Converter class instance to call appendToRequest method.
38
+ # @return HttpResponse class instance or nil
39
+ # @raise Exception
40
+ def fire_request(converter_instance)
41
+ @parameters&.each do |param_key, value|
42
+ @parameters[param_key] = CGI.escape(value) if value.is_a? String
43
+ end
44
+
45
+ query_string = @parameters.to_a.map { |x| "#{x[0]}=#{x[1]}" }.join('&')
46
+
47
+ @url += '?' + query_string if !query_string.nil? && (query_string.strip != '')
48
+
49
+ url = URI(@url)
50
+ http = nil
51
+ initializer = Initializer.get_initializer
52
+ request_proxy = initializer.request_proxy
53
+ if request_proxy.nil?
54
+ http = Net::HTTP.new(url.host, url.port)
55
+ else
56
+ proxy_host = request_proxy.host
57
+ proxy_port = request_proxy.port
58
+ proxy_user = nil
59
+ proxy_password = nil
60
+ unless proxy_user.nil?
61
+ proxy_user = request_proxy.user_name
62
+ proxy_password = request_proxy.password
63
+ end
64
+ http = Net::HTTP.new(url.host, url.port, proxy_host, proxy_port, proxy_user, proxy_password)
65
+ SDKLog::SDKLogger.info(proxy_log(request_proxy))
66
+ end
67
+
68
+ http.use_ssl = true
69
+ http.open_timeout = initializer.sdk_config.open_timeout
70
+ http.read_timeout = initializer.sdk_config.read_timeout
71
+ http.write_timeout = initializer.sdk_config.write_timeout
72
+ http.keep_alive_timeout = initializer.sdk_config.keep_alive_timeout
73
+
74
+ if @request_method == Constants::REQUEST_METHOD_GET
75
+ req = Net::HTTP::Get.new(url.request_uri)
76
+ elsif @request_method == Constants::REQUEST_METHOD_POST
77
+ req = Net::HTTP::Post.new(url.request_uri)
78
+ elsif @request_method == Constants::REQUEST_METHOD_PUT
79
+ req = Net::HTTP::Put.new(url.request_uri)
80
+ elsif @request_method == Constants::REQUEST_METHOD_PATCH
81
+ req = Net::HTTP::Patch.new(url.request_uri)
82
+ elsif @request_method == Constants::REQUEST_METHOD_DELETE
83
+ req = Net::HTTP::Delete.new(url.request_uri)
84
+ end
85
+
86
+ set_content_type_header unless @content_type.nil?
87
+
88
+ @headers&.each { |key, value| req.add_field(key, value) }
89
+
90
+ converter_instance.append_to_request(req, @request_body) unless @request_body.nil?
91
+
92
+ SDKLog::SDKLogger.info(to_s)
93
+
94
+ response = http.request(req)
95
+ response
96
+ end
97
+
98
+ def to_s
99
+ req_headers = @headers.clone
100
+ req_headers[Constants::AUTHORIZATION] = Constants::CANT_DISCLOSE
101
+ @request_method + ' - ' + Constants::URL + ' = ' + @url + ', ' + Constants::HEADERS + ' = ' + req_headers.to_s + ', ' + Constants::PARAMS + ' = ' + @parameters.to_s
102
+ end
103
+
104
+ def proxy_log(request_proxy)
105
+ proxy_log = Constants::PROXY_SETTINGS + Constants::PROXY_HOST + request_proxy.host + " , "
106
+ proxy_log += Constants::PROXY_PORT + request_proxy.port.to_s
107
+ if request_proxy.user_name.nil?
108
+ proxy_log += " , " + Constants::PROXY_USER + request_proxy.user_name
109
+ end
110
+ proxy_log
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,18 @@
1
+ module ZOHOCRMSDK
2
+ module Response
3
+ # This class is the common API response object.
4
+ class APIResponse
5
+ attr_reader :headers, :status_code, :data_object, :is_expected
6
+ # Creates an APIResponse class instance with the specified parameters.
7
+ # @param headers A Hash containing the API response headers.
8
+ # @param status_code A Integer containing the API response HTTP status code.
9
+ # @param object A Object containing the API response class instance.
10
+ def initialize(headers, status_code, object, is_expected)
11
+ @headers = headers
12
+ @status_code = status_code
13
+ @data_object = object
14
+ @is_expected = is_expected
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ module ZOHOCRMSDK
2
+ module Util
3
+ class Choice
4
+ attr_reader :value
5
+
6
+ def initialize(value)
7
+ @value = value
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,241 @@
1
+ require 'uri'
2
+
3
+ require_relative 'json_converter'
4
+ require_relative 'form_data_converter'
5
+ require_relative 'data_type_converter'
6
+ require_relative 'downloader'
7
+ require_relative 'api_response'
8
+ require_relative 'api_http_connector'
9
+ require_relative '../initializer'
10
+ require_relative '../header'
11
+ require_relative '../param'
12
+ require_relative '../header_map'
13
+ require_relative '../parameter_map'
14
+ require_relative 'constants'
15
+ require_relative '../exception/sdk_exception'
16
+ require_relative '../../../api/logger/sdk_logger'
17
+
18
+ module ZOHOCRMSDK
19
+ module Handler
20
+ # This class is to process the API request and its response.
21
+ # Construct the objects that are to be sent as parameters or in the request body with the API.
22
+ # The Request parameter, header and body objects are constructed here.
23
+ # Process the response JSON and converts it to relevant objects in the library.
24
+ class CommonAPIHandler
25
+ attr_accessor :api_path, :header, :param, :category_method, :request, :http_method, :module_api_name, :content_type, :mandatory_checker
26
+
27
+ def initialize
28
+ @api_path = nil
29
+
30
+ @header = HeaderMap.new
31
+
32
+ @param = ParameterMap.new
33
+
34
+ @mandatory_checker = false
35
+
36
+ @request = nil
37
+
38
+ @http_method = nil
39
+
40
+ @category_method = nil
41
+
42
+ @module_api_name = nil
43
+
44
+ @content_type = nil
45
+ end
46
+
47
+ # This method is used in constructing API request and response details. To make the Zoho CRM API calls.
48
+ # @param class_name [String] A Class containing the method return type.
49
+ # @param encode_type [String] A String containing the expected API response content type.
50
+ # @see Util::APIHTTPConnector
51
+ # @return A APIResponse representing the Zoho CRM API response instance or nil.
52
+ def api_call(class_name, encode_type)
53
+ if Initializer.get_initializer.nil?
54
+ raise SDKException.new(Constants::SDK_UNINITIALIZATION_ERROR, Constants::SDK_UNINITIALIZATION_MESSAGE, nil, nil)
55
+ end
56
+
57
+ connector = Util::APIHTTPConnector.new
58
+
59
+ begin
60
+ set_api_url(connector)
61
+ rescue SDKException => e
62
+ SDKLog::SDKLogger.severe(Constants::SET_API_URL_EXCEPTION, e)
63
+ raise e
64
+ rescue StandardError => e
65
+ ex = SDKException.new(nil, nil, nil, e)
66
+ SDKLog::SDKLogger.severe(Constants::SET_API_URL_EXCEPTION, ex)
67
+ raise ex
68
+ end
69
+
70
+ connector.request_method = @http_method
71
+
72
+ connector.content_type = @content_type
73
+
74
+ connector.headers = @header.header_hash if !@header.nil? && !@header.header_hash.empty?
75
+
76
+ connector.parameters = @param.param_hash if !@param.nil? && !@param.param_hash.empty?
77
+
78
+ begin
79
+ Initializer.get_initializer.token.authenticate(connector)
80
+ rescue SDKException => e
81
+ SDKLog::SDKLogger.severe(Constants::AUTHENTICATION_EXCEPTION, e)
82
+ raise e
83
+ rescue StandardError => e
84
+ ex = SDKException.new(nil, nil, nil, e)
85
+ SDKLog::SDKLogger.severe(Constants::AUTHENTICATION_EXCEPTION, ex)
86
+ raise ex
87
+ end
88
+
89
+ converter_instance = nil
90
+
91
+ if !@content_type.nil? && (Constants::IS_GENERATE_REQUEST_BODY.include? http_method)
92
+
93
+ request = nil
94
+
95
+ begin
96
+ converter_instance = get_converter_class_instance(@content_type.to_s.downcase)
97
+ request = converter_instance.form_request(@request, @request.class.name, nil, nil)
98
+ rescue SDKException => e
99
+ SDKLog::SDKLogger.severe(Constants::FORM_REQUEST_EXCEPTION, e)
100
+ raise e
101
+ rescue StandardError => e
102
+ ex = SDKException.new(nil, nil, nil, e)
103
+ SDKLog::SDKLogger.severe(Constants::FORM_REQUEST_EXCEPTION, ex)
104
+ raise ex
105
+ end
106
+
107
+ connector.request_body = request
108
+ end
109
+
110
+ begin
111
+ connector.headers[Constants::ZOHO_SDK] = RUBY_PLATFORM + '/ruby-' + Constants::ZOHO_API_VERSION + '/' + RUBY_VERSION + ':' + Constants::SDK_VERSION
112
+
113
+ response = connector.fire_request(converter_instance)
114
+
115
+ status_code = response.code.to_i
116
+
117
+ headers = response.each_header.to_h
118
+
119
+ is_model = false
120
+
121
+ return_object = nil
122
+
123
+ unless response.body.nil?
124
+ if headers.include? Constants::CONTENT_TYPE
125
+ mime_type = headers[Constants::CONTENT_TYPE]
126
+
127
+ mime_type = mime_type.split(';')[0] if mime_type.include? ';'
128
+ converter_instance = get_converter_class_instance(mime_type.to_s.downcase)
129
+
130
+ return_object = converter_instance.get_wrapped_response(response, class_name)
131
+ else
132
+ SDKLog::SDKLogger.info(response.inspect + ":" + headers.inspect)
133
+ end
134
+ end
135
+
136
+ unless return_object.nil?
137
+ is_model = true if (class_name == return_object.class.name) || is_expected_type(return_object, class_name)
138
+ end
139
+ Response::APIResponse.new(headers, status_code, return_object, is_model)
140
+ rescue SDKException => e
141
+ SDKLog::SDKLogger.severe(Constants::API_CALL_EXCEPTION, e)
142
+ raise e
143
+ rescue StandardError => e
144
+ ex = SDKException.new(nil, nil, nil, e)
145
+ SDKLog::SDKLogger.severe(Constants::API_CALL_EXCEPTION, ex)
146
+ raise ex
147
+ end
148
+ end
149
+
150
+ def is_expected_type(model, class_name)
151
+ ancestors = model.class.ancestors
152
+ ancestors.each do |ancestor|
153
+ return true if ancestor.name == class_name
154
+ end
155
+ false
156
+ end
157
+
158
+ # This method is to add an API request parameter.
159
+ # @param param [Param] A Param class instance.
160
+ # @param param_value [Object] An object containing the API request parameter value.
161
+ def add_param(param, param_value)
162
+ if param.is_a? Param
163
+ unless param_value.nil?
164
+ @param = ParameterMap.new if @param.nil?
165
+
166
+ @param.add(param, param_value)
167
+ end
168
+ end
169
+ end
170
+
171
+ def param=(param_instance)
172
+ return if (param_instance==nil)
173
+ @param = ParameterMap.new if @param.nil?
174
+ @param.param_hash = @param.param_hash.merge(param_instance.param_hash)
175
+ end
176
+
177
+ def header=(header_instance)
178
+ return if (header_instance==nil)
179
+ @header = HeaderMap.new if @header.nil?
180
+ @header.header_hash = @header.header_hash.merge(header_instance.header_hash)
181
+ end
182
+
183
+ # This method is to add an API request header.
184
+ # @param header [Header] A Header class instance.
185
+ # @param param_value [Object] An object containing the API request parameter value.
186
+ def add_header(header, header_value)
187
+ if header.is_a? Header
188
+ unless header_value.nil?
189
+
190
+ @header = HeaderMap.new if @header.nil?
191
+
192
+ @header.add(header, header_value)
193
+ end
194
+ end
195
+ end
196
+
197
+ def set_api_url(connector)
198
+ api_path = ''
199
+ initializer = Initializer.get_initializer
200
+ if @api_path.to_s.include? Constants::HTTP
201
+ if @api_path.to_s.include? Constants::CONTENT_API_URL
202
+ api_path = initializer.environment.file_upload_url
203
+ begin
204
+ uri = URI.parse(@api_path)
205
+
206
+ api_path += uri.path
207
+ rescue URI::InvalidURIError => e
208
+ ex = SDKException.new(nil, nil, nil, e)
209
+ SDKLog::SDKLogger.severe(Constants::INVALID_URL_ERROR, ex)
210
+
211
+ raise ex
212
+ end
213
+ else
214
+ @api_path = @api_path.to_s.slice(1..@api_path.to_s.length) if @api_path.to_s.slice(0..0) == '/'
215
+ api_path += @api_path
216
+ end
217
+ else
218
+ api_path += initializer.environment.url
219
+
220
+ api_path += @api_path
221
+ end
222
+ connector.url = api_path
223
+ end
224
+
225
+ # This method is used to get a Converter class instance.
226
+ # @param encode_type [String] A String containing the expected API response content type.
227
+ def get_converter_class_instance(encode_type)
228
+ case encode_type
229
+ when 'application/json', 'text/plain' , 'application/ld+json'
230
+ Util::JSONConverter.new(self)
231
+ when 'application/xml', 'text/xml'
232
+ Util::XMLConverter.new(self)
233
+ when 'multipart/form-data'
234
+ Util::FormDataConverter.new(self)
235
+ when 'image/png','image/jpeg','image/gif','image/tiff','image/svg+xml','image/bmp','image/webp','text/csv','text/html','text/css','text/javascript','text/calendar','application/x-download','application/zip','application/pdf','application/java-archive','application/javascript','application/octet-stream','application/xhtml+xml','application/x-bzip','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/gzip','application/x-httpd-php','application/vnd.ms-powerpoint','application/vnd.rar','application/x-sh','application/x-tar','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/x-7z-compressed','audio/mpeg','audio/x-ms-wma','audio/vnd.rn-realaudio','audio/x-wav','audio/3gpp','audio/3gpp2','video/mpeg','video/mp4','video/webm','video/3gpp','video/3gpp2','font/ttf'
236
+ Util::Downloader.new(self)
237
+ end
238
+ end
239
+ end
240
+ end
241
+ end